Use one, track level, package.json
See original GitHub issueI realize this was proposed previously (#235) and closed as wontfix
, but there is a simple and correct way to have a single install of all the necessary tools. The only necessary package.json
change would be to the scripts
section.
Right now we have a package.json
in each exercise with a scripts
section as follows:
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"lint": "eslint .",
"lint-test": "eslint . && jest --no-cache ./* "
},
All package.json
files should be removed from the exercise directories, and a single package.json
would be added to the track directory. The scripts
section of it should be changed to the following:
"scripts": {
"test": "jest --no-cache",
"watch": "jest --no-cache --watch",
"lint": "eslint --ignore-pattern '*.spec.js'"
},
The usage is changed very slightly.
Running npm test
or npm run lint
would test and lint, respectively, all exercises. To test or lint a single particular exercise, simply append -- <exercise-name>
.
So, for example, if I wanted to test the simple-cipher
exercise I would run npm test -- simple-cipher
.
I tested this on MacOS and Linux, and it works correctly. I haven’t tested it on Windows, but my understanding is that it should work the same way.
I didn’t begin with a pull request, although I’d be happy to do so, because I wanted to get feedback and hopefully buy-in before proceeding.
Thanks for reading. Looking forward to your thoughts.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:17 (14 by maintainers)
Top GitHub Comments
@matthewmorgan There are two reasons doing this helps the end-users.
As an end-user myself, I was put off by having to reinstall identical
node_modules
in each exercise. So much so I took the time to solve the problem for myself and propose it here. Others may have the same irritation, and indeed, friends I’ve directed to this track have mentioned it.More importantly, part of what we’re trying to teach is the right way to structure code, and for ECMAScript that very much includes, or should include, the tools, as they’re fundamental to the experience in the real world.
Hi @chrissygonzalez , yes! That works, but still requires the outside-of-the-exercise “setup” 😃