Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
relix
Advanced tools
Readme
一个全自动 NPM 包发布工具.
Relix 根据 (SemVer规范) 自动生成新版本号, 然后帮你自动生成commit message,打tag,推到GitHub,发布到 NPM !
当我们发布一个新的包到 NPM 的时候,我们需要做以下的工作:
package.json
中的版本号.git add
更改并且 git commit
生成一个新提交。通常我们需要有一个像 bump version 1.1.1
这样的commit message。git push
推送本地提交到远程Github.npm publish
把新版本的包推送到NPM.额... 好烦人有木有! 而且整个过程中的所有信息(新版本号的确认,commit message,tag)都需要自己手动填写,容易出错不说,还很麻烦!
所以,这就是 Relix 出现的原因!
根据 SemVer规范自动生成新版本号.
你不用浪费时间去手动确认版本号,Relix会根据你想要的发布类型自动确认版本号,MAJOR.MINOR.PATCH.BETA, 全自动化!
根据 新版本的类型 自动生成Commit message.
比如, 当你使用 relix --patch
, 会生成这样一个提交信息 Bump version x.x.x
.
当你使用 relix --prerelease alpha
, 会生成这样一个提交信息 Prerelease alpha version x.x.x-alpha.0
.
听起来不错对不对!
推送提交到远程Github,并且根据新版本号打个tag,然后把这个tag推送到远程Github。
最后,Relix会帮你把完全标准化的一个包发布到 NPM 上!
# 全局安装relix
npm i relix -g
# 或者本地安装relix
npm i relix -D
## 输出relix的使用方法
relix -h
以下是relix -h
的输出:
Usage: relix [options]
Version format: MAJOR.MINOR.PATCH (see: https://semver.org/)
Options:
-v, --version output the version number
--patch version when you make backwards-compatible bug fixes.
--minor version when you add functionality in a backwards-compatible manner
--major version when you make incompatible API changes
--prepatch [identifier] increments the patch version, then makes a prerelease (default: beta)
--preminor [identifier] increments the minor version, then makes a prerelease (default: beta)
--premajor [identifier] increments the major version, then makes a prerelease (default: beta)
--prerelease [identifier] increments version, then makes a prerelease (default: beta)
--accessPublic npm publish --access=public
-m, --remote [remote] remote and branch. format: `upstream/branch`
-h, --help output usage information
Tip:
You should run this script in the root directory of you project or run by npm scripts.
Examples:
$ relix --patch
$ relix --prepatch
$ relix --prepatch alpha
$ relix --major --accessPublic
$ relix --patch --remote upstream/branch
比如,你当前的版本是 1.1.1
以下命令的格式都是 relix [option]
。
option | 新生成的版本号 | 自动生成的提交信息 | 解释 |
---|---|---|---|
--patch | 1.1.2 | Bump version 1.1.2 | 如果你做了一些向后兼容的bugfix,那么你用这个命令。 |
--minor | 1.2.0 | Release minor version 1.2.0 | 如果你新增了一些功能,但是没有做api上的改动, 向后兼容,那么你用这个命令. |
--major | 2.0.0 | Release major version 2.0.0 | 如果你改api并且不向后兼容了,那么你用这个命令 |
--prepatch alpha | 1.1.2-alpha.0 | Prerelease alpha version 1.1.2-alpha.0 | 如果你做了一些向后兼容的bugfix, 然后想发布一个预发布版本,那么你用这个命令. |
--preminor rc | 1.2.0-rc.0 | Prerelease rc version 1.2.0-rc.0 | 如果你新增了一些功能,但是没有做api上的改动, 然后想发布一个预发布版本,那么你用这个命令. |
--premajor | 2.0.0-beta.0 | Prerelease beta version 2.0.0-beta.0 | 如果你改api并且不向后兼容, 然后想发布一个预发布版本,那么你用这个命令. |
--prerelease | 1.1.2-beta.0 | Prerelease beta version 1.1.2-beta.0 | 等同于 --prepatch . |
--patch --accessPublic | 1.1.2 | Bump version 1.1.2 | 如果你的 NPM 包是私有包,比如你的包名称叫@yourname/packageName ,那么在发布时候需要使用 npm publish --access=public 来发布,这个时候你需要使用 --accessPublic |
--patch --remote upstream/mybranch | 1.1.2 | Bump version 1.1.2 | 用于指定远程和分支 |
options
<Object>
patch
<boolean>
minor
<boolean>
major
<boolean>
prepatch
<boolean|string>
preminor
<boolean|string>
premajor
<boolean|string>
accessPublic
<boolean>
remote
<string>
const relix = require('relix');
relix({
path: true,
accessPublic: true,
remote: 'upstream/mybranch'
}).then(
() => console.log('Publish success...'),
() => process.exit(1)
);
MIT © PengJiyuan
FAQs
Auto bump version (use semver), push commit and tag, publish to npm.
The npm package relix receives a total of 161 weekly downloads. As such, relix popularity was classified as not popular.
We found that relix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.