ppcos 1.6.1 → 1.6.2
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/lib/commands/update.js +3 -1
- package/lib/utils/fs-helpers.js +8 -2
- package/lib/utils/migrations.js +28 -0
- package/package.json +1 -1
package/lib/commands/update.js
CHANGED
|
@@ -33,7 +33,9 @@ import updateHub from './update-hub.js';
|
|
|
33
33
|
|
|
34
34
|
// Directories to exclude when enumerating client template files.
|
|
35
35
|
// hub-base/ contains hub-level skills that are handled separately.
|
|
36
|
-
|
|
36
|
+
// node_modules is also hard-excluded inside getAllFiles(), but stays listed
|
|
37
|
+
// here so this set matches init-all's and doesn't rely on that backstop.
|
|
38
|
+
const CLIENT_TEMPLATE_EXCLUDE_DIRS = new Set(['tmp', 'node_modules', 'hub-base']);
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* Update a single client
|
package/lib/utils/fs-helpers.js
CHANGED
|
@@ -12,6 +12,12 @@ import { constants } from 'node:fs';
|
|
|
12
12
|
// that must never be distributed to clients.
|
|
13
13
|
const EXCLUDED_DIR_NAMES = new Set(['tmp', 'node_modules']);
|
|
14
14
|
|
|
15
|
+
// Excluded even when callers pass a custom excludeDirs set. Vendored
|
|
16
|
+
// dependencies must never be enumerated into manifests or client copies —
|
|
17
|
+
// a custom set that silently dropped the node_modules default once
|
|
18
|
+
// registered ~9.5k dependency files as managed in every client.
|
|
19
|
+
const ALWAYS_EXCLUDED_DIR_NAMES = new Set(['node_modules']);
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* Check if a file exists (async)
|
|
17
23
|
* @param {string} filePath - Path to check
|
|
@@ -48,7 +54,7 @@ export async function getAllFiles(dir, baseDir = dir, excludeDirs = EXCLUDED_DIR
|
|
|
48
54
|
for (const entry of entries) {
|
|
49
55
|
const fullPath = join(dir, entry.name);
|
|
50
56
|
if (entry.isDirectory()) {
|
|
51
|
-
if (excludeDirs.has(entry.name)) continue;
|
|
57
|
+
if (excludeDirs.has(entry.name) || ALWAYS_EXCLUDED_DIR_NAMES.has(entry.name)) continue;
|
|
52
58
|
files.push(...await getAllFiles(fullPath, baseDir, excludeDirs));
|
|
53
59
|
} else {
|
|
54
60
|
files.push(relative(baseDir, fullPath).replace(/\\/g, '/'));
|
|
@@ -71,7 +77,7 @@ export function getAllFilesSync(dir, baseDir = dir, excludeDirs = EXCLUDED_DIR_N
|
|
|
71
77
|
for (const entry of entries) {
|
|
72
78
|
const fullPath = join(dir, entry.name);
|
|
73
79
|
if (entry.isDirectory()) {
|
|
74
|
-
if (excludeDirs.has(entry.name)) continue;
|
|
80
|
+
if (excludeDirs.has(entry.name) || ALWAYS_EXCLUDED_DIR_NAMES.has(entry.name)) continue;
|
|
75
81
|
files.push(...getAllFilesSync(fullPath, baseDir, excludeDirs));
|
|
76
82
|
} else {
|
|
77
83
|
files.push(relative(baseDir, fullPath).replace(/\\/g, '/'));
|
package/lib/utils/migrations.js
CHANGED
|
@@ -240,6 +240,33 @@ export function migrateTmpDataFiles(clientDir, manifest) {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
/**
|
|
244
|
+
* One-time migration: drop vendored node_modules entries from the manifest.
|
|
245
|
+
*
|
|
246
|
+
* A dev-mode (PPCOS_DEV) update enumerated the local template with a custom
|
|
247
|
+
* exclude set that overrode getAllFiles()'s default node_modules exclusion,
|
|
248
|
+
* registering ~9.5k dependency files as managed in every client. Those
|
|
249
|
+
* entries inflate the expected-file count that update.js's incomplete-download
|
|
250
|
+
* guard compares against, so every subsequent update against the real API
|
|
251
|
+
* zip (which never contains node_modules) aborts before the orphan cleanup
|
|
252
|
+
* that would remove them — a deadlock only fixable here, before the guard.
|
|
253
|
+
*
|
|
254
|
+
* Manifest-only: files on disk are left in place because skill scripts need
|
|
255
|
+
* them at runtime. They become untracked, same as a user-run `npm install`.
|
|
256
|
+
*/
|
|
257
|
+
export function migrateNodeModulesManifestEntries(manifest) {
|
|
258
|
+
let removed = 0;
|
|
259
|
+
for (const path of Object.keys(manifest.managedFiles)) {
|
|
260
|
+
if (path.split('/').includes('node_modules')) {
|
|
261
|
+
delete manifest.managedFiles[path];
|
|
262
|
+
removed++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (removed > 0) {
|
|
266
|
+
logger.info(` Untracked ${removed} vendored node_modules manifest entr${removed !== 1 ? 'ies' : 'y'}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
243
270
|
/**
|
|
244
271
|
* Run all client migrations in order.
|
|
245
272
|
* @param {string} clientDir - Path to client directory
|
|
@@ -253,4 +280,5 @@ export async function runAllMigrations(clientDir, manifest) {
|
|
|
253
280
|
migrateManifestKeys(manifest);
|
|
254
281
|
migrateConfigManagedTypes(manifest);
|
|
255
282
|
migrateTmpDataFiles(clientDir, manifest);
|
|
283
|
+
migrateNodeModulesManifestEntries(manifest);
|
|
256
284
|
}
|