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 | if (require.main === module) {
|
18 |
|
19 | if (process.argv.length !== 3) {
|
20 | const msg = '** Must supply a source package name\n';
|
21 | process.stderr.write(msg);
|
22 | process.exit(1);
|
23 | }
|
24 | let name = process.argv[2];
|
25 | const pkgPath = path.resolve(path.join('.', 'packages', name));
|
26 | if (!fs.existsSync(pkgPath)) {
|
27 | console.error('Package does not exist: ', name);
|
28 | process.exit(1);
|
29 | }
|
30 | const dest = path.resolve(`./tests/test-${name}`);
|
31 | if (fs.existsSync(dest)) {
|
32 | console.error('Test package already exists:', dest);
|
33 | process.exit(1);
|
34 | }
|
35 | fs.copySync(path.resolve(path.join(__dirname, '..', 'test-template')), dest);
|
36 | const jsonPath = path.join(dest, 'package.json');
|
37 | const data = utils.readJSONFile(jsonPath);
|
38 | if (name.indexOf('@jupyterlab/') === -1) {
|
39 | name = '@jupyterlab/test-' + name;
|
40 | }
|
41 | data.name = name;
|
42 | utils.writePackageData(jsonPath, data);
|
43 | fs.ensureDirSync(path.join(dest, 'src'));
|
44 | }
|
45 |
|
\ | No newline at end of file |