As it turns out, getting programmatic access to NPM's lifecycle stages is much harder than it sounds. This package consumes npm
and exposes all its lifecycle stages as an array of strings (plus a TypeScript enum if you're into that sort of thing).
$ npm install --save @wizardsoftheweb/npm-lifecycle-stages
In the interest of keeping the final package small, none of the tests are installed. Instead, you'll need to clone the repo.
$ git clone https://github.com/wizardsoftheweb/npm-lifecycle-stages.git
$ cd npm-lifecycle-stages
$ npm install
$ npm t
This is an array of all lifecycle stages, e.g.
NpmLifecycleStages.indexOf("poststart") > -1;
This is an enum whose keys are the stages conveniently initialized with the stage, e.g.
ENpmLifecycleStages.stage === "stage";
Polluting the global namespace is generally considered a bad idea, so why would you do it on NPM?
These percentages are pretty arbitrary. Today's 47% could be tomorrow's 90% or vice versa.
I'd like to see this maintain the semver of the upstream repo, so this feature list doesn't mean a whole lot. For the most part, these are things that make it easier to run and update.
Progess | Feature |
---|---|
100% | Add build action |
100% | Add update action |
0% | Figure out cron action |
0% | Find a good location for semi-permanent cron execution |
100% | Test generated code |
-3% | Test build and runner scripts |
100% | Export the full namespace |
100% | Compile declaration file |
72% | Write docs |
0% | Publish package on npm |
These are things I'd like to add, but probably won't touch any time soon.
Progess | Feature |
---|---|
0% | Greenkeeper (or similar) integration |