npm version
碰撞一个包版本
概要
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
'npm [-v | --version]' to print npm version
'npm view <pkg> version' to view a package's published version
'npm ls' to inspect current package/dependency versions
配置
allow-same-version
- 默认值:false
- 类型:布尔值
防止在使用 npm version
将新版本设置为与当前版本相同的值时引发错误。
commit-hooks
- 默认值:true
- 类型:布尔值
使用 npm version
命令时运行 git commit hooks。
git-tag-version
- cpHcqTIrxEt4f28KOhZfPkO0zLmYjUTFDL8JP5iAFTumKS0+8TtVbaOqA6c8BSfqpTTv+J/OldznbRcggUCKYg==
XDyK3jYedNpkvKpYcms3NZ8S5NV55HexjPYcRT/F1KnnqvOPaSPKhYkf6I4Da9S/p8bvE7EU4RtkdIGdWwTWTw==
json
- cpHcqTIrxEt4f28KOhZfPtN+1DnZvVBVAKYGUmWOIwWGrGLru+wlVoKtqRRY32EZnPsvqMSi6MrpxrMwdvnc+A==
tuWzaBh7Hg0RJSmQRjRdDCwXTeQobgtuYpCLLuAWUpV8N0aZPquIzn8VhL3gVbm5U6rhW7dxvCNiDD2tf/ZQWg==
- 0p92ezPAdiik9IRo9I3R1nhwzGveq5GxraVl9fxxy4syFQ/6WqG8+6XxL5j4LCYquhzAOuxdSD1j/dB354BH7JUaGCgZLa7Cnea1xLIaV9Y6h7TLAYANuRCKrHY7b88ObLI+0aFZER/Q9D+FAoY/UuPtiQiqwd1VXUJO6bf0bmfv2uToPcfsbsEggsfkUmBuwHpo8wwJJQ/zwPwghcaStg==
hOnA0CJW/AdzA3UjIYZtvWh880f0PSSG5s/dNWkGKuHLEzJNwqn9/CgFnT6ud15M
preid
- cpHcqTIrxEt4f28KOhZfPr52YtEiV0O+8xv4d99RftJ+ow3n5g/6Jze+RBFInBUhuBdoOjtynsUqlh1AQahHCg==
3f7+VE6OqXanWFqmmXF9q86puQ7y1rlz6kTXk7CqP3LaYx2YExJMz2j6U4CNY3o+nW2u37KYZ4XU8VfwS1oEP0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MSYrmGzQxmq59wV7Hlw+T75wPk2f7VIGmILYOCvQvkkns6n8r1ePto88xb7wiSmHIZ7ZhNljj0PORjdWjlRO1cCxpZAexglkTvghoyMe/TyyBK7+D9QO0VKv+9fEM5G8YVQGmgoMerl7oAnOEV40xRrIsyFbkg61cR75+aF9/pWoFDCKeK53Iqk5WkohHytJpNvow==
npm version patch -m "Upgrade to %s for reasons"
pdceTXAtzkwm0P1NtexRIP0zsrRQqD8iSbfC9pDsnxHpHu4HZNDQDZ3sdjFy/wUb/tQLTouHxxLS49PpVE9hksmdLcfu0rZfHN23fMYE0JFzlUgohQgNNNq7rrZDfWqf+m1u94+PK9ShsGRIGDIw3ChyBx+nYPamemynNtEkZ13HjM9RTXRuKZ2RWq1CzZt/S3qAwDVhtqES9Kw2ll8QML45aP6w9/+Q1qVllJnUSiOJsSxJGNcCQg1m4o3aHSjT0MTfkvS91Oy7vn7EfQdS8CG9ZjFaCqPCYF7jBF4N/B0=
$ npm config set sign-git-tag true
$ npm version patch
You need a passphrase to unlock the secret key for
user: "isaacs (http://blog.izs.me/) <i@izs.me>"
2048-bit RSA key, ID 6C481CF6, created 2010-08-31
Enter passphrase:
E8TVaYxnJNEwsxstGB1zeRVfDVuDqTuub75DZY6c54DqpgQtvTVaN6j/RRgB0dJwfZ5i/3/vR2UHqpPZopkbQ7qPedlLifRtJIdNZqH7wMUaYmgwVGnCOZ5cw55hKoTg3svgojyT29qU1NjQSNFSQ2lyPnRfGeW3GhbJffYERvTAEOqMiVpMMNrdpAkgvmp8AnF/NCJhaWvokCMKFWC5yRTyH0+QOtybfaA1DNc164H+uTJYx3cagt5p10ZSGLvyhuZWjPZYp806Y2FAgvkUhw==
c1TivZupGwEmld5qzsGaTsBZ3fd79OC07hq4cP3y/HY=
- 在我们开始之前检查以确保 git 工作目录是干净的。您的脚本可能会在以后的步骤中将文件添加到提交中。如果设置了
--force
标志,则跳过此步骤。 - 运行
preversion
脚本。这些脚本可以访问 package.json 中的旧version
。一个典型的用途是在部署之前运行您的完整测试套件。您要添加到提交中的任何文件都应使用git add
显式添加。 - 根据要求(
patch
、minor
、major
等)在package.json
中撞击version
。 - 运行
version
脚本。这些脚本可以访问 package.json 中的新version
(例如,它们可以将其合并到生成文件的文件头中)。同样,脚本应该使用git add
显式地将生成的文件添加到提交中。 - 提交并标记。
- 运行
postversion
脚本。使用它来清理文件系统或自动推送提交和/或标签。
LzACe7UbHneO32rksz2C8g==
{
"scripts": {
"preversion": "npm test",
"version": "npm run build && git add -A dist",
"postversion": "git push && git push --tags && rm -rf build/temp"
}
}
419ONIsBs+7U2dL28bnRwV+IO1bigBfy+ZYC/Te/sUhLJFk/T+upu1LOfiUZsAG7Du8AQyzPBStfKZZjG/wdpia3cO3Y3xd7M8GjgOnLUb/J8QnBggv8a+BoqmYfRQi/dYFcNlckOVuVYzbVfUvZB4IKdYIJrKzUDJr3uajhMEfdtV/V/R3LrYbed4kEPTMYkh2+Uz2U9y56MJeq4rdVYlOwjSSOYZAE9mOb0al61eCyo/pmm5R2CiL6zSQORXMsFS4+H8qLYYk80QR4+fXgfti1X7Y1RU4WRHbCAfl4DfkkFxvy3BgtgMIhmhtG+xg2gcJsazGm0yS1zn4eynwfwtnLXd8txRbXqVVL+gy0/B5EGmFK+gLqzQ+TYJp6Db3H