UNPKG

796 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.updatePackageJson = void 0;
4const devkit_1 = require("@nrwl/devkit");
5const path = require("path");
6/**
7 * Updates the name in the package.json if it exists.
8 *
9 * @param schema The options provided to the schematic
10 */
11function updatePackageJson(tree, schema) {
12 const packageJsonPath = path.join(schema.relativeToRootDestination, 'package.json');
13 if (!tree.exists(packageJsonPath)) {
14 // nothing to do
15 return;
16 }
17 const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
18 packageJson.name = schema.importPath;
19 tree.write(packageJsonPath, JSON.stringify(packageJson));
20}
21exports.updatePackageJson = updatePackageJson;
22//# sourceMappingURL=update-package-json.js.map
\No newline at end of file