You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,40 @@ As long as your git commit messages are conventional and accurate, you no longer
96
96
97
97
After you cut a release, you can push the new git tag and `npm publish` (or `npm publish --tag next`) when you're ready.
98
98
99
+
### Release as a pre-release
100
+
101
+
Use `--prerelease`, you can generate a pre-release.
102
+
103
+
Suppose the last version of your code is `1.0.0`, and your code to be committed has patched changes. Run
104
+
```bash
105
+
# npm run script
106
+
npm run release -- --prerelease
107
+
```
108
+
you will get version `1.0.1-0`.
109
+
110
+
If you want to name the pre-release, you specify the name via `--prerelease <name>`.
111
+
112
+
For example, the wanted name is `alpha`
113
+
. Use the example above:
114
+
```bash
115
+
# npm run script
116
+
npm run release -- --prerelease alpha
117
+
```
118
+
you will get version `1.0.1-alpha.0`
119
+
120
+
### Release as a target type imperatively like `npm version`
121
+
122
+
You can use `--release-as` to generate a `major`, `minor` or `patch` release imperatively.
123
+
124
+
Suppose the last version of your code is `1.0.0`, and your code to be committed has patched changes. Run
125
+
```bash
126
+
# npm run script
127
+
npm run release -- --release-as minor
128
+
```
129
+
you will get version `1.1.0` rather than the smartly generated version `1.0.1`.
130
+
131
+
**NOTE:** you can combine `--release-as` and `--prerelease` to generate a release. That's useful when publishing experimental feature(s).
132
+
99
133
### Prevent Git Hooks
100
134
101
135
If you use git hooks, like pre-commit, to test your code before committing, you can prevent hooks from being verified during the commit step by passing the `--no-verify` option:
* extract the in-pre-release type in target version
96
+
*
97
+
* @param version
98
+
* @return {string}
99
+
*/
100
+
functiongetCurrentActiveType(version){
101
+
vartypelist=TypeList
102
+
for(vari=0;i<typelist.length;i++){
103
+
if(semver[typelist[i]](version)){
104
+
returntypelist[i]
105
+
}
106
+
}
107
+
}
108
+
109
+
/**
110
+
* calculate the priority of release type,
111
+
* major - 2, minor - 1, patch - 0
112
+
*
113
+
* @param type
114
+
* @return {number}
115
+
*/
116
+
functiongetTypePriority(type){
117
+
returnTypeList.indexOf(type)
118
+
}
119
+
120
+
functionbumpVersion(releaseAs,callback){
121
+
if(releaseAs){
122
+
callback(null,{
123
+
releaseType: releaseAs
124
+
})
125
+
}else{
126
+
conventionalRecommendedBump({
127
+
preset: 'angular'
128
+
},function(err,release){
129
+
callback(err,release)
130
+
})
131
+
}
132
+
}
133
+
53
134
functionoutputChangelog(argv,cb){
54
135
createIfMissing(argv)
55
136
varheader='# Change Log\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n'
0 commit comments