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 inquirer = __importStar(require("inquirer"));
|
16 | const path = __importStar(require("path"));
|
17 | const utils = __importStar(require("./utils"));
|
18 | let questions = [
|
19 | {
|
20 | type: 'input',
|
21 | name: 'name',
|
22 | message: 'name: '
|
23 | },
|
24 | {
|
25 | type: 'input',
|
26 | name: 'description',
|
27 | message: 'description: '
|
28 | }
|
29 | ];
|
30 | void inquirer.prompt(questions).then(answers => {
|
31 | let { name, description } = answers;
|
32 | let dest = path.resolve(path.join('.', 'packages', name));
|
33 | if (fs.existsSync(dest)) {
|
34 | console.error('Package already exists: ', name);
|
35 | process.exit(1);
|
36 | }
|
37 | fs.copySync(path.resolve(path.join(__dirname, '..', 'template')), dest);
|
38 | let jsonPath = path.join(dest, 'package.json');
|
39 | let data = utils.readJSONFile(jsonPath);
|
40 | if (name.indexOf('@jupyterlab/') === -1) {
|
41 | name = '@jupyterlab/' + name;
|
42 | }
|
43 | data.name = name;
|
44 | data.description = description;
|
45 | utils.writePackageData(jsonPath, data);
|
46 |
|
47 | utils.run('npm run integrity');
|
48 | });
|
49 |
|
\ | No newline at end of file |