UNPKG

1.85 kBJavaScriptView Raw
1#!/usr/bin/env node
2"use strict";
3/*-----------------------------------------------------------------------------
4| Copyright (c) Jupyter Development Team.
5| Distributed under the terms of the Modified BSD License.
6|----------------------------------------------------------------------------*/
7var __importStar = (this && this.__importStar) || function (mod) {
8 if (mod && mod.__esModule) return mod;
9 var result = {};
10 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
11 result["default"] = mod;
12 return result;
13};
14Object.defineProperty(exports, "__esModule", { value: true });
15const path = __importStar(require("path"));
16const utils = __importStar(require("./utils"));
17// Make sure we have required command line arguments.
18if (process.argv.length !== 3) {
19 let msg = '** Must supply a library name\n';
20 process.stderr.write(msg);
21 process.exit(1);
22}
23let name = process.argv[2];
24// Handle the packages
25utils.getLernaPaths().forEach(pkgPath => {
26 handlePackage(pkgPath);
27});
28handlePackage(path.resolve('.'));
29/**
30 * Handle an individual package on the path - update the dependency.
31 */
32function handlePackage(packagePath) {
33 // Read in the package.json.
34 packagePath = path.join(packagePath, 'package.json');
35 let data;
36 try {
37 data = utils.readJSONFile(packagePath);
38 }
39 catch (e) {
40 console.log('Skipping package ' + packagePath);
41 return;
42 }
43 // Update dependencies as appropriate.
44 for (let dtype of ['dependencies', 'devDependencies']) {
45 let deps = data[dtype] || {};
46 delete deps[name];
47 }
48 // Write the file back to disk.
49 utils.writePackageData(packagePath, data);
50}
51// Update the core jupyterlab build dependencies.
52utils.run('jlpm run integrity');
53//# sourceMappingURL=remove-dependency.js.map
\No newline at end of file