- Notifications
You must be signed in to change notification settings - Fork19
Version read/write plugin for release-it
License
release-it/bumper
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This plugin reads and/or writes version/manifest files.
npm install --save-dev @release-it/bumper
Inrelease-it config:
"plugins": {"@release-it/bumper": {"in":"composer.json","out":"composer.json", }}
- Use only the
in
option toread the version from this file in the release-it process. - Use only the
out
option towrite the version that was determined by release-it to this file. - Use both to readand write the
version
property from/to this file.
Theversion
from thein
file will take precedence over the latest Git tag (and theversion
frompackage.json
ifit exists) in release-it to determine the latest version.
Note that usingpackage.json
asout
file may conflict with the npm plugin in release-it. Remove it from theout
file(s), or use--npm.allowSameVersion
.
The supported file types are:
Type | Extension(s) | Mime-type |
---|---|---|
JSON | .json | application/json |
YAML | .yaml or.yml | text/yaml orapplication-x-yaml orapplication/yaml |
TOML | .toml | text/toml orapplication/toml |
INI | .ini | text/x-properties |
XML | .xml | text/xml orapplication/xml |
HTML | .html | text/html orapplication/xhtml+xml |
TEXT | .txt | text/* |
Explicitly providing the (mime)type
takes precedence over the file extension.
The fallback type istext
if the file extension and/ortype
is not known (e.g.index.php
).
"plugins": {"@release-it/bumper": {"in": {"file":"VERSION","type":"text/plain" },"out": {"file":"VERSION","type":"text/plain" } }}
To replace all occurences of the current version with the new version in any text file:
"plugins": {"@release-it/bumper": {"out": {"file":"file.php","type":"text/php" } }}
To instead always consume the entire file, that is, the whole and only content of the file is the version number, setconsumeWholeFile: true
for theout
option:
"plugins": {"@release-it/bumper": {"out": {"file":"VERSION","type":"text/plain","consumeWholeFile":true } }}
The version number is then written to the output file, overwriting it completely instead of a search-and-replace.
💡 SettingconsumeWholeFile: true
precludes the use of prefixes, such asv1.0.1
in the output file.
Theout
option can also be an array of files:
"plugins": {"@release-it/bumper": {"out": ["manifest.json","bower.json"] }}
Theout
option is parsed withfast-glob, so glob patterns can be used to match files to write to:
"plugins": {"@release-it/bumper": {"out":"dist/*.json" }}
Thepath
option (default:"version"
) can be used to change a different property. The following example will set thecurrent.version
property to the new version inmanifest.json
:
"plugins": {"@release-it/bumper": {"out": {"file":"manifest.json","path":"current.version" } }}
For the
xml
type, thepath
option must be in the form of a uniquecss selector. The following example willset theproject > version
property to the new version inpom.xml
:
"plugins": {"@release-it/bumper": {"out": {"file":"pom.xml","path":"project > version","type":"application/xml" } }}
For thehtml
type, thepath
option must be in the form of a uniquecss selector. The following example will setthe element text content with the css attribute#version
to the new version infoo.html
:
"plugins": {"@release-it/bumper": {"out": {"file":"foo.html","path":"#version","type":"text/html" } }}
Multiple paths can be provided using an array.
TheversionPrefix
option (default:''
) can be used in cases where you'd like to maintain a specific prefix for yourversion number (for example, inpackage.json
where you might want versions like^1.0.0
). This will prepend thespecified prefix to the bumped version:
"plugins": {"@release-it/bumper": {"out": {"file":"package.json","path":"version","prefix":"^" } }}
With the above configuration, if release-it determines the new version to be1.0.0
, it'll be saved as^1.0.0
in thetargeted file.
Options for this plugin can be set from the command line. Some examples:
release-it --plugins.@release-it/bumper.in=composer.jsonrelease-it --plugins.@release-it/bumper.out=composer.json --plugins.@release-it/bumper.out=manifest.json
- Keys are separated by dots.
- Values can be negated by prefixing the key with
no-
. - Arguments may need to be single-quoted (
'
) such as--'deep.key=value'
or'--deep.key=value'
Depending on your shell or OS this may differ.
About
Version read/write plugin for release-it
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.