1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.updateCypressConfig = void 0;
|
4 | const path = require("path");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | function updateCypressConfig(tree, schema, project) {
|
13 | const cypressJsonPath = path.join(schema.relativeToRootDestination, 'cypress.json');
|
14 | if (tree.exists(cypressJsonPath)) {
|
15 | const cypressJson = JSON.parse(tree.read(cypressJsonPath).toString('utf-8'));
|
16 | cypressJson.videosFolder = cypressJson.videosFolder.replace(project.root, schema.relativeToRootDestination);
|
17 | cypressJson.screenshotsFolder = cypressJson.screenshotsFolder.replace(project.root, schema.relativeToRootDestination);
|
18 | tree.write(cypressJsonPath, JSON.stringify(cypressJson));
|
19 | return tree;
|
20 | }
|
21 | const cypressConfigPath = path.join(schema.relativeToRootDestination, 'cypress.config.ts');
|
22 | if (tree.exists(cypressConfigPath)) {
|
23 | const oldContent = tree.read(cypressConfigPath, 'utf-8');
|
24 | const findName = new RegExp(`'${schema.projectName}'`, 'g');
|
25 | const findDir = new RegExp(project.root, 'g');
|
26 | const newContent = oldContent
|
27 | .replace(findName, `'${schema.newProjectName}'`)
|
28 | .replace(findDir, schema.relativeToRootDestination);
|
29 | tree.write(cypressConfigPath, newContent);
|
30 | }
|
31 | }
|
32 | exports.updateCypressConfig = updateCypressConfig;
|
33 |
|
\ | No newline at end of file |