Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does cmdShim() support sh / batch (cmd) / pwsh script as src? #10

Open
tats-u opened this issue Jan 19, 2019 · 5 comments
Open

Does cmdShim() support sh / batch (cmd) / pwsh script as src? #10

tats-u opened this issue Jan 19, 2019 · 5 comments

Comments

@tats-u
Copy link

tats-u commented Jan 19, 2019

Related:

Yarn for Windows calls cmdShim() with the following src and to when yarn global add create-react-app is executed:

src to
[Yarn global folder]\node_modules\.bin\create-react-app (for sh) [prefix]\bin\create-react-app
[Yarn global folder]\node_modules\.bin\create-react-app.cmd [prefix]\bin\create-react-app.cmd
[Yarn global folder]\node_modules\.bin\create-react-app.ps1 [prefix]\bin\create-react-app.ps1

https://github.com/yarnpkg/yarn/blob/1af4c5f50c4c146a833c0c2b20d10be1f5a61803/src/cli/commands/global.js#L168
https://github.com/yarnpkg/yarn/blob/1af4c5f50c4c146a833c0c2b20d10be1f5a61803/src/cli/commands/global.js#L168

As the result, this module creates:

  • Junk named create-react-app.cmd and create-react-app.ps1, which looks like a batch or PowerShell script but in fact are sh scripts; They can't execute in CMD or PowerShell in spite of their extensions.
  • 4 scripts with strange names create-react-app.{ps1,cmd}.{cmd,ps1}; To make matters worse, create-react-app.ps1.* can't be executed when pwsh (for .NET Core) is not installed.

This issue was suppressed in Yarn until this module suppored PowerShell shims because the following code of Yarn, which replace create-react-app.cmd (junk sh script) with create-react-app.cmd.cmd:
https://github.com/yarnpkg/yarn/blob/1af4c5f50c4c146a833c0c2b20d10be1f5a61803/src/cli/commands/global.js#L169-L171

Anyway, this module must:

  • Sense that src is a shell (sh, CMD, or PowerShell) script (maybe created by this module).
  • Supress creating unwanted scripts.
  • Create shims to PowerShell scripts that properly works even if pwsh is unavailable.
@tats-u
Copy link
Author

tats-u commented Jan 24, 2019

Why doesn't anyone reply? You don't mean to say that the problem of the competitive package manager makes no nevermind to you? Your reply is so late that even a wontfix label turned to be welcome.

@zkochan
Copy link
Member

zkochan commented Jan 24, 2019

I am sorry. If someone would like to work on this, I will review/merge/publish. I don't have capacity for this at the moment.

@zkochan
Copy link
Member

zkochan commented Jan 24, 2019

But it probably needs a review from a yarn maintainer because it is needed by yarn. I cannot take the responsibility of approving such changes without approval from official yarn maintainers

@xieccc
Copy link

xieccc commented Jan 25, 2019

Why doesn't anyone reply? You don't mean to say that the problem of the competitive package manager makes no nevermind to you? Your reply is so late that even a wontfix label turned to be welcome.

I am the reporter of issue 6913, thank you for finding a deeper problem. My ability is not enough to find such a deep place this time. I have been paying attention to it, and now someone has finally responded. Please do not get angry, I think there may be something in the yarn maintainer that causes them to not pay attention to this issue at this time.

@tats-u
Copy link
Author

tats-u commented Jan 25, 2019

@zkochan Thank you for your reply. Yarn contributers found a previous version of cmd-shim create *.cmd (junk sh script shim to .cmd) and *.cmd.cmd, and added the makeshift
https://github.com/yarnpkg/yarn/blob/1af4c5f50c4c146a833c0c2b20d10be1f5a61803/src/cli/commands/global.js#L169-L171. I wish the maintainers to understand the need of this change.
I tried to create a PR but it was too difficult for me. Maybe I'll try again, or I wish someone created one on behalf of me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants