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

Single quotes in scripts don't work (just Windows?) #302

Open
fdeters opened this issue Oct 8, 2024 · 3 comments · May be fixed by #303
Open

Single quotes in scripts don't work (just Windows?) #302

fdeters opened this issue Oct 8, 2024 · 3 comments · May be fixed by #303

Comments

@fdeters
Copy link

fdeters commented Oct 8, 2024

OS: Windows
Shell: Git Bash


Proposed solution: Use escaped double-quotes instead of single-quotes in package.json scripts


Scripts defined in the root-level package.json and the one in the addon's folder use single-quotes. For example:

"scripts": {
    ...
    "lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
    "lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
    ...
  },

This lead to pnpm errors that took a while for me to figure out (pnpm lint failed as well, this is the result of me running pnpm --filter "*" lint explicitly so it would do something more interesting):

pnpm --filter "*" lint

Scope: 2 of 3 workspace projects
my-addon lint$ concurrently 'pnpm:lint:*(!fix)' --names 'lint:'
│ ' was unexpected at this time.
│ C:\path\to\my-addon\my-addon>  "C:\path\to\my-addon…
└─ Failed in 39ms at C:\path\to\my-addon\my-addon
C:\path\to\my-addon\my-addon:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] lint: `concurrently 'pnpm:lint:*(!fix)' --names 'lint:'`
Exit status 255

It worked for me once I replaced all of the single quotes with escaped double quotes:

"scripts": {
  ...
  "lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
  "lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
  ...
},
@NullVoxPopuli
Copy link
Collaborator

single quotes work fine on mac and linux 😅

@fdeters
Copy link
Author

fdeters commented Oct 8, 2024

@NullVoxPopuli right, that's what I assumed. Do escaped double quotes not work on mac and linux? It would be great if the blueprint scripts worked out of the box on Windows as well. Happy to make a PR with the changes if it's useful.

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Oct 8, 2024

yea, a PR would be great!

(linux and mac work with all quotes, and CI will verify)

@fdeters fdeters linked a pull request Oct 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants