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

[Documentation] Additional documentation needed in the Yarn 2.0 migration related to "script" incompatibilities #1814

Open
2 tasks
yinzara opened this issue Sep 6, 2020 · 2 comments
Labels
documentation This issue or pull request is about the documentation enhancement New feature or request

Comments

@yinzara
Copy link

yinzara commented Sep 6, 2020

  • I'd be willing to implement this feature
  • This feature can already be implemented through a plugin

Describe the user story

With the introduction of the yarn shell in Yarn 2.0, there are actually many idiosyncrasies about differences between how a script may function in Yarn 1 and Yarn 2. From glob pattern auto-expansion to non-existent environment variable references causing errors, there are a set of things a Yarn 1.0 user needs to know to ensure his "script"s remain working in Yarn 2.0

The Yarn 2.0 migration page at https://yarnpkg.com/advanced/migration mentions calling your scripts via "yarn node" and the details about pre and post scripts, but makes no mention of the incompatibility of the scripts themselves. I did not discover these issues until I was already fully converted with all other changes and spent more time fixing my scripts than I did with almost everything else in the migration combined.

Describe the solution you'd like

A section in the migration page about the general things to look out for in your scripts and ways to correct them. Simply knowing I could replace "$PWD" with "$(cwd)" or escaping anything glob pattern like that didn't match files with single quotes, would have been extremely helpful and saved me posting issues.

@arcanis
Copy link
Member

arcanis commented Sep 6, 2020

Yup, good point 👍

@jeffrson
Copy link

Yes, this would be very helpful!

Use case: we have a package.json script, that calls node -e "..." with a regular expression including "^".

Apparently yarn breaks the input line at that position. How can we solve the error (without an additional script)?

@paul-soporan paul-soporan added the documentation This issue or pull request is about the documentation label Sep 16, 2022
SuibianP added a commit to SuibianP/nusmods that referenced this issue Aug 18, 2023
Yarn 2+ expands glob patterns using its own shell and fails the `lint` script.

Quote the pattern to prevent premature expansion. Escaped double quotes are used
for compatibility with cmd.exe.

Related-Bug: mysticatea/npm-run-all#200 yarnpkg/berry#1814
SuibianP added a commit to SuibianP/nusmods that referenced this issue Aug 18, 2023
Yarn 2+ expands glob patterns using its own shell and fails the `lint` script.

Quote the pattern to prevent premature expansion. Escaped double quotes are used
for compatibility with cmd.exe.

Related-Bug: mysticatea/npm-run-all#200 yarnpkg/berry#1814
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This issue or pull request is about the documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants