@@ -5,23 +5,6 @@ Release tool for npm and bower packages.
5
5
[ ![ Build Status] ( https://travis-ci.org/AlexKVal/release-script.svg )] ( https://travis-ci.org/AlexKVal/release-script )
6
6
7
7
---
8
- ##### Human factor
9
-
10
- ** Because of human nature to make mistakes, by default this script runs in ` dry mode ` .
11
- It prevents ` danger ` steps (` git push ` , ` npm publish ` etc) from accidental running.**
12
-
13
- ** For actual running your command please add ` --run ` option.**
14
-
15
- * If you don't want this behavior you can add ` "defaultDryRun": "false" ` into your ` package.json ` .*
16
- ``` json
17
- "release-script" : {
18
- "defaultDryRun" : " false"
19
- }
20
- ```
21
- * Then you can use ` --dry-run ` option for checks.*
22
-
23
- ---
24
-
25
8
#### Description
26
9
27
10
With this tool there is no need to keep (transpiled) ` lib ` , ` build `
@@ -59,13 +42,10 @@ that have been written by [Matt Smith @mtscout6](https://github.com/mtscout6)_
59
42
60
43
_ Kind of "migration manual"_ https://github.com/AlexKVal/release-script/issues/23
61
44
62
- #### Documents pages publishing
63
-
64
- If your project compiles static documentation pages (as e.g. ` React-Boostrap ` does)
65
- and needs to publish them to standalone repo / hosting (via ` git push ` ),
66
- you can do it the same way the ` bower ` package releasing done.
45
+ #### Documentation pages publishing
67
46
68
- Just create additional github repo for your static documents site.
47
+ If your project generates static documentation pages (as ` React-Boostrap ` does)
48
+ and needs publishing them to a standalone repo (via ` git push ` ), just create additional github repo for the documentation pages.
69
49
70
50
E.g. [ react-bootstrap.github.io.git] ( https://github.com/react-bootstrap/react-bootstrap.github.io )
71
51
@@ -75,9 +55,9 @@ Add it as `'release-script'.docsRepo` into your `package.json`:
75
55
"docsRepo" :
" [email protected] :<author>/original-project-name-github.io.git"
76
56
}
77
57
```
78
- Default folders for documents are:
79
- - ` "docsRoot": "docs-built" ` folder where the documents files will be built (by your custom building scripts )
80
- - ` "tmpDocsRepo": "tmp-docs-repo" ` temporary folder.
58
+ Default folders for documentation pages are:
59
+ - ` "docsRoot": "docs-built" ` folder where the files will be built to. (by your custom building script )
60
+ - ` "tmpDocsRepo": "tmp-docs-repo" ` temporary folder. (for the release-script usage)
81
61
82
62
It is advised to add them both into ` .gitignore ` .
83
63
@@ -90,33 +70,33 @@ You can customize them as you need:
90
70
}
91
71
```
92
72
93
- If you need to publish only documents (say with some minor fixes),
94
- this is as simple as :
73
+ If you need to publish only documentation pages (say with some minor fixes),
74
+ you can do it this way :
95
75
```
96
- > release --only-docs --run
76
+ > release --only-docs
97
77
```
98
78
In this case the ` package.json ` version will be bumped with ` --preid docs ` as ` 0.10.0 ` => ` 0.10.0-docs.0 ` .
99
79
100
80
If ` npm run docs-build ` script is present, then it will be used instead of ` npm run build ` script.
101
81
102
- * Note: Documents are not published with pre-release version,
82
+ * Note: Documentation pages are not published when you are releasing " pre-release" version,
103
83
(i.e. when you run it with ` --preid ` option).*
104
84
105
85
#### Pre-release versions publishing
106
86
107
87
Say you need to publish pre-release ` v0.25.100-pre.0 ` version
108
88
with the ` canary ` npm tag name (instead of default one ` latest ` ).
109
89
110
- You can do it by this way:
90
+ You can do it this way:
111
91
```
112
- > release 0.25.100 --preid pre --tag canary --run
92
+ > release 0.25.100 --preid pre --tag canary
113
93
or
114
- > npm run release 0.25.100 -- --preid pre --tag canary --run
94
+ > npm run release 0.25.100 -- --preid pre --tag canary
115
95
```
116
96
117
- If your ` preid ` tag and npm tag name are the same, then you can just:
97
+ If your ` preid ` tag and npm tag are the same, then you can just:
118
98
```
119
- > release 0.25.100 --preid beta --run
99
+ > release 0.25.100 --preid beta
120
100
```
121
101
It will produce ` v0.25.100-beta.0 ` and ` npm publish --tag beta ` .
122
102
@@ -125,8 +105,8 @@ and with the next release this file will be removed.
125
105
126
106
#### Alternative npm package root folder
127
107
128
- Say you want to publish to ` npmjs ` only the content of your ` lib ` folder.
129
- Then you can do it as simple as adding this option to your ` package.json `
108
+ Say you want to publish the content of your ` lib ` folder as an npm package's root folder.
109
+ Then you can do it as simple as adding the following to your ` package.json `
130
110
``` json
131
111
"release-script" : {
132
112
"altPkgRootFolder" : " lib"
@@ -142,7 +122,7 @@ If you run building scripts within your `npm run test` step, e.g.
142
122
"test" : " npm run lint && npm run build && npm run tests-set" ,
143
123
}
144
124
```
145
- then you can disable superfluous ` npm run build ` step running
125
+ then you can prevent ` npm run build ` step from running
146
126
by setting ` 'release-script'.skipBuildStep ` option:
147
127
``` json
148
128
"release-script" : {
@@ -159,13 +139,11 @@ All options for this package are kept under `'release-script'` node in your proj
159
139
- ` default ` value: ` 'amd' `
160
140
- ` tmpBowerRepo ` - the folder name for temporary files for bower pkg.
161
141
- ` default ` value: ` 'tmp-bower-repo' `
162
- - ` altPkgRootFolder ` - the folder name for alternative npm package root folder
142
+ - ` altPkgRootFolder ` - the folder name for alternative npm package's root folder
163
143
164
144
It is advised to add ` bowerRoot ` and ` tmpBowerRepo ` folders to your ` .gitignore ` file.
165
145
166
- All options are optional.
167
-
168
- E.g.:
146
+ Example:
169
147
``` json
170
148
"release-script" : {
171
149
"bowerRepo" :
" [email protected] :<org-author-name>/<name-of-project>-bower.git" ,
@@ -177,113 +155,107 @@ E.g.:
177
155
178
156
#### GitHub releases
179
157
180
- If you want this script to publish github releases,
181
- you can generate token https://github.com/settings/tokens for it
182
- and set ` env.GITHUB_TOKEN ` to it like this:
158
+ If you need this script to publish github releases,
159
+ you can generate a github token at https://github.com/settings/tokens
160
+ and put it to ` env.GITHUB_TOKEN ` this way :
183
161
``` sh
184
162
> GITHUB_TOKEN=" xxxxxxxxxxxx" && release-script patch
185
163
```
186
- or through your shell scripts
164
+ or into your shell scripts
187
165
``` sh
188
166
export GITHUB_TOKEN=" xxxxxxxxxxxx"
189
167
```
190
- You can set a custom message for release via ` --notes ` CLI option:
168
+ You can set a custom message for github release via ` --notes ` CLI option:
191
169
```
192
- > release patch --notes "This is small fix" --run
170
+ > release patch --notes "This is a small fix"
193
171
```
194
172
195
173
196
- #### This script does following steps:
174
+ #### This script does the following steps:
197
175
198
176
- ensures that git repo has no pending changes
199
- - ensures that git repo last version is fetched
177
+ - ensures that the latest version is fetched
200
178
- checks linting and tests by running ` npm run test ` command
201
- - does version bump, with ` preid ` if it is requested
179
+ - does version bumping
202
180
- builds all by running ` npm run build ` command
203
181
- If there is no ` build ` script, then ` release-script ` just skips the ` build ` step.
204
- - if one of ` [rf|mt]-changelog ` is used in 'devDependencies', then changelog is generated
205
- - adds and commits changed ` package.json ` ( and ` CHANGELOG.md ` , if used) files to git repo
206
- - adds git tag with new version ( and changelog message, if used)
182
+ - if one of ` [rf|mt]-changelog ` is used in 'devDependencies', then changelog is to be generated
183
+ - adds and commits ` package.json ` with changed version and ` CHANGELOG.md ` if it's used
184
+ - adds git tag with new version and changelog message if it's used
207
185
- pushes changes to github repo
208
- - if github token is present, publishes release to GitHub, named as ` <repo> vx.x.x `
209
- - if ` --preid ` tag set, then ` npm publish --tag ` command for npm publishing is used
210
- - through ` --tag ` one can set ` npm tag name ` for the pre-release version (e.g. ` alpha ` or ` canary ` )
211
- - othewise ` --preid ` value will be used
212
- - if ` altPkgRootFolder ` doesn't set it will just ` npm publish [--tag] ` as usual
213
- - otherwise if ` altPkgRootFolder ` set then this script
214
- - will ` npm publish [--tag] ` from the ` altPkgRootFolder ` folder
215
- - with the custom version of ` package.json ` with removed ` scripts ` and ` devDependencies `
216
- - also it will remove the ` altPkgRootFolder ` part from the ` main ` file path
217
- - if ` bowerRepo ` field is present in the ` package.json ` , then it releases bower package:
218
- - clones bower repo to local ` tmpBowerRepo ` temp folder. ` git clone bowerRepo tmpBowerRepo `
219
- - then it cleans up all but ` .git ` files in the ` tmpBowerRepo `
220
- - then copies all files from ` bowerRoot ` to ` tmpBowerRepo `
221
- - (that has to be generated with ` npm run build ` )
222
- - then by ` git add -A . ` adds all bower distr files to the temporary git repo
223
- - commits, tags and pushes the same as for the ` npm ` package.
224
- - then deletes the ` tmpBowerRepo ` folder
225
- - id ` docsRepo ` field is present in the ` package.json ` , then it pushes builded documents to their repo.
226
- It is done the same way as ` bower ` repo.
227
-
228
- If command line ` --only-docs ` option is set, then ` github ` , ` npm ` and ` bower ` publishing steps will be skipped.
186
+ - if github token is present the script publishes the release to the GitHub
187
+ - if ` --preid ` tag set then ` npm publish --tag ` command for npm publishing is used
188
+ - with ` --tag ` option one can set ` npm tag name ` for a pre-release version (e.g. ` alpha ` or ` canary ` )
189
+ - otherwise ` --preid ` value will be used
190
+ - if ` altPkgRootFolder ` isn't set it will just ` npm publish [--tag] ` as usual. Otherwise:
191
+ - the release-script will ` npm publish [--tag] ` from the inside ` altPkgRootFolder ` folder
192
+ - ` scripts ` and ` devDependencies ` will be removed from ` package.json `
193
+ - if ` bowerRepo ` field is present in the ` package.json ` then bower package will be released.
194
+ - the script will clone the bower repo to the ` tmpBowerRepo ` folder
195
+ - clean up all files but ` .git ` in the ` tmpBowerRepo ` folder
196
+ - copy all files from ` bowerRoot ` to ` tmpBowerRepo ` (they has to be generated by ` npm run build ` )
197
+ - add all files to the temporary git repo with ` git add -A . `
198
+ - then it will commit, tag and push. The same as for the ` npm ` package.
199
+ - and at the end it will remove the ` tmpBowerRepo ` folder
200
+ - if ` docsRepo ` option is set then documentation pages are being pushed to their repo.
201
+ It is done the same way as ` bower ` publishing process.
202
+
203
+ If ` --only-docs ` command line option is set then ` github ` , ` npm ` and ` bower ` publishing steps will be skipped.
229
204
230
205
## Installation
231
206
232
207
``` sh
233
208
> npm install -D release-script
234
209
```
235
210
236
- If you need ` bower ` releases too, then add ` 'release-script'.bowerRepo ` into your ` package.json ` like this :
211
+ If you need ` bower ` releases too then add ` 'release-script'.bowerRepo ` into your ` package.json ` :
237
212
``` json
238
213
"release-script" : {
239
214
"bowerRepo" :
" [email protected] :<org-author-name>/<name-of-project>-bower.git"
240
215
}
241
216
```
242
217
243
- Then you can release like that:
244
- ``` sh
245
- > release patch --run
246
- > release minor --preid alpha --run
247
- ```
248
-
249
- If you don't have smth like that in your shell:
218
+ If you have smth like that in your shell:
250
219
``` sh
251
220
# npm
252
221
export PATH=" ./node_modules/.bin:$PATH "
253
222
```
254
- then you have to type the commands like this:
223
+ or you had installed ` release-script ` globally via ` npm install -g release-script ` ,
224
+ then you can release your new versions this way:
255
225
``` sh
256
- > ./node_modules/.bin/release minor --preid alpha --run
226
+ > release patch
227
+ or
228
+ > release minor --preid alpha
257
229
```
258
230
259
- Or you just can install ` release-script ` globally.
231
+ Otherwise you need to type in the commands this way:
232
+ ``` sh
233
+ > ./node_modules/.bin/release minor --preid alpha
234
+ ```
260
235
261
- You also can add some helpful ` script ` commands to your ` package.json ` ,
262
- and because ` npm ` adds ` node_modules/.bin ` into ` PATH ` for running scripts automatically,
263
- you can add them just like that:
236
+ You can as well add some helpful ` script ` commands to your ` package.json ` :
264
237
``` json
265
238
"scripts" : {
266
239
...
267
- "patch" : " release patch --run" ,
268
- "minor" : " release minor --run" ,
269
- "major" : " release major --run" ,
270
- "release-dry-run" : " release patch"
240
+ "patch" : " release patch" ,
241
+ "minor" : " release minor" ,
242
+ "major" : " release major"
271
243
```
272
244
273
- Also you can add it like this:
245
+ And you can add it like this:
274
246
```json
275
247
"scripts" : {
276
248
...
277
249
"release" : " release" ,
278
250
```
279
- And then you can run it like that:
251
+ This way it became possible to run it like that:
280
252
```
281
- > npm run release minor -- --preid alpha --run
282
- > npm run release patch -- --notes "This is small fix --run "
283
- > npm run release major // for dry run
253
+ > npm run release minor -- --preid alpha
254
+ > npm run release patch -- --notes "This is small fix"
255
+ > npm run release major --dry-run // for dry run
284
256
etc
285
257
```
286
- _Notice: you have to add additional `--` before any `--option`. That way additional options will get straight to `release-script`._
258
+ _Notice: You have to add additional double slash `--` before any `--option`. This way additional options get through to `release-script`._
287
259
288
260
289
261
## License
0 commit comments