1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var __importStar = (this && this.__importStar) || function (mod) {
|
7 | if (mod && mod.__esModule) return mod;
|
8 | var result = {};
|
9 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
10 | result["default"] = mod;
|
11 | return result;
|
12 | };
|
13 | Object.defineProperty(exports, "__esModule", { value: true });
|
14 | const fs = __importStar(require("fs-extra"));
|
15 | const path = __importStar(require("path"));
|
16 | const utils = __importStar(require("./utils"));
|
17 |
|
18 | utils.run('jlpm integrity');
|
19 |
|
20 | const data = utils.readJSONFile('./dev_mode/package.json');
|
21 |
|
22 | data['jupyterlab']['buildDir'] = './build';
|
23 | data['jupyterlab']['outputDir'] = '..';
|
24 | data['jupyterlab']['staticDir'] = '../static';
|
25 | data['jupyterlab']['linkedPackages'] = {};
|
26 | const staging = './jupyterlab/staging';
|
27 |
|
28 | const keep = ['yarn.js', '.yarnrc'];
|
29 | fs.readdirSync(staging).forEach(name => {
|
30 | if (keep.indexOf(name) === -1) {
|
31 | fs.removeSync(path.join(staging, name));
|
32 | }
|
33 | });
|
34 | fs.ensureDirSync(staging);
|
35 | fs.ensureFileSync(path.join(staging, 'package.json'));
|
36 | utils.writePackageData(path.join(staging, 'package.json'), data);
|
37 |
|
38 | const notice = '// This file is auto-generated from the corresponding file in /dev_mode\n';
|
39 | [
|
40 | 'index.js',
|
41 | 'webpack.config.js',
|
42 | 'webpack.prod.config.js',
|
43 | 'webpack.prod.minimize.config.js',
|
44 | 'webpack.prod.release.config.js',
|
45 | 'templates'
|
46 | ].forEach(name => {
|
47 | const dest = path.join('.', 'jupyterlab', 'staging', name);
|
48 | fs.copySync(path.join('.', 'dev_mode', name), dest);
|
49 | if (path.extname(name) === '.js') {
|
50 | const oldContent = fs.readFileSync(dest);
|
51 | const newContent = notice + oldContent;
|
52 | fs.writeFileSync(dest, newContent);
|
53 | }
|
54 | });
|
55 |
|
56 | utils.run('jlpm', { cwd: staging });
|
57 | try {
|
58 | utils.run('jlpm yarn-deduplicate -s fewer --fail', { cwd: staging });
|
59 | }
|
60 | catch (_a) {
|
61 |
|
62 | utils.run('jlpm', { cwd: staging });
|
63 | }
|
64 |
|
65 | utils.run('jlpm run build:prod:release', { cwd: staging });
|
66 |
|
67 | utils.run('jlpm integrity');
|
68 |
|
\ | No newline at end of file |