embroider-build / addon-blueprint

Blueprint for v2-formatted Ember addons
MIT License
29 stars 28 forks source link

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

Open fdeters opened 1 month ago

fdeters commented 1 month ago

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  my-addon@0.0.0 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 commented 1 month ago

single quotes work fine on mac and linux :sweat_smile:

fdeters commented 1 month ago

@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 commented 1 month ago

yea, a PR would be great!

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