Comments (5)
Hmmm, that could get really annoying. Let's just document it and let people do whatever you want. I'm good to accept a PR for this. The relevant code is here and here. I think that we should probably have an intermediary function that we call there which will look up the pre/post scripts for the given script. Here are a few variations of what should work I think:
{
prefoo: 'echo prefoo', // thinking I'd be ok without this one...
foo: 'echo foo',
postfoo: 'echo postfoo', // and this one... I think if you want pre/post, make in an object with pre/post. Thoughts?
bar: {
pre: 'echo prebar',
default: 'echo bar',
post: 'echo postbar',
},
baz: {
default: {
pre: 'echo prebaz',
script: 'echo baz',
post: 'echo postbaz',
},
foobar: {
pre: 'echo prefoobar',
script: 'echo foobar',
post: 'echo postfoobar',
}
}
}
from nps.
One thing I'd be worried about is people would expect things to work the same way that normal lifecycle hooks work (like install
). So someone may try to make a prepublish
script expecting it to run when they run npm publish
but it wouldn't. Any ideas of how to combat that?
from nps.
Hmmmm perhaps for odd cases like that we console.log
a warning if they have one of 'wierd' npm script commands.
warning 'commandXYZ' won't run like npm scripts. See issue [link to long npm github thread]
I can't remember which work not how you'd expect. I'm sure you do though =)
from nps.
I think if you want pre/post, make in an object with pre/post. Thoughts?
I agree
I want to sign up for this, but here is a change I wish to propose. Thoughts?
{
prefoo: 'echo prefoo', // thinking I'd be ok without this one...
foo: 'echo foo',
postfoo: 'echo postfoo', // and this one... I think if you want pre/post, make in an object with pre/post. Thoughts?
bar: {
pre: 'echo prebar',
- default: 'echo bar',
+ script: 'echo bar',
post: 'echo postbar',
},
baz: {
default: {
pre: 'echo prebaz',
script: 'echo baz',
post: 'echo postbaz',
},
foobar: {
pre: 'echo prefoobar',
script: 'echo foobar',
post: 'echo postfoobar',
},
},
}
from nps.
We've decided to not do this. See #83 for more info.
from nps.
Related Issues (20)
- Cannot stop running scripts
- Version after 5.9.8 HOT 2
- 5.9.10 (or 5.9.9) is not executable HOT 4
- Missing documentation for .npsrc HOT 1
- Support colon as a path field delimiter
- [Feature Req.] Typescript support? HOT 4
- The script called build failed with exit code 1 HOT 1
- README.md contains a broken link HOT 1
- yaml include HOT 1
- How can I add nps-utils to .npsrc?
- Automatic conversion using init does not take into account $npm_package
- Is there an options for --prefix?
- Using `package-scripts.js` in ESM context? HOT 3
- Security - Inefficient Regular Expression Complexity in chalk/ansi-regex HOT 1
- Offering to maintain nps HOT 6
- Run all subcommands
- nps [enter] should list only top level commands by default.
- How to add an extra command in using `nps`
- [Feature]: provide --interactive (-i) option
- Scripts that start with "start"are not properly migrated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nps.