Reputation: 1745
Is there a way to update the version number of my react app package.json version variable via command line? Maybe with npm build or before/after npm build?
I have a build server that will run npm build and then deploy to production. I want to be able to update the version number of my application either during the build process or before it as part of the build pipeline. I am planning to just use the last git commit sha as the version number.
Is there a command that I am missing? I have had a look at npm version but I believe that is for just updating packages. I could be wrong.
Upvotes: 4
Views: 3581
Reputation: 353
npm version [major|minor|patch]
if you get "npm ERR! Git working directory not clean." you should
npm version [major|minor|patch] --no-git-tag-version
Upvotes: 0
Reputation: 372
You can use,
npm version [major|minor|patch]
to bump the version variable on package.json
using cli.
If you want to combine it with the build, you can use;
npm version [major|minor|patch] && react-scripts build
Upvotes: 0