forked from jupyterlab/jupyterlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-release.ts
executable file
·52 lines (40 loc) · 1.62 KB
/
patch-release.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
import * as fs from 'fs-extra';
import * as path from 'path';
import * as utils from './utils';
// Make sure we have required command line arguments.
if (process.argv.length < 3) {
let msg = '** Must supply a target package';
process.stderr.write(msg);
process.exit(1);
}
// Use npm here so this file can be used outside of JupyterLab.
utils.run('npm run build:packages');
// Extract the desired package target(s).
process.argv.slice(2).forEach(target => {
let packagePath = path.resolve(path.join('packages', target));
if (!fs.existsSync(packagePath)) {
console.log('Invalid package path', packagePath);
process.exit(1);
}
// Perform the patch operations.
console.log('Patching', target, '...');
utils.run('npm version patch', { cwd: packagePath });
utils.run('npm publish', { cwd: packagePath });
// Extract the new package info.
let data = utils.readJSONFile(path.join(packagePath, 'package.json'));
let name = data.name;
let version = data.version;
// Make the release commit
utils.run('git commit -a -m "Release ' + name + '@' + version + '"');
utils.run('git tag ' + name + '@' + version);
});
// Update the static folder.
utils.run('npm run build:update');
// Integrity update
utils.run('npm run integrity');
utils.run('git commit -a -m "Integrity update"');
console.log('\n\nFinished, make sure to push the commit(s) and tag(s).');