lante lante - 9 months ago 28
Node.js Question

when running npm version, use that new version on preversion task

I am using

npm version [patch|minor|major]
to manage versions on my module.

But when running the task (
npm version
), I need the new version number to be used on a task (to print that version on the minified file, for example):

"preversion": "npm run grunt build --package-version={$something} && foo"

Is it possible to get the version number being generated to be used on the
npm preversion
If so, how?


The solution was to put the task on the version script on the package.json file, so when the task version runs, it has the new version number on the package.json.