@mouryaamit/nx-polystack 1.21.0 → 1.22.0
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/dist/migrations.json +5 -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/remove.d.ts +46 -0
- package/dist/src/cli/commands/remove.js +409 -0
- package/dist/src/cli/commands/remove.js.map +1 -0
- package/dist/src/cli/commands/upgrade.d.ts +1 -0
- package/dist/src/cli/commands/upgrade.js +4 -4
- package/dist/src/cli/commands/upgrade.js.map +1 -1
- package/dist/src/cli/help.js +12 -0
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/launcher.js +2 -0
- package/dist/src/cli/launcher.js.map +1 -1
- package/dist/src/generators/migrate/adapters/angular-cli.js +3 -1
- package/dist/src/generators/migrate/adapters/angular-cli.js.map +1 -1
- package/dist/src/generators/migrate/adapters/angular-workspace.js +3 -1
- package/dist/src/generators/migrate/adapters/angular-workspace.js.map +1 -1
- package/dist/src/generators/migrate/adapters/nx-workspace.js +2 -4
- package/dist/src/generators/migrate/adapters/nx-workspace.js.map +1 -1
- package/dist/src/lib/env-encryption/switch-gcm.js +1 -1
- package/dist/src/lib/env-encryption/switch-gcm.js.map +1 -1
- package/dist/src/lib/utils/angular-project.d.ts +5 -0
- package/dist/src/lib/utils/angular-project.js +17 -1
- package/dist/src/lib/utils/angular-project.js.map +1 -1
- package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js +1 -1
- package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js.map +1 -1
- package/package.json +1 -1
package/dist/migrations.json
CHANGED
|
@@ -142,6 +142,11 @@
|
|
|
142
142
|
"version": "1.14.0",
|
|
143
143
|
"description": "Run typecheck-everywhere again: projects without tsconfig.app.json/tsconfig.lib.json get typecheck from the tsconfig their build target names",
|
|
144
144
|
"implementation": "./src/migrations/typecheck-everywhere/typecheck-everywhere"
|
|
145
|
+
},
|
|
146
|
+
"add-csp-nonce-import-1.21.1": {
|
|
147
|
+
"version": "1.21.1",
|
|
148
|
+
"description": "Run add-csp-nonce-import again: apps on the Angular 17+ application builder (build option browser instead of main) get the CSP nonce import too",
|
|
149
|
+
"implementation": "./src/migrations/add-csp-nonce-import/add-csp-nonce-import"
|
|
145
150
|
}
|
|
146
151
|
}
|
|
147
152
|
}
|
|
@@ -45,5 +45,6 @@ exports.COMMANDS = {
|
|
|
45
45
|
inspect: async (c) => (await Promise.resolve().then(() => __importStar(require('./inspect')))).runInspect(c),
|
|
46
46
|
assets: async (c) => (await Promise.resolve().then(() => __importStar(require('./assets')))).runAssets(c),
|
|
47
47
|
upgrade: async (c) => (await Promise.resolve().then(() => __importStar(require('./upgrade')))).runUpgrade(c),
|
|
48
|
+
remove: async (c) => (await Promise.resolve().then(() => __importStar(require('./remove')))).runRemove(c),
|
|
48
49
|
};
|
|
49
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIa,QAAA,QAAQ,GAAmC;IACtD,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,UAAU,GAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,OAAO,GAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,OAAO,GAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,OAAO,GAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD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AU,GAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,WAAW,GAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,SAAS,GAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,WAAW,GAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,UAAU,GAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,WAAW,GAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,wDAAa,UAAU,GAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { CommandContext } from '../types';
|
|
3
|
+
import { UpgradeDeps } from './upgrade';
|
|
4
|
+
export interface RemovalApp {
|
|
5
|
+
name: string;
|
|
6
|
+
root: string;
|
|
7
|
+
/** Other folders that go with the app: <app>-e2e, environments/<envProject>, the report. */
|
|
8
|
+
extraDirs: string[];
|
|
9
|
+
files: string[];
|
|
10
|
+
/** tsconfig.base.json paths that point into the app. */
|
|
11
|
+
aliases: string[];
|
|
12
|
+
envProject: string;
|
|
13
|
+
/** dist folders (not in git). */
|
|
14
|
+
dist: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface RemovalPlan {
|
|
17
|
+
apps: RemovalApp[];
|
|
18
|
+
/** npm scripts removed (name → command). */
|
|
19
|
+
scripts: Record<string, string>;
|
|
20
|
+
/** npm scripts that name an app and another project: kept, listed. */
|
|
21
|
+
sharedScripts: string[];
|
|
22
|
+
/** Runtime packages uninstalled, with why. */
|
|
23
|
+
packages: {
|
|
24
|
+
name: string;
|
|
25
|
+
why: string;
|
|
26
|
+
}[];
|
|
27
|
+
/** Runtime packages the apps use that stay, with why. */
|
|
28
|
+
keptPackages: {
|
|
29
|
+
name: string;
|
|
30
|
+
why: string;
|
|
31
|
+
}[];
|
|
32
|
+
/** Libraries only these apps import (kept). */
|
|
33
|
+
libsOnlyHere: string[];
|
|
34
|
+
/** Projects that depend on an app (refused without --force). */
|
|
35
|
+
dependents: string[];
|
|
36
|
+
/** Lines in CI files and README that name an app (not edited). */
|
|
37
|
+
mentions: string[];
|
|
38
|
+
}
|
|
39
|
+
/** Plans removing these apps; nothing is changed. */
|
|
40
|
+
export declare function planRemoval(root: string, names: string[]): RemovalPlan;
|
|
41
|
+
/** The plan as lines for the console. */
|
|
42
|
+
export declare function describePlan(plan: RemovalPlan): string[];
|
|
43
|
+
/** The plan's file changes on a tree (folders, tsconfig paths, npm scripts, nx.json keys). */
|
|
44
|
+
export declare function applyRemoval(tree: Tree, plan: RemovalPlan): void;
|
|
45
|
+
/** pstack remove --app=<a,b> [--dry-run] [--yes] [--force] */
|
|
46
|
+
export declare function runRemove(ctx: CommandContext, deps?: UpgradeDeps): Promise<number>;
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runRemove = exports.applyRemoval = exports.describePlan = exports.planRemoval = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const llm_block_1 = require("../../lib/utils/llm-block");
|
|
8
|
+
const args_1 = require("../args");
|
|
9
|
+
const context_1 = require("../context");
|
|
10
|
+
const run_tree_1 = require("../run-tree");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const upgrade_1 = require("./upgrade");
|
|
13
|
+
const upgrade_standalone_1 = require("./upgrade-standalone");
|
|
14
|
+
const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
15
|
+
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
16
|
+
/** Runtime packages that are never uninstalled: frameworks, the plugin and its pipeline. */
|
|
17
|
+
const NEVER_REMOVE = [
|
|
18
|
+
/^@angular\//,
|
|
19
|
+
/^@angular-devkit\//,
|
|
20
|
+
/^@nx\//,
|
|
21
|
+
/^@nrwl\//,
|
|
22
|
+
/^nx$/,
|
|
23
|
+
/^typescript$/,
|
|
24
|
+
/^tslib$/,
|
|
25
|
+
/^rxjs$/,
|
|
26
|
+
/^zone\.js$/,
|
|
27
|
+
/^@ionic\/angular$/,
|
|
28
|
+
/^@ionic\/core$/,
|
|
29
|
+
/^ionicons$/,
|
|
30
|
+
/^@capacitor\/(core|cli)$/,
|
|
31
|
+
/^@mouryaamit\/nx-polystack$/,
|
|
32
|
+
/^crypto-js$/,
|
|
33
|
+
];
|
|
34
|
+
const TEXT = /\.(ts|tsx|js|mjs|cjs|json|scss|sass|css|less|html|ya?ml)$/;
|
|
35
|
+
const SKIP_DIRS = new Set(['node_modules', 'dist', 'tmp', 'coverage', '.git', '.nx', '.angular']);
|
|
36
|
+
/** Text files under `dir` (relative to root), skipping build output and the given folders. */
|
|
37
|
+
function textFiles(root, dir, skip) {
|
|
38
|
+
const out = [];
|
|
39
|
+
const walk = (rel) => {
|
|
40
|
+
const abs = path.join(root, rel);
|
|
41
|
+
if (!fs.existsSync(abs))
|
|
42
|
+
return;
|
|
43
|
+
for (const e of fs.readdirSync(abs, { withFileTypes: true })) {
|
|
44
|
+
const r = rel ? `${rel}/${e.name}` : e.name;
|
|
45
|
+
if (e.isDirectory()) {
|
|
46
|
+
if (SKIP_DIRS.has(e.name) || skip.has(r) || e.name === 'android' || e.name === 'ios')
|
|
47
|
+
continue;
|
|
48
|
+
walk(r);
|
|
49
|
+
}
|
|
50
|
+
else if (TEXT.test(e.name) && e.name !== 'package-lock.json') {
|
|
51
|
+
out.push(r);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
walk(dir);
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
const read = (root, rel) => {
|
|
59
|
+
try {
|
|
60
|
+
return fs.readFileSync(path.join(root, rel), 'utf8');
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const readJson = (root, rel) => {
|
|
67
|
+
try {
|
|
68
|
+
const v = JSON.parse(read(root, rel));
|
|
69
|
+
return isObject(v) ? v : {};
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/** Package names a file imports or names (import/require/export from, @import/@use, node_modules/). */
|
|
76
|
+
function packagesIn(text) {
|
|
77
|
+
const found = new Set();
|
|
78
|
+
const add = (spec) => {
|
|
79
|
+
if (spec.startsWith('.') || spec.startsWith('/') || spec.startsWith('@env/'))
|
|
80
|
+
return;
|
|
81
|
+
const parts = spec.replace(/^~/, '').split('/');
|
|
82
|
+
const name = parts[0].startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
|
|
83
|
+
if (/^(@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i.test(name))
|
|
84
|
+
found.add(name);
|
|
85
|
+
};
|
|
86
|
+
for (const m of text.matchAll(/(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*|@(?:import|use|forward)\s+)['"]([^'"]+)['"]/g)) {
|
|
87
|
+
add(m[1]);
|
|
88
|
+
}
|
|
89
|
+
for (const m of text.matchAll(/node_modules\/((?:@[\w.-]+\/)?[\w.-]+)/g))
|
|
90
|
+
add(m[1]);
|
|
91
|
+
return found;
|
|
92
|
+
}
|
|
93
|
+
/** Plans removing these apps; nothing is changed. */
|
|
94
|
+
function planRemoval(root, names) {
|
|
95
|
+
const projects = (0, upgrade_standalone_1.workspaceProjects)(root);
|
|
96
|
+
const unknown = names.filter((n) => !projects.some((p) => p.name === n));
|
|
97
|
+
if (unknown.length > 0) {
|
|
98
|
+
throw new types_1.CliError(`no app named ${unknown.map((n) => `"${n}"`).join(', ')}. Apps: ${projects
|
|
99
|
+
.filter((p) => p.app)
|
|
100
|
+
.map((p) => p.name)
|
|
101
|
+
.join(', ')}.`);
|
|
102
|
+
}
|
|
103
|
+
const libs = names.filter((n) => !projects.find((p) => p.name === n)?.app);
|
|
104
|
+
if (libs.length > 0) {
|
|
105
|
+
throw new types_1.CliError(`${libs.join(', ')}: not an app (pstack remove retires apps only).`);
|
|
106
|
+
}
|
|
107
|
+
const tsPaths = (() => {
|
|
108
|
+
const co = readJson(root, 'tsconfig.base.json')['compilerOptions'];
|
|
109
|
+
return isObject(co) && isObject(co['paths']) ? co['paths'] : {};
|
|
110
|
+
})();
|
|
111
|
+
const aliasesInto = (dir) => Object.entries(tsPaths)
|
|
112
|
+
.filter(([, t]) => Array.isArray(t) &&
|
|
113
|
+
t.some((x) => typeof x === 'string' && `${x.replace(/^\.\//, '')}/`.startsWith(`${dir}/`)))
|
|
114
|
+
.map(([alias]) => alias);
|
|
115
|
+
const releaseOf = (p) => {
|
|
116
|
+
const targets = readJson(root, `${p.root}/project.json`)['targets'];
|
|
117
|
+
if (!isObject(targets))
|
|
118
|
+
return undefined;
|
|
119
|
+
return Object.values(targets).find((t) => isObject(t) && t['executor'] === '@mouryaamit/nx-polystack:build');
|
|
120
|
+
};
|
|
121
|
+
const envProjectOf = (p) => {
|
|
122
|
+
const o = releaseOf(p)?.['options'];
|
|
123
|
+
return isObject(o) && typeof o['envProject'] === 'string' ? o['envProject'] : p.name;
|
|
124
|
+
};
|
|
125
|
+
const removed = projects.filter((p) => names.includes(p.name) || names.some((n) => p.name === `${n}-e2e`));
|
|
126
|
+
const removedRoots = new Set(removed.map((p) => p.root));
|
|
127
|
+
const kept = projects.filter((p) => !removedRoots.has(p.root));
|
|
128
|
+
const apps = names.map((name) => {
|
|
129
|
+
const p = projects.find((x) => x.name === name);
|
|
130
|
+
const envProject = envProjectOf(p);
|
|
131
|
+
const envShared = kept.some((k) => envProjectOf(k) === envProject && k.app);
|
|
132
|
+
const extraDirs = [
|
|
133
|
+
...removed.filter((x) => x.name === `${name}-e2e`).map((x) => x.root),
|
|
134
|
+
...(!envShared && fs.existsSync(path.join(root, 'environments', envProject))
|
|
135
|
+
? [`environments/${envProject}`]
|
|
136
|
+
: []),
|
|
137
|
+
];
|
|
138
|
+
const files = [`docs/migrations/${name}.md`, `docs/migrations/${name}.manifest.json`].filter((f) => fs.existsSync(path.join(root, f)));
|
|
139
|
+
const dist = [`dist/${p.root}`, `dist/apps/${name}`].filter((d, i, a) => a.indexOf(d) === i && fs.existsSync(path.join(root, d)));
|
|
140
|
+
return { name, root: p.root, extraDirs, files, aliases: aliasesInto(p.root), envProject, dist };
|
|
141
|
+
});
|
|
142
|
+
const goneDirs = new Set(apps.flatMap((a) => [a.root, ...a.extraDirs]));
|
|
143
|
+
// Who still uses an app: imports of its aliases, implicitDependencies, target references.
|
|
144
|
+
const dependents = [];
|
|
145
|
+
const keptFiles = new Map(kept.map((k) => [k, textFiles(root, k.root, goneDirs)]));
|
|
146
|
+
for (const a of apps) {
|
|
147
|
+
for (const k of kept) {
|
|
148
|
+
const pj = readJson(root, `${k.root}/project.json`);
|
|
149
|
+
const why = [];
|
|
150
|
+
if (Array.isArray(pj['implicitDependencies']) && pj['implicitDependencies'].includes(a.name))
|
|
151
|
+
why.push('implicitDependencies');
|
|
152
|
+
if (JSON.stringify(pj['targets'] ?? {}).includes(`"${a.name}:`))
|
|
153
|
+
why.push('a target');
|
|
154
|
+
const importer = (keptFiles.get(k) ?? []).find((f) => a.aliases.some((al) => new RegExp(`['"]${esc(al)}(/[^'"]*)?['"]`).test(read(root, f))));
|
|
155
|
+
if (importer)
|
|
156
|
+
why.push(`imports it in ${importer}`);
|
|
157
|
+
if (why.length > 0)
|
|
158
|
+
dependents.push(`${k.name} → ${a.name} (${why.join(', ')})`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Libraries the apps import that no kept project imports.
|
|
162
|
+
const libAliases = kept
|
|
163
|
+
.filter((k) => !k.app)
|
|
164
|
+
.map((l) => ({ lib: l, aliases: aliasesInto(l.root) }))
|
|
165
|
+
.filter((x) => x.aliases.length > 0);
|
|
166
|
+
const imports = (files, aliases) => files.some((f) => aliases.some((al) => new RegExp(`['"]${esc(al)}(/[^'"]*)?['"]`).test(read(root, f))));
|
|
167
|
+
const appFiles = apps.flatMap((a) => textFiles(root, a.root, new Set()));
|
|
168
|
+
const libsOnlyHere = libAliases
|
|
169
|
+
.filter(({ lib, aliases }) => imports(appFiles, aliases) &&
|
|
170
|
+
!kept.some((k) => k.root !== lib.root && imports(keptFiles.get(k) ?? [], aliases)))
|
|
171
|
+
.map(({ lib }) => lib.name)
|
|
172
|
+
.sort();
|
|
173
|
+
// Runtime packages: the apps use them, nothing else names them.
|
|
174
|
+
const pkg = readJson(root, 'package.json');
|
|
175
|
+
const runtime = isObject(pkg['dependencies']) ? Object.keys(pkg['dependencies']) : [];
|
|
176
|
+
const used = new Set();
|
|
177
|
+
for (const f of appFiles)
|
|
178
|
+
for (const n of packagesIn(read(root, f)))
|
|
179
|
+
used.add(n);
|
|
180
|
+
const elsewhere = textFiles(root, '', goneDirs).filter((f) => f !== 'package.json' && !f.startsWith('docs/migrations/'));
|
|
181
|
+
const packages = [];
|
|
182
|
+
const keptPackages = [];
|
|
183
|
+
for (const name of runtime.filter((n) => used.has(n)).sort()) {
|
|
184
|
+
if (NEVER_REMOVE.some((re) => re.test(name))) {
|
|
185
|
+
keptPackages.push({ name, why: 'framework or pipeline package' });
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const re = new RegExp(`['"\`~/]${esc(name)}(['"\`/]|$)`, 'm');
|
|
189
|
+
const other = elsewhere.find((f) => re.test(read(root, f)));
|
|
190
|
+
if (other)
|
|
191
|
+
keptPackages.push({ name, why: `also named in ${other}` });
|
|
192
|
+
else
|
|
193
|
+
packages.push({ name, why: `only ${apps.map((a) => a.name).join(', ')} use it` });
|
|
194
|
+
}
|
|
195
|
+
// npm scripts: those for the apps only.
|
|
196
|
+
const scripts = {};
|
|
197
|
+
const sharedScripts = [];
|
|
198
|
+
const pkgScripts = isObject(pkg['scripts']) ? pkg['scripts'] : {};
|
|
199
|
+
const refers = (cmd, n, root_) => new RegExp(`(^|[\\s'"=/])${esc(n)}:`).test(cmd) || cmd.includes(`${root_}/`);
|
|
200
|
+
for (const [s, cmd] of Object.entries(pkgScripts)) {
|
|
201
|
+
if (typeof cmd !== 'string')
|
|
202
|
+
continue;
|
|
203
|
+
const mine = apps.some((a) => s.split(':').includes(a.name) || refers(cmd, a.name, a.root));
|
|
204
|
+
if (!mine)
|
|
205
|
+
continue;
|
|
206
|
+
const others = kept.some((k) => refers(cmd, k.name, k.root));
|
|
207
|
+
if (others)
|
|
208
|
+
sharedScripts.push(s);
|
|
209
|
+
else
|
|
210
|
+
scripts[s] = cmd;
|
|
211
|
+
}
|
|
212
|
+
// Mentions in CI files and the README (listed, not edited).
|
|
213
|
+
const mentions = [];
|
|
214
|
+
const ciFiles = [
|
|
215
|
+
'README.md',
|
|
216
|
+
'Jenkinsfile',
|
|
217
|
+
...(fs.existsSync(path.join(root, '.github/workflows'))
|
|
218
|
+
? fs.readdirSync(path.join(root, '.github/workflows')).map((f) => `.github/workflows/${f}`)
|
|
219
|
+
: []),
|
|
220
|
+
];
|
|
221
|
+
for (const f of ciFiles) {
|
|
222
|
+
read(root, f)
|
|
223
|
+
.split('\n')
|
|
224
|
+
.forEach((line, i) => {
|
|
225
|
+
if (apps.some((a) => new RegExp(`(^|[^\\w-])${esc(a.name)}([^\\w-]|$)`).test(line))) {
|
|
226
|
+
mentions.push(`${f}:${i + 1}: ${line.trim().slice(0, 120)}`);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
apps,
|
|
232
|
+
scripts,
|
|
233
|
+
sharedScripts: sharedScripts.sort(),
|
|
234
|
+
packages,
|
|
235
|
+
keptPackages,
|
|
236
|
+
libsOnlyHere,
|
|
237
|
+
dependents,
|
|
238
|
+
mentions,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
exports.planRemoval = planRemoval;
|
|
242
|
+
/** The plan as lines for the console. */
|
|
243
|
+
function describePlan(plan) {
|
|
244
|
+
const out = [];
|
|
245
|
+
for (const a of plan.apps) {
|
|
246
|
+
out.push(`Remove app ${a.name}:`);
|
|
247
|
+
for (const d of [a.root, ...a.extraDirs])
|
|
248
|
+
out.push(` delete ${d}/`);
|
|
249
|
+
for (const f of a.files)
|
|
250
|
+
out.push(` delete ${f}`);
|
|
251
|
+
for (const d of a.dist)
|
|
252
|
+
out.push(` delete ${d}/ (build output)`);
|
|
253
|
+
for (const al of a.aliases)
|
|
254
|
+
out.push(` tsconfig.base.json: path ${al}`);
|
|
255
|
+
out.push(` nx.json: pstack.envEncryption.keys.${a.envProject} (if set)`);
|
|
256
|
+
}
|
|
257
|
+
const scripts = Object.keys(plan.scripts);
|
|
258
|
+
if (scripts.length > 0)
|
|
259
|
+
out.push(`npm scripts removed: ${scripts.join(', ')}`);
|
|
260
|
+
if (plan.packages.length > 0) {
|
|
261
|
+
out.push('npm packages uninstalled:');
|
|
262
|
+
for (const p of plan.packages)
|
|
263
|
+
out.push(` ${p.name} (${p.why})`);
|
|
264
|
+
}
|
|
265
|
+
if (plan.keptPackages.length > 0) {
|
|
266
|
+
out.push('npm packages kept:');
|
|
267
|
+
for (const p of plan.keptPackages)
|
|
268
|
+
out.push(` ${p.name} (${p.why})`);
|
|
269
|
+
}
|
|
270
|
+
if (plan.libsOnlyHere.length > 0) {
|
|
271
|
+
out.push(`Libraries only these apps used (kept; retire them yourself if unused): ${plan.libsOnlyHere.join(', ')}`);
|
|
272
|
+
}
|
|
273
|
+
if (plan.sharedScripts.length > 0) {
|
|
274
|
+
out.push(`npm scripts kept (they name other projects too): ${plan.sharedScripts.join(', ')}`);
|
|
275
|
+
}
|
|
276
|
+
if (plan.mentions.length > 0) {
|
|
277
|
+
out.push('Mentions to update by hand:');
|
|
278
|
+
for (const m of plan.mentions)
|
|
279
|
+
out.push(` ${m}`);
|
|
280
|
+
}
|
|
281
|
+
if (plan.dependents.length > 0) {
|
|
282
|
+
out.push('Projects that depend on these apps:');
|
|
283
|
+
for (const d of plan.dependents)
|
|
284
|
+
out.push(` ${d}`);
|
|
285
|
+
}
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
exports.describePlan = describePlan;
|
|
289
|
+
/** The plan's file changes on a tree (folders, tsconfig paths, npm scripts, nx.json keys). */
|
|
290
|
+
function applyRemoval(tree, plan) {
|
|
291
|
+
for (const a of plan.apps) {
|
|
292
|
+
for (const d of [a.root, ...a.extraDirs])
|
|
293
|
+
tree.delete(d);
|
|
294
|
+
for (const f of a.files)
|
|
295
|
+
tree.delete(f);
|
|
296
|
+
}
|
|
297
|
+
const edit = (file, fn) => {
|
|
298
|
+
if (!tree.exists(file))
|
|
299
|
+
return;
|
|
300
|
+
const json = JSON.parse(tree.read(file, 'utf8') ?? '{}');
|
|
301
|
+
const before = JSON.stringify(json);
|
|
302
|
+
fn(json);
|
|
303
|
+
if (JSON.stringify(json) !== before)
|
|
304
|
+
tree.write(file, JSON.stringify(json, null, 2) + '\n');
|
|
305
|
+
};
|
|
306
|
+
edit('tsconfig.base.json', (json) => {
|
|
307
|
+
const co = json['compilerOptions'];
|
|
308
|
+
if (!isObject(co) || !isObject(co['paths']))
|
|
309
|
+
return;
|
|
310
|
+
for (const a of plan.apps)
|
|
311
|
+
for (const al of a.aliases)
|
|
312
|
+
delete co['paths'][al];
|
|
313
|
+
});
|
|
314
|
+
edit('package.json', (json) => {
|
|
315
|
+
if (!isObject(json['scripts']))
|
|
316
|
+
return;
|
|
317
|
+
for (const s of Object.keys(plan.scripts))
|
|
318
|
+
delete json['scripts'][s];
|
|
319
|
+
});
|
|
320
|
+
edit('nx.json', (json) => {
|
|
321
|
+
const enc = isObject(json['pstack']) ? json['pstack']['envEncryption'] : undefined;
|
|
322
|
+
const keys = isObject(enc) ? enc['keys'] : undefined;
|
|
323
|
+
if (!isObject(keys))
|
|
324
|
+
return;
|
|
325
|
+
for (const a of plan.apps)
|
|
326
|
+
delete keys[a.envProject];
|
|
327
|
+
});
|
|
328
|
+
(0, llm_block_1.refreshLlmBlocks)(tree);
|
|
329
|
+
}
|
|
330
|
+
exports.applyRemoval = applyRemoval;
|
|
331
|
+
/** pstack remove --app=<a,b> [--dry-run] [--yes] [--force] */
|
|
332
|
+
async function runRemove(ctx, deps = upgrade_1.defaultUpgradeDeps) {
|
|
333
|
+
const root = (0, context_1.findWorkspaceRoot)(ctx.cwd);
|
|
334
|
+
if (!root)
|
|
335
|
+
throw new types_1.CliError('run "pstack remove" inside an Nx workspace.');
|
|
336
|
+
if (ctx.flags['app'] === true || !(0, args_1.flagString)(ctx.flags, 'app')) {
|
|
337
|
+
throw new types_1.CliError('pass the apps to retire: pstack remove --app=<name>[,<name>…]');
|
|
338
|
+
}
|
|
339
|
+
const names = [
|
|
340
|
+
...new Set(((0, args_1.flagString)(ctx.flags, 'app') ?? '')
|
|
341
|
+
.split(',')
|
|
342
|
+
.map((s) => s.trim())
|
|
343
|
+
.filter(Boolean)),
|
|
344
|
+
];
|
|
345
|
+
const plan = planRemoval(root, names);
|
|
346
|
+
for (const line of describePlan(plan))
|
|
347
|
+
deps.log(line);
|
|
348
|
+
if (plan.dependents.length > 0 && !(0, args_1.flagBoolean)(ctx.flags, 'force')) {
|
|
349
|
+
throw new types_1.CliError('other projects depend on these apps (listed above); fix them, or pass --force to remove anyway.');
|
|
350
|
+
}
|
|
351
|
+
if (ctx.dryRun) {
|
|
352
|
+
deps.log('\nDry run: nothing was changed.');
|
|
353
|
+
return 0;
|
|
354
|
+
}
|
|
355
|
+
const status = deps.gitStatus(root);
|
|
356
|
+
if (status === null)
|
|
357
|
+
throw new types_1.CliError('pstack remove needs a git repository (one commit).');
|
|
358
|
+
if (status.trim() !== '')
|
|
359
|
+
throw new types_1.CliError('commit or stash your changes first.');
|
|
360
|
+
if (!(0, args_1.flagBoolean)(ctx.flags, 'yes')) {
|
|
361
|
+
if (!deps.interactive)
|
|
362
|
+
throw new types_1.CliError('pass --yes to remove without asking.');
|
|
363
|
+
const prompter = deps.prompter();
|
|
364
|
+
const answer = await prompter.ask(`\nRemove ${names.join(', ')}? (yes/no)`, 'no');
|
|
365
|
+
prompter.close();
|
|
366
|
+
if (!/^y(es)?$/i.test(answer)) {
|
|
367
|
+
deps.log('Nothing removed.');
|
|
368
|
+
return 1;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// The last commit that still has the app, easy to find later.
|
|
372
|
+
for (const n of names) {
|
|
373
|
+
const tag = `retired/${n}`;
|
|
374
|
+
const exists = deps.capture?.('git', ['tag', '--list', tag], root).trim() === tag;
|
|
375
|
+
if (exists)
|
|
376
|
+
deps.log(` tag ${tag} exists already; not moved`);
|
|
377
|
+
else
|
|
378
|
+
deps.exec('git', ['tag', tag], root);
|
|
379
|
+
}
|
|
380
|
+
await (0, run_tree_1.runInTree)(root, { dryRun: false, verbose: ctx.verbose, quietWhenUnchanged: true }, (tree) => applyRemoval(tree, plan));
|
|
381
|
+
for (const a of plan.apps) {
|
|
382
|
+
for (const d of a.dist)
|
|
383
|
+
fs.rmSync(path.join(root, d), { recursive: true, force: true });
|
|
384
|
+
}
|
|
385
|
+
if (plan.packages.length > 0) {
|
|
386
|
+
deps.exec('npm', ['uninstall', ...plan.packages.map((p) => p.name)], root);
|
|
387
|
+
}
|
|
388
|
+
deps.exec('git', ['add', '-A'], root);
|
|
389
|
+
const body = [
|
|
390
|
+
...(plan.packages.length > 0
|
|
391
|
+
? [`npm packages uninstalled: ${plan.packages.map((p) => p.name).join(', ')}`]
|
|
392
|
+
: []),
|
|
393
|
+
...(plan.libsOnlyHere.length > 0
|
|
394
|
+
? [`Libraries only it used: ${plan.libsOnlyHere.join(', ')}`]
|
|
395
|
+
: []),
|
|
396
|
+
`The app is at tag ${names.map((n) => `retired/${n}`).join(', ')}.`,
|
|
397
|
+
];
|
|
398
|
+
deps.exec('git', [
|
|
399
|
+
'commit',
|
|
400
|
+
'-m',
|
|
401
|
+
`chore: remove app ${names.join(', ')} (pstack remove)`,
|
|
402
|
+
'-m',
|
|
403
|
+
body.join('\n'),
|
|
404
|
+
], root);
|
|
405
|
+
deps.log(`\n✔ Removed ${names.join(', ')}. Undo with: git revert HEAD`);
|
|
406
|
+
return 0;
|
|
407
|
+
}
|
|
408
|
+
exports.runRemove = runRemove;
|
|
409
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../src/cli/commands/remove.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAI7B,yDAA6D;AAC7D,kCAAkD;AAClD,wCAA+C;AAC/C,0CAAwC;AACxC,oCAAoD;AACpD,uCAA4D;AAC5D,6DAAyE;AAWzE,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,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AAErE,4FAA4F;AAC5F,MAAM,YAAY,GAAG;IACnB,aAAa;IACb,oBAAoB;IACpB,QAAQ;IACR,UAAU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UpgradeDeps {
|
|
|
23
23
|
prompter(): Prompter;
|
|
24
24
|
log(line: string): void;
|
|
25
25
|
}
|
|
26
|
+
export declare const defaultUpgradeDeps: UpgradeDeps;
|
|
26
27
|
type Json = Record<string, unknown>;
|
|
27
28
|
/** Declared version of a package in dependencies, devDependencies or optionalDependencies. */
|
|
28
29
|
export declare function declared(pkg: Json, name: string): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runUpgradeNx = exports.nxStepPlan = exports.workspaceNxMajor = exports.runUpgrade = exports.stepPlan = exports.repairHttpClientModule = exports.pinNode = exports.pinCapacitor = exports.capacitorApps = exports.buildPackageSpecs = exports.frameworkPatchSpecs = exports.workspaceAngularMajor = exports.declared = void 0;
|
|
3
|
+
exports.runUpgradeNx = exports.nxStepPlan = exports.workspaceNxMajor = exports.runUpgrade = exports.stepPlan = exports.repairHttpClientModule = exports.pinNode = exports.pinCapacitor = exports.capacitorApps = exports.buildPackageSpecs = exports.frameworkPatchSpecs = exports.workspaceAngularMajor = exports.declared = exports.defaultUpgradeDeps = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const fs = tslib_1.__importStar(require("fs"));
|
|
@@ -19,7 +19,7 @@ const types_1 = require("../types");
|
|
|
19
19
|
const versions_1 = require("../versions");
|
|
20
20
|
const upgrade_standalone_1 = require("./upgrade-standalone");
|
|
21
21
|
const useShell = (cmd) => process.platform === 'win32' && (cmd === 'npm' || cmd === 'npx');
|
|
22
|
-
|
|
22
|
+
exports.defaultUpgradeDeps = {
|
|
23
23
|
exec(cmd, args, cwd, env) {
|
|
24
24
|
const r = (0, child_process_1.spawnSync)(cmd, args, {
|
|
25
25
|
cwd,
|
|
@@ -556,7 +556,7 @@ function runStep(o, deps) {
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
/** pstack upgrade angular [--to=N] [--yes] [--skip-check] [--no-commit] [--dry-run] */
|
|
559
|
-
async function runUpgrade(ctx, deps =
|
|
559
|
+
async function runUpgrade(ctx, deps = exports.defaultUpgradeDeps) {
|
|
560
560
|
const what = ctx.positionals[0];
|
|
561
561
|
if (what === 'nx')
|
|
562
562
|
return runUpgradeNx(ctx, deps);
|
|
@@ -741,7 +741,7 @@ function runNxStep(o, deps) {
|
|
|
741
741
|
* pstack upgrade nx [--to=16|17] [--skip-check] [--no-commit] [--dry-run]: moves an Nx 15 or 16
|
|
742
742
|
* workspace to Nx 17 (where the plugin loads), one major per commit, Angular unchanged.
|
|
743
743
|
*/
|
|
744
|
-
async function runUpgradeNx(ctx, deps =
|
|
744
|
+
async function runUpgradeNx(ctx, deps = exports.defaultUpgradeDeps) {
|
|
745
745
|
const root = (0, context_1.findWorkspaceRoot)(ctx.cwd);
|
|
746
746
|
if (!root || !fs.existsSync(path.join(root, 'package.json'))) {
|
|
747
747
|
throw new types_1.CliError('run "pstack upgrade nx" inside an Nx workspace (nx.json, package.json).');
|