fix: add .cmd to commands on windows#124
Conversation
ljharb
left a comment
There was a problem hiding this comment.
super gross hack, but this is a cleaner way to do an existing hack, so, nice :-)
5670b31 to
59c129e
Compare
|
Ah right, the |
|
@nathanhleung what do you think about adding Windows end-to-end tests to |
|
travis-ci is slow and dying; i'd suggest github actions. I can convert the existing tests to github actions if @nathanhleung is OK with that; windows tests can go in separately/in parallel as a separate workflow. |
|
Cool, if this is the way to go, maybe that could be done with a |
I think that's a great idea — don't want to break this package for Windows users in the future if I don't have to.
It would be awesome if you could do that, thanks! |
The branch is no longer throwing the $ git fetch
$ git checkout nathanhleung-fix
$ yarn build && node . --yarn --dev @upleveled/eslint-config-upleveled && git reset --hard HEAD
yarn run v1.22.5
$ npm run clean
> install-peerdeps@3.0.0 clean
> rimraf lib
$ babel src --out-dir lib --ignore *.test.js
Successfully compiled 9 files with Babel (1411ms).
✨ Done in 3.14s.
install-peerdeps v3.0.0
Installing peerdeps for @upleveled/eslint-config-upleveled@latest.
yarn add @upleveled/eslint-config-upleveled@1.5.6 eslint-config-react-app@6.0.0 eslint-import-resolver-typescript@2.3.0 eslint-plugin-cypress@2.11.2 eslint-plugin-unicorn@26.0.1 typescript@4.1.3 --dev
SUCCESS @upleveled/eslint-config-upleveled
and its peerDeps were installed successfully.
HEAD is now at 59c129e build: remove extraneous dependencies. resolves #115Seems good to go! 🛳 |
|
Confirmed that it works on Windows. Please complete this pull request. |
Great! I'll cut 3.0.1 and push to NPM |
This PR hopefully resolves #123. Here is what I think is going on:
spawnCommand(a thininstall-peerdeps-specific wrapper aroundchild_process.spawnto promisify it) was called only in the install step (the call was something likespawnCommand("npm", ["install", "eslint-config-airbnb", ...restOfPeerdeps]).spawnCommand, to get package info directly from the package manager (through some code along the lines ofspawnCommand("npm", ["info", "eslint-config-airbnb"]).spawnCommand, to preprocess the first argument tospawnCommandon Windows due tochild_process.spawndoes not work withnpm run scriptson windows. nodejs/node#3675. Namely, the call on Windows would be changed to something likespawnCommand("npm.cmd", ["install", "eslint-config-airbnb"])(note the.cmdsuffix added to the first argument).spawnCommand, automatically adding the.cmdsuffix if it's not already present if it detects the tool running on Windows, which hopefully fixes ERR spawn npm ENOENT #123 and prevents a bug like this from happening again in the future.