UNPKG

2.41 kBJavaScriptView Raw
1"use strict";
2/* -----------------------------------------------------------------------------
3| Copyright (c) Jupyter Development Team.
4| Distributed under the terms of the Modified BSD License.
5|----------------------------------------------------------------------------*/
6var __importDefault = (this && this.__importDefault) || function (mod) {
7 return (mod && mod.__esModule) ? mod : { "default": mod };
8};
9var __importStar = (this && this.__importStar) || function (mod) {
10 if (mod && mod.__esModule) return mod;
11 var result = {};
12 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
13 result["default"] = mod;
14 return result;
15};
16Object.defineProperty(exports, "__esModule", { value: true });
17const commander_1 = __importDefault(require("commander"));
18const utils = __importStar(require("./utils"));
19// Specify the program signature.
20commander_1.default
21 .description('Create a patch release')
22 .option('--force', 'Force the upgrade')
23 .action((options) => {
24 // Make sure we can patch release.
25 const pyVersion = utils.getPythonVersion();
26 if (pyVersion.includes('a') ||
27 pyVersion.includes('b') ||
28 pyVersion.includes('rc')) {
29 throw new Error('Can only make a patch release from a final version');
30 }
31 // Run pre-bump actions.
32 utils.prebump();
33 // Version the changed
34 let cmd = `lerna version patch -m \"New version\" --no-push`;
35 if (options.force) {
36 cmd += ' --yes';
37 }
38 const oldVersion = utils.run('git rev-parse HEAD', {
39 stdio: 'pipe',
40 encoding: 'utf8'
41 }, true);
42 utils.run(cmd);
43 const newVersion = utils.run('git rev-parse HEAD', {
44 stdio: 'pipe',
45 encoding: 'utf8'
46 }, true);
47 if (oldVersion === newVersion) {
48 console.debug('aborting');
49 // lerna didn't version anything, so we assume the user aborted
50 throw new Error('Lerna aborted');
51 }
52 // Patch the python version
53 utils.run('bumpversion patch'); // switches to alpha
54 utils.run('bumpversion release --allow-dirty'); // switches to beta
55 utils.run('bumpversion release --allow-dirty'); // switches to rc.
56 utils.run('bumpversion release --allow-dirty'); // switches to final.
57 // Run post-bump actions.
58 utils.postbump();
59});
60commander_1.default.parse(process.argv);
61//# sourceMappingURL=patch-release.js.map
\No newline at end of file