You can create a versionscript that will be called after the extension of the package version, but before the commit and tag.
"scripts": {
"version": "./your_script"
}
Check the execution order as per the npm version documentation . Below you can see an interesting excerpt, in particular paragraph 4:
- Make sure the git working directory is clean before we get started. Your scripts can add files to the commit in future steps. This step is skipped if the -force flag is set.
- script. package.json. . , , git add.
- Bump .json (, , ..).
- script. package.json( , ). , commit git add.
- Commit tag.
- postversion script. / .
npm v2.13.0. . : commit .