@mouryaamit/nx-polystack 1.7.0 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/dist/bin/cli.js +11 -1
- package/dist/bin/cli.js.map +1 -1
- package/dist/generators.json +5 -0
- package/dist/src/cli/commands/adopt-compare.d.ts +14 -0
- package/dist/src/cli/commands/adopt-compare.js +165 -0
- package/dist/src/cli/commands/adopt-compare.js.map +1 -0
- package/dist/src/cli/commands/adopt.d.ts +6 -0
- package/dist/src/cli/commands/adopt.js +63 -0
- package/dist/src/cli/commands/adopt.js.map +1 -0
- package/dist/src/cli/commands/index.js +1 -0
- package/dist/src/cli/commands/index.js.map +1 -1
- package/dist/src/cli/commands/update.js +19 -0
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/cli/commands/upgrade.d.ts +11 -0
- package/dist/src/cli/commands/upgrade.js +257 -4
- package/dist/src/cli/commands/upgrade.js.map +1 -1
- package/dist/src/cli/help.js +30 -0
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/launcher.d.ts +12 -0
- package/dist/src/cli/launcher.js +41 -1
- package/dist/src/cli/launcher.js.map +1 -1
- package/dist/src/generators/adopt/generator.d.ts +42 -0
- package/dist/src/generators/adopt/generator.js +476 -0
- package/dist/src/generators/adopt/generator.js.map +1 -0
- package/dist/src/generators/adopt/old-scripts.d.ts +24 -0
- package/dist/src/generators/adopt/old-scripts.js +155 -0
- package/dist/src/generators/adopt/old-scripts.js.map +1 -0
- package/dist/src/generators/adopt/pipeline.d.ts +31 -0
- package/dist/src/generators/adopt/pipeline.js +133 -0
- package/dist/src/generators/adopt/pipeline.js.map +1 -0
- package/dist/src/generators/adopt/schema.json +26 -0
- package/dist/src/generators/migrate/adapters/nx-workspace.js +1 -47
- package/dist/src/generators/migrate/adapters/nx-workspace.js.map +1 -1
- package/dist/src/generators/migrate/nx/build-scripts.d.ts +8 -0
- package/dist/src/generators/migrate/nx/build-scripts.js +50 -1
- package/dist/src/generators/migrate/nx/build-scripts.js.map +1 -1
- package/dist/src/lib/adopt/compare.d.ts +14 -0
- package/dist/src/lib/adopt/compare.js +179 -0
- package/dist/src/lib/adopt/compare.js.map +1 -0
- package/dist/src/lib/upgrade/nx-migrate.d.ts +46 -0
- package/dist/src/lib/upgrade/nx-migrate.js +166 -0
- package/dist/src/lib/upgrade/nx-migrate.js.map +1 -0
- package/dist/src/lib/utils/devkit-pin.d.ts +15 -0
- package/dist/src/lib/utils/devkit-pin.js +61 -0
- package/dist/src/lib/utils/devkit-pin.js.map +1 -0
- package/dist/src/lib/utils/json-layout.d.ts +37 -0
- package/dist/src/lib/utils/json-layout.js +260 -0
- package/dist/src/lib/utils/json-layout.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
export interface AdoptGeneratorSchema {
|
|
3
|
+
/** Apps to adopt (default: every Angular app without a release target). */
|
|
4
|
+
projects?: string[];
|
|
5
|
+
/** Point the apps' build:<app>:<env> npm scripts at the release target (default true). */
|
|
6
|
+
scripts?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Delete the old build pipeline scripts nothing uses any more (after the apps are adopted;
|
|
9
|
+
* also on its own, in a workspace adopted earlier).
|
|
10
|
+
*/
|
|
11
|
+
removeOldScripts?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const ADOPT_REPORT = "docs/migrations/adopt.md";
|
|
14
|
+
export interface AdoptResult {
|
|
15
|
+
adopted: string[];
|
|
16
|
+
skipped: string[];
|
|
17
|
+
notes: string[];
|
|
18
|
+
scripts: Record<string, string>;
|
|
19
|
+
/** Old pipeline scripts deleted (removeOldScripts). */
|
|
20
|
+
removed: string[];
|
|
21
|
+
/** Scripts under tools/ nothing starts, outside the old pipeline (left in place). */
|
|
22
|
+
unreferenced: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Angular apps of the workspace that build without the plugin: build target, no release target. */
|
|
25
|
+
export declare function adoptCandidates(tree: Tree): {
|
|
26
|
+
name: string;
|
|
27
|
+
root: string;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}[];
|
|
30
|
+
/**
|
|
31
|
+
* Sets npm scripts in package.json without reformatting the rest of the file: existing scripts
|
|
32
|
+
* are changed in place, new ones go after the app's last build script (or at the end of scripts).
|
|
33
|
+
*/
|
|
34
|
+
export declare function setScriptsInPlace(tree: Tree, scripts: Record<string, string>): void;
|
|
35
|
+
/**
|
|
36
|
+
* pstack adopt: moves the Angular apps of this workspace that still build with their own scripts
|
|
37
|
+
* to the plugin's release target, in place. Each app gets a release target (base hrefs, env folder
|
|
38
|
+
* and the post-build steps read from the workspace's build script), its .htaccess becomes
|
|
39
|
+
* environments/<app>/htaccess.<env>, the workspace's env encryption is mirrored in nx.json, and its
|
|
40
|
+
* build:<app>:<env> npm scripts call nx run <app>:release:<env>. Old scripts are not deleted.
|
|
41
|
+
*/
|
|
42
|
+
export default function adoptGenerator(tree: Tree, options?: AdoptGeneratorSchema): Promise<AdoptResult>;
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setScriptsInPlace = exports.adoptCandidates = exports.ADOPT_REPORT = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const config_1 = require("../../lib/env-encryption/config");
|
|
6
|
+
const workspace_1 = require("../../lib/env-encryption/workspace");
|
|
7
|
+
const htaccess_adopt_1 = require("../../lib/release/htaccess-adopt");
|
|
8
|
+
const angular_project_1 = require("../../lib/utils/angular-project");
|
|
9
|
+
const devkit_pin_1 = require("../../lib/utils/devkit-pin");
|
|
10
|
+
const json_layout_1 = require("../../lib/utils/json-layout");
|
|
11
|
+
const project_json_files_1 = require("../../lib/utils/project-json-files");
|
|
12
|
+
const angular_project_json_1 = require("../migrate/angular-project-json");
|
|
13
|
+
const build_scripts_1 = require("../migrate/nx/build-scripts");
|
|
14
|
+
const env_encryption_1 = require("../migrate/nx/env-encryption");
|
|
15
|
+
const old_scripts_1 = require("./old-scripts");
|
|
16
|
+
const pipeline_1 = require("./pipeline");
|
|
17
|
+
const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
18
|
+
const code = (s) => `\`${s}\``;
|
|
19
|
+
/** Angular builders whose apps the release executor builds (it runs them through buildTarget). */
|
|
20
|
+
const ANGULAR_APP_BUILDERS = /^(@angular-devkit\/build-angular:(browser|browser-esbuild|application)|@angular\/build:application|@nx\/angular:(webpack-browser|browser-esbuild|application))$/;
|
|
21
|
+
exports.ADOPT_REPORT = 'docs/migrations/adopt.md';
|
|
22
|
+
/** Angular apps of the workspace that build without the plugin: build target, no release target. */
|
|
23
|
+
function adoptCandidates(tree) {
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const { name, root, json } of (0, project_json_files_1.readProjects)(tree)) {
|
|
26
|
+
const targets = isObject(json['targets']) ? json['targets'] : {};
|
|
27
|
+
const build = targets['build'];
|
|
28
|
+
if (!isObject(build) || !ANGULAR_APP_BUILDERS.test(String(build['executor'] ?? '')))
|
|
29
|
+
continue;
|
|
30
|
+
if (json['projectType'] === 'library')
|
|
31
|
+
continue;
|
|
32
|
+
if (Object.values(targets).some((t) => isObject(t) && t['executor'] === angular_project_1.POLYSTACK_BUILD_EXECUTOR))
|
|
33
|
+
continue;
|
|
34
|
+
out.push({
|
|
35
|
+
name,
|
|
36
|
+
root,
|
|
37
|
+
reason: targets['release'] !== undefined ? 'has its own "release" target' : undefined,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return out.sort((a, b) => a.name.localeCompare(b.name));
|
|
41
|
+
}
|
|
42
|
+
exports.adoptCandidates = adoptCandidates;
|
|
43
|
+
/** The build stamp time zone the workspace's own script used (e.g. Asia/Kolkata). */
|
|
44
|
+
function setStampTimezone(tree, timezone, notes) {
|
|
45
|
+
const cfg = (0, config_1.normalizeEnvEncryption)((0, workspace_1.readEnvEncryptionBlock)(tree));
|
|
46
|
+
(0, workspace_1.writeEnvEncryptionBlock)(tree, {
|
|
47
|
+
...cfg,
|
|
48
|
+
stamp: { ...config_1.DEFAULT_STAMP, ...(cfg.stamp ?? {}), timezone },
|
|
49
|
+
});
|
|
50
|
+
notes.push(`Env encryption: build stamp time zone ${code(timezone)}, as the build script wrote it.`);
|
|
51
|
+
}
|
|
52
|
+
/** Index of the brace that closes the one at `open` (strings skipped), or -1. */
|
|
53
|
+
function closingBrace(text, open) {
|
|
54
|
+
let depth = 0;
|
|
55
|
+
for (let i = open; i < text.length; i++) {
|
|
56
|
+
const c = text[i];
|
|
57
|
+
if (c === '"') {
|
|
58
|
+
for (i++; i < text.length && text[i] !== '"'; i++)
|
|
59
|
+
if (text[i] === '\\')
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
else if (c === '{' || c === '[')
|
|
63
|
+
depth++;
|
|
64
|
+
else if ((c === '}' || c === ']') && --depth === 0)
|
|
65
|
+
return i;
|
|
66
|
+
}
|
|
67
|
+
return -1;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Rewrites a project.json that adopt changed as a small edit of its original text (the .htaccess
|
|
71
|
+
* asset removed, the release target added at the end of targets) so the rest keeps its layout.
|
|
72
|
+
* Leaves the plain JSON write when the edit does not give the same JSON.
|
|
73
|
+
*/
|
|
74
|
+
function keepFormatting(tree, file, original) {
|
|
75
|
+
const wanted = tree.read(file, 'utf8') ?? '';
|
|
76
|
+
let target;
|
|
77
|
+
try {
|
|
78
|
+
target = JSON.parse(wanted);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let text = original
|
|
84
|
+
.replace(/,\s*\{[^{}]*"glob"\s*:\s*"\.htaccess"[^{}]*\}/g, '')
|
|
85
|
+
.replace(/\{[^{}]*"glob"\s*:\s*"\.htaccess"[^{}]*\}\s*,?\s*/g, '')
|
|
86
|
+
.replace(/,\s*"[^"]*\/\.htaccess"/g, '')
|
|
87
|
+
.replace(/"[^"]*\/\.htaccess"\s*,?\s*/g, '');
|
|
88
|
+
const release = target['targets']?.['release'];
|
|
89
|
+
const targetsKey = /"targets"\s*:\s*\{/.exec(text);
|
|
90
|
+
if (release !== undefined && targetsKey) {
|
|
91
|
+
const open = targetsKey.index + targetsKey[0].length - 1;
|
|
92
|
+
const close = closingBrace(text, open);
|
|
93
|
+
if (close < 0)
|
|
94
|
+
return;
|
|
95
|
+
const keyIndent = /\n([ \t]+)"[^"]+"\s*:/.exec(text.slice(open, close))?.[1] ?? ' ';
|
|
96
|
+
const unit = keyIndent.length >= 4 ? keyIndent.slice(0, keyIndent.length / 2) : ' ';
|
|
97
|
+
const body = JSON.stringify(release, null, unit).replace(/\n/g, `\n${keyIndent}`);
|
|
98
|
+
const before = text.slice(0, close).replace(/\s*$/, '');
|
|
99
|
+
const closeIndent = keyIndent.slice(unit.length);
|
|
100
|
+
text = `${before},\n${keyIndent}"release": ${body}\n${closeIndent}${text.slice(close)}`;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
if (JSON.stringify(JSON.parse(text)) === JSON.stringify(target))
|
|
104
|
+
tree.write(file, text);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Keep the plain JSON write.
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Release target options and configurations that do what the workspace's own build script did. */
|
|
111
|
+
function applyPipeline(release, pipeline, notes) {
|
|
112
|
+
const options = release['options'];
|
|
113
|
+
if (pipeline.nonce) {
|
|
114
|
+
options['secure'] = true;
|
|
115
|
+
const n = pipeline.nonce;
|
|
116
|
+
const nonce = {};
|
|
117
|
+
if (n.placeholder)
|
|
118
|
+
nonce['placeholder'] = n.placeholder;
|
|
119
|
+
if (n.tags)
|
|
120
|
+
nonce['tags'] = n.tags;
|
|
121
|
+
if (n.position)
|
|
122
|
+
nonce['position'] = n.position;
|
|
123
|
+
if (n.replaceTokens.length > 0)
|
|
124
|
+
nonce['replaceTokens'] = n.replaceTokens;
|
|
125
|
+
if (!n.addMeta)
|
|
126
|
+
nonce['addMeta'] = false;
|
|
127
|
+
if (Object.keys(nonce).length > 0)
|
|
128
|
+
options['nonce'] = nonce;
|
|
129
|
+
}
|
|
130
|
+
if (pipeline.stripHtmlComments)
|
|
131
|
+
options['stripHtmlComments'] = true;
|
|
132
|
+
const configurations = isObject(release['configurations'])
|
|
133
|
+
? release['configurations']
|
|
134
|
+
: {};
|
|
135
|
+
for (const config of Object.values(configurations)) {
|
|
136
|
+
const env = String(config['env'] ?? '').toUpperCase();
|
|
137
|
+
if (env !== 'UAT' && env !== 'PROD')
|
|
138
|
+
continue;
|
|
139
|
+
if (pipeline.obfuscate)
|
|
140
|
+
config['obfuscate'] = pipeline.obfuscate;
|
|
141
|
+
if (pipeline.obfuscateOptions)
|
|
142
|
+
config['obfuscateOptions'] = pipeline.obfuscateOptions;
|
|
143
|
+
if (!pipeline.stripComments)
|
|
144
|
+
delete config['stripComments'];
|
|
145
|
+
if (!pipeline.dropConsole)
|
|
146
|
+
delete config['dropConsole'];
|
|
147
|
+
}
|
|
148
|
+
void notes;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The npm scripts of an adopted app: build:<app>:<env> → nx run <app>:release:<env> when the
|
|
152
|
+
* script built through the workspace's own build script (or is missing), plus the secure ones.
|
|
153
|
+
*/
|
|
154
|
+
function appScripts(name, releases, current, custom) {
|
|
155
|
+
const wanted = (0, angular_project_json_1.angularAppNpmScripts)(name, false, releases);
|
|
156
|
+
const out = {};
|
|
157
|
+
for (const [key, cmd] of Object.entries(wanted)) {
|
|
158
|
+
if (current[key] === cmd)
|
|
159
|
+
continue;
|
|
160
|
+
if (current[key] === undefined || custom[key] !== undefined)
|
|
161
|
+
out[key] = cmd;
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Sets npm scripts in package.json without reformatting the rest of the file: existing scripts
|
|
167
|
+
* are changed in place, new ones go after the app's last build script (or at the end of scripts).
|
|
168
|
+
*/
|
|
169
|
+
function setScriptsInPlace(tree, scripts) {
|
|
170
|
+
if (Object.keys(scripts).length === 0)
|
|
171
|
+
return;
|
|
172
|
+
const before = tree.read('package.json', 'utf8') ?? '';
|
|
173
|
+
let text = before;
|
|
174
|
+
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
175
|
+
const added = [];
|
|
176
|
+
for (const [key, cmd] of Object.entries(scripts)) {
|
|
177
|
+
const re = new RegExp(`("${esc(key)}"\\s*:\\s*)"(?:\\\\.|[^"\\\\])*"`);
|
|
178
|
+
if (re.test(text))
|
|
179
|
+
text = text.replace(re, (_m, lead) => `${lead}${JSON.stringify(cmd)}`);
|
|
180
|
+
else
|
|
181
|
+
added.push([key, cmd]);
|
|
182
|
+
}
|
|
183
|
+
for (const [key, cmd] of added) {
|
|
184
|
+
const app = /^build:([^:]+):/.exec(key)?.[1];
|
|
185
|
+
const lines = text.split('\n');
|
|
186
|
+
const scriptsStart = lines.findIndex((l) => /^\s*"scripts"\s*:\s*\{/.test(l));
|
|
187
|
+
if (scriptsStart < 0)
|
|
188
|
+
break;
|
|
189
|
+
let scriptsEnd = scriptsStart + 1;
|
|
190
|
+
while (scriptsEnd < lines.length && !/^\s*\}/.test(lines[scriptsEnd]))
|
|
191
|
+
scriptsEnd++;
|
|
192
|
+
let anchor = -1;
|
|
193
|
+
for (let i = scriptsStart + 1; i < scriptsEnd; i++) {
|
|
194
|
+
if (app && new RegExp(`^\\s*"build:${esc(app)}:`).test(lines[i]))
|
|
195
|
+
anchor = i;
|
|
196
|
+
}
|
|
197
|
+
if (anchor < 0)
|
|
198
|
+
anchor = scriptsEnd - 1;
|
|
199
|
+
const indent = /^(\s*)/.exec(lines[anchor])?.[1] ?? ' ';
|
|
200
|
+
const isLast = !/,\s*$/.test(lines[anchor]);
|
|
201
|
+
if (isLast)
|
|
202
|
+
lines[anchor] = `${lines[anchor].replace(/\s*$/, '')},`;
|
|
203
|
+
lines.splice(anchor + 1, 0, `${indent}${JSON.stringify(key)}: ${JSON.stringify(cmd)}${isLast ? '' : ','}`);
|
|
204
|
+
text = lines.join('\n');
|
|
205
|
+
}
|
|
206
|
+
// Fall back to a plain JSON write when the text edit did not give the scripts asked for.
|
|
207
|
+
let ok = false;
|
|
208
|
+
try {
|
|
209
|
+
const parsed = JSON.parse(text);
|
|
210
|
+
ok = Object.entries(scripts).every(([k, v]) => parsed.scripts?.[k] === v);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
ok = false;
|
|
214
|
+
}
|
|
215
|
+
if (ok) {
|
|
216
|
+
tree.write('package.json', text);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (pkg) => {
|
|
220
|
+
pkg.scripts = { ...(pkg.scripts ?? {}), ...scripts };
|
|
221
|
+
return pkg;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
exports.setScriptsInPlace = setScriptsInPlace;
|
|
225
|
+
/**
|
|
226
|
+
* @nx/devkit pinned to the installed nx in package.json (text edit, layout kept): the plugin's
|
|
227
|
+
* devkit peer otherwise resolves to the newest Nx on the next install.
|
|
228
|
+
*/
|
|
229
|
+
function pinDevkit(tree, notes) {
|
|
230
|
+
if (!tree.exists('package.json'))
|
|
231
|
+
return;
|
|
232
|
+
const nx = (0, devkit_pin_1.installedVersion)(tree.root, 'nx');
|
|
233
|
+
const before = tree.read('package.json', 'utf8') ?? '';
|
|
234
|
+
let pkg;
|
|
235
|
+
try {
|
|
236
|
+
pkg = JSON.parse(before);
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const version = (0, devkit_pin_1.devkitPinFor)(pkg, nx);
|
|
242
|
+
if (!version)
|
|
243
|
+
return;
|
|
244
|
+
const jsonc = (0, json_layout_1.loadJsonc)(tree.root);
|
|
245
|
+
const after = JSON.stringify((0, devkit_pin_1.withDevkitPin)(pkg, version), null, 2);
|
|
246
|
+
tree.write('package.json', (jsonc && (0, json_layout_1.keepJsonLayout)(jsonc, before, after)) || `${after}\n`);
|
|
247
|
+
notes.push(`\`@nx/devkit\` pinned to ${version} (the workspace's Nx)` +
|
|
248
|
+
((0, devkit_pin_1.installedVersion)(tree.root, '@nx/devkit') === version ? '.' : '; run npm install.'));
|
|
249
|
+
}
|
|
250
|
+
/** The configurations of a project's plugin release target. */
|
|
251
|
+
function releaseEnvs(pj) {
|
|
252
|
+
const release = pj['targets']?.['release'];
|
|
253
|
+
if (!isObject(release) || release['executor'] !== angular_project_1.POLYSTACK_BUILD_EXECUTOR)
|
|
254
|
+
return [];
|
|
255
|
+
return Object.keys(release['configurations'] ?? {});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Sets `build:all:<env>` scripts that run a workspace script to `nx run-many -t release -c
|
|
259
|
+
* <env>` (for the envs the release targets have) in `out`; returns the scripts they ran.
|
|
260
|
+
*/
|
|
261
|
+
function buildAllScripts(scripts, envs, out) {
|
|
262
|
+
const replaced = [];
|
|
263
|
+
for (const [key, cmd] of Object.entries(scripts)) {
|
|
264
|
+
const env = /^build:all:([\w-]+)$/.exec(key)?.[1];
|
|
265
|
+
if (!env || !envs.has(env) || /^\s*(npx\s+)?nx\s/.test(cmd))
|
|
266
|
+
continue;
|
|
267
|
+
out[key] = `nx run-many -t release -c ${env}`;
|
|
268
|
+
const file = /\bnode\s+(['"]?)([\w./-]+\.(?:c|m)?js)\1/.exec(cmd)?.[2];
|
|
269
|
+
if (file)
|
|
270
|
+
replaced.push(file.replace(/^\.\//, ''));
|
|
271
|
+
}
|
|
272
|
+
return replaced;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* In a workspace whose Angular apps all build with the release target already: build:all:<env>
|
|
276
|
+
* scripts still running the workspace's own script move to nx run-many. Returns those scripts.
|
|
277
|
+
*/
|
|
278
|
+
function switchBuildAll(tree, options, result) {
|
|
279
|
+
if (options.scripts === false || (options.projects && options.projects.length > 0))
|
|
280
|
+
return [];
|
|
281
|
+
if (!tree.exists('package.json'))
|
|
282
|
+
return [];
|
|
283
|
+
const pkg = (0, devkit_1.readJson)(tree, 'package.json');
|
|
284
|
+
const envs = new Set((0, project_json_files_1.readProjects)(tree).flatMap(({ json }) => releaseEnvs(json)));
|
|
285
|
+
const scripts = {};
|
|
286
|
+
const replaced = buildAllScripts(pkg.scripts ?? {}, envs, scripts);
|
|
287
|
+
if (replaced.length === 0)
|
|
288
|
+
return [];
|
|
289
|
+
setScriptsInPlace(tree, scripts);
|
|
290
|
+
result.scripts = scripts;
|
|
291
|
+
devkit_1.logger.info(`adopt: ${Object.keys(scripts).join(', ')} now run every release target (nx run-many).`);
|
|
292
|
+
return [...new Set(replaced)].sort();
|
|
293
|
+
}
|
|
294
|
+
/** Deletes the old pipeline scripts nothing uses any more (see old-scripts.ts). */
|
|
295
|
+
function removeOldScripts(tree, oldScripts, result) {
|
|
296
|
+
const previous = tree.exists(exports.ADOPT_REPORT) ? tree.read(exports.ADOPT_REPORT, 'utf8') ?? '' : '';
|
|
297
|
+
const found = (0, old_scripts_1.findOldScripts)(tree, [...oldScripts, ...(0, old_scripts_1.recordedScripts)(previous)]);
|
|
298
|
+
for (const f of found.removable)
|
|
299
|
+
tree.delete(f);
|
|
300
|
+
result.removed = found.removable;
|
|
301
|
+
result.unreferenced = found.unreferenced;
|
|
302
|
+
devkit_1.logger.info(found.removable.length > 0
|
|
303
|
+
? `adopt: removed the old build scripts nothing uses any more: ${found.removable.join(', ')}`
|
|
304
|
+
: 'adopt: no old build script left to remove.');
|
|
305
|
+
if (found.unreferenced.length > 0) {
|
|
306
|
+
devkit_1.logger.info(`adopt: not part of the old build, nothing starts them; left in place: ${found.unreferenced.join(', ')}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function removalLines(result) {
|
|
310
|
+
if (result.removed.length === 0 && result.unreferenced.length === 0)
|
|
311
|
+
return [];
|
|
312
|
+
const lines = ['## Old scripts', ''];
|
|
313
|
+
if (result.removed.length > 0) {
|
|
314
|
+
lines.push(`Removed (nothing uses them any more): ${result.removed.map(code).join(', ')}.`, '');
|
|
315
|
+
}
|
|
316
|
+
if (result.unreferenced.length > 0) {
|
|
317
|
+
lines.push('Nothing starts these, but they are not part of the old build, so they were left: ' +
|
|
318
|
+
`${result.unreferenced.map(code).join(', ')}.`, '');
|
|
319
|
+
}
|
|
320
|
+
return lines;
|
|
321
|
+
}
|
|
322
|
+
function appendRemovalReport(tree, result) {
|
|
323
|
+
const scripts = Object.entries(result.scripts);
|
|
324
|
+
const lines = [
|
|
325
|
+
...(scripts.length > 0
|
|
326
|
+
? ['## build:all scripts', '', ...scripts.map(([k, v]) => `- ${code(k)}: ${code(v)}`), '']
|
|
327
|
+
: []),
|
|
328
|
+
...removalLines(result),
|
|
329
|
+
];
|
|
330
|
+
if (lines.length === 0)
|
|
331
|
+
return;
|
|
332
|
+
const previous = tree.exists(exports.ADOPT_REPORT)
|
|
333
|
+
? tree.read(exports.ADOPT_REPORT, 'utf8') ?? ''
|
|
334
|
+
: '# pstack adopt\n';
|
|
335
|
+
let kept = previous.replace(/\n## Old scripts\n[\s\S]*?(?=\n## |$)/, '\n');
|
|
336
|
+
if (scripts.length > 0)
|
|
337
|
+
kept = kept.replace(/\n## build:all scripts\n[\s\S]*?(?=\n## |$)/, '\n');
|
|
338
|
+
tree.write(exports.ADOPT_REPORT, `${kept.replace(/\n*$/, '\n\n')}${lines.join('\n')}`);
|
|
339
|
+
}
|
|
340
|
+
function report(result, pipeline, customScripts) {
|
|
341
|
+
const lines = ['# pstack adopt', ''];
|
|
342
|
+
lines.push(`Apps moved to the polystack \`release\` target: ${result.adopted.length > 0 ? result.adopted.map(code).join(', ') : 'none'}.`, '');
|
|
343
|
+
if (result.skipped.length > 0) {
|
|
344
|
+
lines.push('## Not changed', '', ...result.skipped.map((s) => `- ${s}`), '');
|
|
345
|
+
}
|
|
346
|
+
if (customScripts.length > 0) {
|
|
347
|
+
lines.push('## The workspace build script', '', `Read: ${pipeline.scripts.map(code).join(', ')}. The release target was set to do the same:`, '', `- CSP nonce: ${pipeline.nonce
|
|
348
|
+
? `on (\`secure\`), placeholder ${code(pipeline.nonce.placeholder ?? 'default')}, tags ${pipeline.nonce.tags ?? 'all'}, position ${pipeline.nonce.position ?? 'end'}${pipeline.nonce.replaceTokens.length > 0
|
|
349
|
+
? `, replaces ${pipeline.nonce.replaceTokens.map(code).join(', ')}`
|
|
350
|
+
: ''}, ${pipeline.nonce.addMeta ? 'adds' : 'no'} csp-nonce meta`
|
|
351
|
+
: 'none found'}`, `- HTML comments stripped in every env: ${pipeline.stripHtmlComments ? 'yes' : 'no'}`, `- UAT/PROD comment stripping: ${pipeline.stripComments ? 'yes' : 'no'}; obfuscation: ${pipeline.obfuscate
|
|
352
|
+
? `yes (${pipeline.obfuscate}${pipeline.obfuscateOptions
|
|
353
|
+
? ` with ${code(JSON.stringify(pipeline.obfuscateOptions))}`
|
|
354
|
+
: ''})`
|
|
355
|
+
: 'no'}; console removal: ${pipeline.dropConsole ? 'yes' : 'no'}`, '', 'Check before switching CI: `pstack adopt --compare --app=<app> --base=<commit before adopt>` ' +
|
|
356
|
+
'builds an app both ways for each env and compares the output (files, .htaccess, nonce, ' +
|
|
357
|
+
'encrypted env values, obfuscation, image metadata).', '', `Old build scripts: ${customScripts.map(code).join(', ') || 'none'}.` +
|
|
358
|
+
(result.removed.length > 0
|
|
359
|
+
? ''
|
|
360
|
+
: ' They are left in place; `pstack adopt --remove-old-scripts` deletes the ones nothing ' +
|
|
361
|
+
'uses any more.'), '');
|
|
362
|
+
}
|
|
363
|
+
if (result.notes.length > 0)
|
|
364
|
+
lines.push('## Notes', '', ...result.notes.map((n) => `- ${n}`), '');
|
|
365
|
+
lines.push(...removalLines(result));
|
|
366
|
+
const scripts = Object.entries(result.scripts);
|
|
367
|
+
if (scripts.length > 0) {
|
|
368
|
+
lines.push('## npm scripts', '', ...scripts.map(([k, v]) => `- ${code(k)}: ${code(v)}`), '');
|
|
369
|
+
}
|
|
370
|
+
return lines.join('\n');
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* pstack adopt: moves the Angular apps of this workspace that still build with their own scripts
|
|
374
|
+
* to the plugin's release target, in place. Each app gets a release target (base hrefs, env folder
|
|
375
|
+
* and the post-build steps read from the workspace's build script), its .htaccess becomes
|
|
376
|
+
* environments/<app>/htaccess.<env>, the workspace's env encryption is mirrored in nx.json, and its
|
|
377
|
+
* build:<app>:<env> npm scripts call nx run <app>:release:<env>. Old scripts are not deleted.
|
|
378
|
+
*/
|
|
379
|
+
async function adoptGenerator(tree, options = {}) {
|
|
380
|
+
const result = {
|
|
381
|
+
adopted: [],
|
|
382
|
+
skipped: [],
|
|
383
|
+
notes: [],
|
|
384
|
+
scripts: {},
|
|
385
|
+
removed: [],
|
|
386
|
+
unreferenced: [],
|
|
387
|
+
};
|
|
388
|
+
let candidates = adoptCandidates(tree);
|
|
389
|
+
if (options.projects && options.projects.length > 0) {
|
|
390
|
+
const wanted = new Set(options.projects);
|
|
391
|
+
const known = new Set(candidates.map((c) => c.name));
|
|
392
|
+
const unknown = options.projects.filter((p) => !known.has(p));
|
|
393
|
+
if (unknown.length > 0) {
|
|
394
|
+
throw new Error(`adopt: ${unknown.map((p) => `"${p}"`).join(', ')} ${unknown.length === 1 ? 'is not an Angular app' : 'are not Angular apps'} that builds without the plugin (candidates: ${[...known].join(', ') || 'none'})`);
|
|
395
|
+
}
|
|
396
|
+
candidates = candidates.filter((c) => wanted.has(c.name));
|
|
397
|
+
}
|
|
398
|
+
for (const c of candidates.filter((c) => c.reason)) {
|
|
399
|
+
result.skipped.push(`${code(c.name)}: ${c.reason}`);
|
|
400
|
+
}
|
|
401
|
+
candidates = candidates.filter((c) => !c.reason);
|
|
402
|
+
if (candidates.length === 0) {
|
|
403
|
+
// Adopted earlier (before adopt moved build:all, or app by app): move it now.
|
|
404
|
+
const replaced = result.skipped.length === 0 ? switchBuildAll(tree, options, result) : [];
|
|
405
|
+
if (options.removeOldScripts)
|
|
406
|
+
removeOldScripts(tree, replaced, result);
|
|
407
|
+
if (replaced.length > 0 || options.removeOldScripts) {
|
|
408
|
+
appendRemovalReport(tree, result);
|
|
409
|
+
return result;
|
|
410
|
+
}
|
|
411
|
+
devkit_1.logger.info('adopt: no Angular app builds without the plugin; nothing to do.');
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
const pkg = tree.exists('package.json')
|
|
415
|
+
? (0, devkit_1.readJson)(tree, 'package.json')
|
|
416
|
+
: {};
|
|
417
|
+
const names = candidates.map((c) => c.name);
|
|
418
|
+
const buildScripts = (0, build_scripts_1.readBuildScripts)(tree.root, pkg.scripts, names);
|
|
419
|
+
const pipeline = (0, pipeline_1.readSourcePipeline)(tree.root, buildScripts.customScripts);
|
|
420
|
+
// Before any release target exists: the encryption settings apply to every release build.
|
|
421
|
+
const encryption = (0, env_encryption_1.applySourceEnvEncryption)(tree, tree.root, result.notes);
|
|
422
|
+
if (encryption?.applied && pipeline.timezone)
|
|
423
|
+
setStampTimezone(tree, pipeline.timezone, result.notes);
|
|
424
|
+
const scripts = {};
|
|
425
|
+
for (const { name, root } of candidates) {
|
|
426
|
+
const pjPath = `${root}/project.json`;
|
|
427
|
+
const pj = (0, devkit_1.readJson)(tree, pjPath);
|
|
428
|
+
const targets = pj['targets'];
|
|
429
|
+
const notes = [];
|
|
430
|
+
const releases = (0, angular_project_json_1.addReleaseTarget)(targets, name, (w) => notes.push(w), root);
|
|
431
|
+
if (releases.length === 0) {
|
|
432
|
+
result.skipped.push(`${code(name)}: ${notes.join('; ')}`);
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
(0, build_scripts_1.shapeReleaseTarget)(targets, name, buildScripts, notes);
|
|
436
|
+
applyPipeline(targets['release'], pipeline, notes);
|
|
437
|
+
const original = tree.read(pjPath, 'utf8') ?? '';
|
|
438
|
+
(0, devkit_1.writeJson)(tree, pjPath, pj);
|
|
439
|
+
(0, htaccess_adopt_1.htaccessNote)((0, htaccess_adopt_1.adoptHtaccess)(tree, pjPath), name, notes);
|
|
440
|
+
keepFormatting(tree, pjPath, original);
|
|
441
|
+
result.adopted.push(name);
|
|
442
|
+
result.notes.push(...notes.map((n) => `${code(name)}: ${n}`));
|
|
443
|
+
if (options.scripts !== false) {
|
|
444
|
+
Object.assign(scripts, appScripts(name, releases, pkg.scripts ?? {}, buildScripts.customBuilds));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (buildScripts.unread.length > 0) {
|
|
448
|
+
result.notes.push(`Base hrefs for ${buildScripts.unread.map(code).join(', ')} could not be read from the ` +
|
|
449
|
+
"build scripts; set `baseHref` on their release target's configurations.");
|
|
450
|
+
}
|
|
451
|
+
// build:all:<env> through the workspace's own script: every app now builds with its release
|
|
452
|
+
// target, so nx builds them all (only when every candidate was adopted).
|
|
453
|
+
const replacedAll = [];
|
|
454
|
+
if (options.scripts !== false && (!options.projects || options.projects.length === 0)) {
|
|
455
|
+
const envs = new Set(result.adopted.flatMap((name) => {
|
|
456
|
+
const c = candidates.find((x) => x.name === name);
|
|
457
|
+
return c ? releaseEnvs((0, devkit_1.readJson)(tree, `${c.root}/project.json`)) : [];
|
|
458
|
+
}));
|
|
459
|
+
replacedAll.push(...buildAllScripts(pkg.scripts ?? {}, envs, scripts));
|
|
460
|
+
}
|
|
461
|
+
if (tree.exists('package.json'))
|
|
462
|
+
setScriptsInPlace(tree, scripts);
|
|
463
|
+
result.scripts = scripts;
|
|
464
|
+
pinDevkit(tree, result.notes);
|
|
465
|
+
const oldScripts = [...new Set([...buildScripts.customScripts, ...replacedAll])].sort();
|
|
466
|
+
if (options.removeOldScripts)
|
|
467
|
+
removeOldScripts(tree, oldScripts, result);
|
|
468
|
+
tree.write(exports.ADOPT_REPORT, report(result, pipeline, oldScripts));
|
|
469
|
+
devkit_1.logger.info(`adopt: ${result.adopted.length} app(s) now build with nx run <app>:release:<env> ` +
|
|
470
|
+
`(${result.adopted.join(', ')}). Report: ${exports.ADOPT_REPORT}`);
|
|
471
|
+
for (const s of result.skipped)
|
|
472
|
+
devkit_1.logger.warn(`adopt: not changed: ${s.replace(/`/g, '')}`);
|
|
473
|
+
return result;
|
|
474
|
+
}
|
|
475
|
+
exports.default = adoptGenerator;
|
|
476
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/generators/adopt/generator.ts"],"names":[],"mappings":";;;AAAA,uCAA2E;AAE3E,4DAAwF;AACxF,kEAG4C;AAC5C,qEAA+E;AAC/E,qEAA2E;AAC3E,2DAA2F;AAC3F,6DAAwE;AACxE,2EAAkE;AAClE,0EAAyF;AACzF,+DAAmF;AACnF,iEAAwE;AAExE,+CAAgE;AAChE,yCAAgE;AAgBhE,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAa,EAAE,CACzC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;AAEvC,kGAAkG;AAClG,MAAM,oBAAoB,GACxB,iKAAiK,CAAC;AAEvJ,QAAA,YAAY,GAAG,0BAA0B,CAAC;AAavD,oGAAoG;AACpG,SAAgB,eAAe,CAAC,IAAU;IACxC,MAAM,GAAG,GAAsD,EAAE,CAAC;IAClE,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAA,iCAAY,EAAC,IAAI,CAAC,EAAE;QACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,SAAS,CAA0B,CAAC,CAAC,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C,IAAI,MAAM,CAAC,OAAO;QAAE,eAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1F,OAAO,MAAM,CAAC;AAChB,CAAC;AA/GD,iCA+GC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/** Workspace-relative .js files a script's text runs or loads (only those that exist). */
|
|
3
|
+
export declare function scriptReferences(tree: Tree, rel: string | null, text: string): string[];
|
|
4
|
+
/** `entries` and every script they run or load, transitively. */
|
|
5
|
+
export declare function scriptClosure(tree: Tree, entries: string[]): Set<string>;
|
|
6
|
+
/** Scripts under tools/ that something outside tools/ still starts (and what they load). */
|
|
7
|
+
export declare function liveScripts(tree: Tree): Set<string>;
|
|
8
|
+
/** Every .js file under tools/. */
|
|
9
|
+
export declare function toolScripts(tree: Tree): string[];
|
|
10
|
+
/** Workspace-relative script paths named in backticks in a report (`tools/scripts/build.js`). */
|
|
11
|
+
export declare function recordedScripts(report: string): string[];
|
|
12
|
+
export interface OldScripts {
|
|
13
|
+
/** Old build pipeline files nothing uses any more: safe to delete. */
|
|
14
|
+
removable: string[];
|
|
15
|
+
/** Scripts under tools/ nothing starts that are not part of the old pipeline: left in place. */
|
|
16
|
+
unreferenced: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The old build pipeline: the scripts recorded as replaced by adopt (`recorded`), plus any
|
|
20
|
+
* unused script under tools/ that runs an Angular build, with everything they run or load. Of
|
|
21
|
+
* those, the files nothing else uses (package.json, project.json, CI, git hooks, and the scripts
|
|
22
|
+
* those start) can go.
|
|
23
|
+
*/
|
|
24
|
+
export declare function findOldScripts(tree: Tree, recorded: string[]): OldScripts;
|