UNPKG

1.82 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 });
14/**
15 * Remove an extension from the relevant metadata
16 * files of the JupyterLab source tree so that it
17 * is not included in the build. Intended for testing
18 * adding/removing extensions against development
19 * branches of JupyterLab.
20 */
21const fs = __importStar(require("fs-extra"));
22const path = __importStar(require("path"));
23const utils = __importStar(require("./utils"));
24// Make sure we have required command line arguments.
25if (process.argv.length < 3) {
26 const msg = '** Must supply a target extension name';
27 process.stderr.write(msg);
28 process.exit(1);
29}
30// Get the package name or path.
31const target = process.argv[2];
32const basePath = path.resolve('.');
33// Get the package.json of the extension.
34const packagePath = path.join(basePath, 'packages', target, 'package.json');
35if (!fs.existsSync(packagePath)) {
36 const msg = '** Absolute paths for packages are not allowed.';
37 process.stderr.write(msg);
38 process.exit(1);
39}
40// Remove the package from the local tree.
41fs.removeSync(path.dirname(packagePath));
42// Remove any dependencies on the package (will also run `jlpm integrity`)
43utils.run(`jlpm remove:dependency ${target}`);
44//# sourceMappingURL=remove-package.js.map
\No newline at end of file