Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Version read/write plugin for release-it

License

NotificationsYou must be signed in to change notification settings

release-it/bumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 thein option toread the version from this file in the release-it process.
  • Use only theout option towrite the version that was determined by release-it to this file.
  • Use both to readand write theversion 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 theoutfile(s), or use--npm.allowSameVersion.

The supported file types are:

TypeExtension(s)Mime-type
JSON.jsonapplication/json
YAML.yaml or.ymltext/yaml orapplication-x-yaml orapplication/yaml
TOML.tomltext/toml orapplication/toml
INI.initext/x-properties
XML.xmltext/xml orapplication/xml
HTML.htmltext/html orapplication/xhtml+xml
TEXT.txttext/*

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"    }  }}

⚠️ the operation is a search-and-replace; if the current version is not found in the file, the new versioncannot be written out.

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 thexml 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.

Command-line

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 withno-.
  • 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

Stars

Watchers

Forks

Packages

No packages published

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp