UNPKG

804 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.updateReadme = void 0;
4const path_1 = require("path");
5/**
6 * Update the README.md file of the project if it exists.
7 *
8 * @param schema The options provided to the schematic
9 */
10function updateReadme(tree, schema) {
11 const readmePath = (0, path_1.join)(schema.relativeToRootDestination, 'README.md');
12 if (!tree.exists(readmePath)) {
13 // no README found. nothing to do
14 return;
15 }
16 const findName = new RegExp(`${schema.projectName}`, 'g');
17 const oldContent = tree.read(readmePath, 'utf-8');
18 const newContent = oldContent.replace(findName, schema.newProjectName);
19 tree.write(readmePath, newContent);
20}
21exports.updateReadme = updateReadme;
22//# sourceMappingURL=update-readme.js.map
\No newline at end of file