|
6 | 6 | const strip = require('cli-color/strip'); |
7 | 7 | const fs = require('fs'); |
8 | 8 | const path = require('path'); |
9 | | - const prompt = require('prompt-sync'); |
| 9 | + const prompt = require('prompt-sync')({sigint: true}); |
10 | 10 | const child_process = require('child_process'); |
11 | 11 | const pkg = require('./package.json'); |
12 | 12 | let oldVersion = pkg.version; |
|
20 | 20 | let newVersion; |
21 | 21 |
|
22 | 22 | header(); |
23 | | - write(`Is this a dry-run? ${"[yes/no]".cyan} `); |
24 | | - const dryRun = prompt() !== 'no'; |
| 23 | + const dryRun = prompt(`Is this a dry-run? [${"yes".cyan}/no] `, 'yes') !== 'no'; |
25 | 24 |
|
26 | 25 | if (dryRun) { |
27 | | - write(`What would you like the old version to be? (default: ${oldVersion.cyan}) `); |
28 | | - oldVersion = prompt() || oldVersion; |
| 26 | + oldVersion = prompt(`What would you like the old version to be? (default: ${oldVersion.cyan}) `, oldVersion); |
29 | 27 | build(); |
30 | 28 | } else if (validate()) { |
31 | 29 | build(); |
|
120 | 118 | log('What should the next version be?'); |
121 | 119 | for (key in options) { log((+key + 1) + ') ' + options[ key ].cyan); } |
122 | 120 | log(''); |
123 | | - write('Please select a new version: '); |
124 | | - const type = prompt(); |
| 121 | + const type = prompt('Please select a new version: '); |
125 | 122 |
|
126 | 123 | if (options[ type - 1 ]) version = options[ type - 1 ]; |
127 | 124 | else if (type.match(/^\d+\.\d+\.\d+(-rc\.?\d+)?$/)) version = type; |
128 | 125 | else throw new Error('Your entry was invalid.'); |
129 | 126 |
|
130 | 127 | log(''); |
131 | 128 | log('The new version will be ' + version.cyan + '.'); |
132 | | - write(`Is this correct? ${"[yes/no]".cyan} `); |
133 | | - return prompt() === 'yes' ? version : getNewVersion(); |
| 129 | + return prompt(`Is this correct? [${"yes".cyan}/no] `, 'yes') === 'yes' ? version : getNewVersion(); |
134 | 130 |
|
135 | 131 | function getVersionOptions (version) { |
136 | 132 | return version.match(/-rc\.?\d+$/) |
137 | | - ? [increment(version, 'rc'), increment(version, 'minor')] |
138 | | - : [increment(version, 'patch'), addRC(increment(version, 'minor'))]; |
| 133 | + ? [increment(version, 'rc'), increment(version, 'minor')] |
| 134 | + : [increment(version, 'patch'), addRC(increment(version, 'minor'))]; |
139 | 135 |
|
140 | 136 | function increment (versionString, type) { |
141 | 137 | const version = parseVersion(versionString); |
|
181 | 177 | /** adds git tag for release and pushes to github */ |
182 | 178 | function tagRelease () { |
183 | 179 | pushCmds.push( |
184 | | - `git tag v${newVersion} -f`, |
185 | | - `git push ${origin} HEAD`, |
186 | | - `git push --tags ${origin}` |
| 180 | + `git tag v${newVersion} -f`, |
| 181 | + `git push ${origin} HEAD`, |
| 182 | + `git push --tags ${origin}` |
187 | 183 | ); |
188 | 184 | } |
189 | 185 |
|
|
229 | 225 | 'gulp build-all-modules --mode=default', |
230 | 226 | 'gulp build-all-modules --mode=closure', |
231 | 227 | 'rm -rf dist/demos' |
232 | | - ]); |
| 228 | + ]); |
233 | 229 | done(); |
234 | 230 | start('Copy files into bower repo...'); |
235 | 231 | // copy files over to bower repo |
236 | 232 | exec([ |
237 | | - 'cp -Rf ../dist/* ./', |
238 | | - 'git add -A', |
239 | | - `git commit -m "release: version ${newVersion}"`, |
240 | | - 'rm -rf ../dist' |
241 | | - ], options); |
| 233 | + 'cp -Rf ../dist/* ./', |
| 234 | + 'git add -A', |
| 235 | + `git commit -m "release: version ${newVersion}"`, |
| 236 | + 'rm -rf ../dist' |
| 237 | + ], options); |
242 | 238 | done(); |
243 | 239 | // add steps to push script |
244 | 240 | pushCmds.push( |
|
265 | 261 |
|
266 | 262 | // build files for bower |
267 | 263 | exec([ |
268 | | - 'rm -rf dist', |
269 | | - 'gulp docs' |
| 264 | + 'rm -rf dist', |
| 265 | + 'gulp docs' |
270 | 266 | ]); |
271 | 267 | replaceFilePaths(); |
272 | 268 |
|
273 | 269 | // copy files over to site repo |
274 | 270 | exec([ |
275 | | - `cp -Rf ../dist/docs ${newVersion}`, |
276 | | - 'rm -rf latest && cp -Rf ../dist/docs latest', |
277 | | - 'git add -A', |
278 | | - `git commit -m "release: version ${newVersion}"`, |
279 | | - 'rm -rf ../dist' |
| 271 | + `cp -Rf ../dist/docs ${newVersion}`, |
| 272 | + 'rm -rf latest && cp -Rf ../dist/docs latest', |
| 273 | + 'git add -A', |
| 274 | + `git commit -m "release: version ${newVersion}"`, |
| 275 | + 'rm -rf ../dist' |
280 | 276 | ], options); |
281 | 277 | replaceBaseHref(newVersion); |
282 | 278 | replaceBaseHref('latest'); |
|
288 | 284 |
|
289 | 285 | // add steps to push script |
290 | 286 | pushCmds.push( |
291 | | - comment('push the site'), |
292 | | - 'cd ' + options.cwd, |
293 | | - 'git pull --rebase --strategy=ours', |
294 | | - 'git push', |
295 | | - 'cd ..' |
| 287 | + comment('push the site'), |
| 288 | + 'cd ' + options.cwd, |
| 289 | + 'git pull --rebase --strategy=ours', |
| 290 | + 'git push', |
| 291 | + 'cd ..' |
296 | 292 | ); |
297 | 293 |
|
298 | 294 | function updateFirebaseJson () { |
|
353 | 349 | /** copies the changelog back over to master branch */ |
354 | 350 | function updateMaster () { |
355 | 351 | pushCmds.push( |
356 | | - comment('update package.json in master'), |
357 | | - 'git checkout master', |
358 | | - `git pull --rebase ${origin} master --strategy=theirs`, |
359 | | - `git checkout release/${newVersion} -- CHANGELOG.md`, |
360 | | - `node -e "const newVersion = '${newVersion}'; ${stringifyFunction(buildCommand)}"`, |
361 | | - 'git add CHANGELOG.md', |
362 | | - 'git add package.json', |
363 | | - `git commit -m "update version number in package.json to ${newVersion}"`, |
364 | | - `git push ${origin} master` |
| 352 | + comment('update package.json in master'), |
| 353 | + 'git checkout master', |
| 354 | + `git pull --rebase ${origin} master --strategy=theirs`, |
| 355 | + `git checkout release/${newVersion} -- CHANGELOG.md`, |
| 356 | + `node -e "const newVersion = '${newVersion}'; ${stringifyFunction(buildCommand)}"`, |
| 357 | + 'git add CHANGELOG.md', |
| 358 | + 'git add package.json', |
| 359 | + `git commit -m "update version number in package.json to ${newVersion}"`, |
| 360 | + `git push ${origin} master` |
365 | 361 | ); |
366 | 362 |
|
367 | 363 | function buildCommand () { |
|
0 commit comments