UNPKG

1.95 kBJavaScriptView Raw
1"use strict";
2/* -----------------------------------------------------------------------------
3| Copyright (c) Jupyter Development Team.
4| Distributed under the terms of the Modified BSD License.
5|----------------------------------------------------------------------------*/
6var __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};
13Object.defineProperty(exports, "__esModule", { value: true });
14const fs = __importStar(require("fs-extra"));
15const inquirer = __importStar(require("inquirer"));
16const path = __importStar(require("path"));
17const utils = __importStar(require("./utils"));
18const questions = [
19 {
20 type: 'input',
21 name: 'name',
22 message: 'name: '
23 },
24 {
25 type: 'input',
26 name: 'description',
27 message: 'description: '
28 }
29];
30void inquirer.prompt(questions).then(answers => {
31 let { name, description } = answers;
32 const 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 const jsonPath = path.join(dest, 'package.json');
39 const 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 // Add the launch file to git.
47 const launch = path.join(dest, '.vscode', 'launch.json');
48 utils.run(`git add -f ${launch}`);
49 // Use npm here so this file can be used outside of JupyterLab.
50 utils.run('npm run integrity');
51});
52//# sourceMappingURL=create-package.js.map
\No newline at end of file