[Discussion] Strategy Change
Opened this issue · 1 comments
Sorry for taking so long in providing feedback.
I like the idea of breaking out the command from the package.json
file as they can become long and difficult to read; and really ugly to comment. However, it feels a little weird to me to have a source file (nabs.yml
) that exists to make changes to package.json
. The reason, I think, that it feels weird to me is because when you make changes to the nabs.yml
file you also must remember to run the conversion for package.json
as well.
I've been thinking about this a little bit. My, two, suggestions for thought exploration are:
- Is there a way to "capture"
npm run ...
calls and do something with nabs before, after, or instead of lettingnpm
do its work? If so this might be a better solution. - If the first option isn't possible, maybe register the "tasks" in the
package.json
script directives and have them simply execute nabs "tasks". - If you are OK with a global package executable however you could skip the
package.json
completely IMHO.
I personally avoid installing any npm modules globally as a rule. I've even thought about setting up my shell to include $(cwd)/node_modules/.bin/
to my path so that I can install modules locally but use them as if they were global.
Short Answers
- No but neat idea.
- What you describe sounds like Scripty.
- What you describe sounds like nps.
- Likewise I only have 1 global installed. Any dependency's binary can be run as:
yarn <bin>
npx <bin>
(auto-installs if not found)$(npm bin)/<bin>
Comparison
What makes nabs special is that it's not magic at all. It's just package scripts. npm's stance has consistently been (npm/npm#4482) package.json
is a machine manifest not a config file. Meanwhile package scripts are our build system. Each project approaches this impedance mismatch differently.
Project | Description | Pros | Cons |
---|---|---|---|
edit-script | Open package script in an editor and save back to package.json . |
package.json . |
|
Scripty | Run executable file from a directory structure resembling nabs's config. | ||
nps | Run shell string from a config resembling nabs's. | npm start <script> instead of npm run <script> . |
|
nabs | You have arrived. | nabs.yml . It's too rare for a watch command. A build tool plugin would make sense. |