Parses npm to discover its lifecycle stages

npm, lifecycle, npm-lifecycle, run-script, package.json, npm-scripts, npm_lifecycle_event
npm install @wizardsoftheweb/npm-lifecycle-stages@5.4.2



Build Status Coverage Status

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



NpmLifecycleStages: string[]

This is an array of all lifecycle stages, e.g.

NpmLifecycleStages.indexOf("poststart") > -1;

ENpmLifecycleStages: enum

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.

Main Features

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

Eventual features

These are things I'd like to add, but probably won't touch any time soon.

Progess Feature
0% Greenkeeper (or similar) integration