-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Is there any interest for adding the possibility to patch the package.json with scripts defined in a seperate file?
It wouldn't be hard to implement and would allow users to use YAML, JS or JSON5 and their pleasantness.
This would also allow the command and the description to be right next to eachother, which i would like
command could look like this:
ntl -p/--patch path/to/file (defaulting to <pkg-root>/.ntlrc.<ext>)
so the structure would be something like:
{
"build": {
"command": "make build",
"description": "Builds the project"
},
"coverage": {
"command": "jest --coverage",
"description": "Run test outputing code coverage"
},
"test": {
"command": "jest"
},
// or if it has no desc, a shorthand
"lint": "standard src/**/*.js"
}
this could be used together with general configs #23 like:
{
// config properites...
"scripts": {
// like above...
}
}
this would also expose a common surface for a module that extends ntl, as config properties can be easily added. we could also add a complementary API that lets you import these scripts (for eg. for usage with npm run-script)
this could also be extended down the line to rather easily implement monorepo support #58 via a 'namespace': {<name>: <path/to/package>}
property or something like that.
I'm planning on writing a patcher that does something like this (without the many practicallity featueres of course) for a module i'm writing. so if there is interest in this, i could provide a fundament and help with the further implementation