forked from jupyterlab/jupyterlab
/
update-core-mode.ts
49 lines (41 loc) · 1.44 KB
/
update-core-mode.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
/*-----------------------------------------------------------------------------
| 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';
// Get the dev mode package.json file.
let data = utils.readJSONFile('./dev_mode/package.json');
// Update the values that need to change and write to staging.
data['jupyterlab']['buildDir'] = './build';
data['jupyterlab']['outputDir'] = '..';
data['jupyterlab']['staticDir'] = '../static';
data['jupyterlab']['linkedPackages'] = {};
let staging = './jupyterlab/staging';
utils.writePackageData(path.join(staging, 'package.json'), data);
// Update our staging files.
[
'index.js',
'webpack.config.js',
'webpack.prod.config.js',
'templates'
].forEach(name => {
fs.copySync(
path.join('.', 'dev_mode', name),
path.join('.', 'jupyterlab', 'staging', name)
);
});
// Create a new yarn.lock file to ensure it is correct.
fs.removeSync(path.join(staging, 'yarn.lock'));
utils.run('jlpm', { cwd: staging });
try {
utils.run('jlpm yarn-deduplicate -s fewer', { cwd: staging });
} catch {
// re-run install if we deduped packages!
utils.run('jlpm', { cwd: staging });
}
// Build the core assets.
utils.run('jlpm run build:prod', { cwd: staging });
// Run integrity
utils.run('jlpm integrity');