( tree: Tree, project: WizardProject, )
| 133 | } |
| 134 | |
| 135 | async function addNxTarget( |
| 136 | tree: Tree, |
| 137 | project: WizardProject, |
| 138 | ): Promise<boolean> { |
| 139 | const filePath = toUnixPath(path.join(project.relativeDir, 'project.json')); |
| 140 | const raw = await tree.read(filePath); |
| 141 | if (raw == null) { |
| 142 | return false; |
| 143 | } |
| 144 | const config = JSON.parse(raw); |
| 145 | if (config.targets?.[TASK_NAME] != null) { |
| 146 | return true; |
| 147 | } |
| 148 | const updated = { |
| 149 | ...config, |
| 150 | targets: { |
| 151 | ...config.targets, |
| 152 | [TASK_NAME]: { |
| 153 | executor: 'nx:run-commands', |
| 154 | options: { command: 'npx code-pushup' }, |
| 155 | }, |
| 156 | }, |
| 157 | }; |
| 158 | await tree.write(filePath, `${JSON.stringify(updated, null, 2)}\n`); |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | async function addPackageJsonScript( |
| 163 | tree: Tree, |
no test coverage detected