https://github.com/jfarleyx/bumpver-webpack-plugin
A webpack plugin to bump the major, minor, or patch number for a build
https://github.com/jfarleyx/bumpver-webpack-plugin
bump bumpversion semver version webpack webpack-plugin
Last synced: about 1 month ago
JSON representation
A webpack plugin to bump the major, minor, or patch number for a build
- Host: GitHub
- URL: https://github.com/jfarleyx/bumpver-webpack-plugin
- Owner: jfarleyx
- License: mit
- Created: 2018-08-05T02:06:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-05T15:52:23.000Z (almost 8 years ago)
- Last Synced: 2025-10-02T17:59:40.430Z (8 months ago)
- Topics: bump, bumpversion, semver, version, webpack, webpack-plugin
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bumpver-webpack-plugin
A webpack plugin to bump the major, minor, or patch number for a build.
## Install
```
npm install bumpver-webpack-plugin --save-dev
```
or
```
yarn add bumpver-webpack-plugin --dev
```
## Usage
Increments patch number by default, but you can specify either major, minor, or patch.
Arguments:
* files (required): one or more file names containing "version" to increment
* level (optional): semver level - 'major', 'minor', or 'patch'
To use default settings and increment patch for every build...
``` javascript
const BumpVerPlugin = require('bumpver-webpack-plugin');
module.exports = {
plugins: [
new BumpVerPlugin({
files: ['package.json']
})
]
}
```
To specify semver level ("major", "minor", or "patch") for every build...
``` javascript
const BumpVerPlugin = require('bumpver-webpack-plugin');
module.exports = {
plugins: [
new BumpVerPlugin({
files: ['package.json'],
level: 'patch'
})
]
}
```
To pass a semver level to your webpack config, set variable via *env* parameter like this...
``` javascript
const BumpVerPlugin = require('bumpver-webpack-plugin');
module.exports = (env) => {
return {
plugins: [
new BumpVerPlugin({
files: ['package.json', 'manifest.json'],
level: env.VERSION_LEVEL
})
]
}
}
```
Then, in your call to webpack add a variable to *env* containing the semver level to increment...
``` javascript
"scripts": {
"build-major": "webpack --env.VERSION_LEVEL=major",
"build-minor": "webpack --env.VERSION_LEVEL=minor",
"build": "webpack"
}
```
As per the [semver spec](https://semver.org/), when you increment minor the patch value will be reset to 0. When you increment major both the minor and patch will be reset to 0.
Plugin based on original *bump-webpack-plugin* by johnagan. Expanded functionality to include semver level.