@git.zone/cli 2.23.0 → 2.25.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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/gitzone.cli.js +11 -2
- package/dist_ts/mod_services/classes.dockercontainer.d.ts +81 -0
- package/dist_ts/mod_services/classes.dockercontainer.js +205 -10
- package/dist_ts/mod_services/classes.globalregistry.d.ts +10 -0
- package/dist_ts/mod_services/classes.globalregistry.js +23 -1
- package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +52 -1
- package/dist_ts/mod_services/classes.serviceconfiguration.js +116 -20
- package/dist_ts/mod_services/classes.servicedatamarker.d.ts +93 -0
- package/dist_ts/mod_services/classes.servicedatamarker.js +166 -0
- package/dist_ts/mod_services/classes.servicemanager.d.ts +91 -5
- package/dist_ts/mod_services/classes.servicemanager.js +274 -64
- package/dist_ts/mod_services/classes.serviceoptions.d.ts +58 -0
- package/dist_ts/mod_services/classes.serviceoptions.js +93 -0
- package/dist_ts/mod_services/classes.servicepruner.d.ts +102 -0
- package/dist_ts/mod_services/classes.servicepruner.js +410 -0
- package/dist_ts/mod_services/helpers.d.ts +15 -0
- package/dist_ts/mod_services/helpers.js +57 -1
- package/dist_ts/mod_services/index.js +307 -53
- package/dist_ts/mod_tools/classes.packagemanager.d.ts +13 -0
- package/dist_ts/mod_tools/classes.packagemanager.js +42 -1
- package/dist_ts/mod_tools/index.js +4 -1
- package/package.json +3 -2
- package/readme.hints.md +105 -0
- package/readme.md +123 -5
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/gitzone.cli.ts +10 -0
- package/ts/mod_services/classes.dockercontainer.ts +244 -13
- package/ts/mod_services/classes.globalregistry.ts +27 -0
- package/ts/mod_services/classes.serviceconfiguration.ts +148 -27
- package/ts/mod_services/classes.servicedatamarker.ts +228 -0
- package/ts/mod_services/classes.servicemanager.ts +394 -72
- package/ts/mod_services/classes.serviceoptions.ts +135 -0
- package/ts/mod_services/classes.servicepruner.ts +532 -0
- package/ts/mod_services/helpers.ts +60 -0
- package/ts/mod_services/index.ts +437 -58
- package/ts/mod_tools/classes.packagemanager.ts +54 -0
- package/ts/mod_tools/index.ts +5 -0
|
@@ -35,6 +35,11 @@ export interface ILegacyCleanupResult {
|
|
|
35
35
|
globalDir: string;
|
|
36
36
|
deleted: boolean;
|
|
37
37
|
reason?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Managed packages removed from a legacy root that itself had to be kept.
|
|
40
|
+
* Each entry is `name@version` of an inert copy that nothing resolves to.
|
|
41
|
+
*/
|
|
42
|
+
stalePackagesRemoved?: string[];
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export interface IShimSyncResult {
|
|
@@ -179,9 +184,18 @@ export class PackageManagerUtil {
|
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
if (!legacyRoot.safeToDelete) {
|
|
187
|
+
// The root must stay, but the managed copies inside it are inert: the
|
|
188
|
+
// current global root already provides those packages and no shim
|
|
189
|
+
// resolves here. Leaving them behind makes the directory look like the
|
|
190
|
+
// installed version, which misleads anyone inspecting it.
|
|
191
|
+
const stalePackagesRemoved = await this.removeStaleManagedPackages(
|
|
192
|
+
legacyRoot,
|
|
193
|
+
currentPackageNames,
|
|
194
|
+
);
|
|
182
195
|
cleanupResults.push({
|
|
183
196
|
globalDir: legacyRoot.globalDir,
|
|
184
197
|
deleted: false,
|
|
198
|
+
stalePackagesRemoved,
|
|
185
199
|
reason:
|
|
186
200
|
legacyRoot.unmanagedPackageNames.length > 0
|
|
187
201
|
? `kept because it also contains ${legacyRoot.unmanagedPackageNames.join(", ")}`
|
|
@@ -231,6 +245,46 @@ export class PackageManagerUtil {
|
|
|
231
245
|
return cleanupResults;
|
|
232
246
|
}
|
|
233
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Remove managed package copies from a legacy global root that has to be kept.
|
|
250
|
+
*
|
|
251
|
+
* Only removes a package when the active global root already provides it and
|
|
252
|
+
* no command shim points into this legacy root, so nothing that currently
|
|
253
|
+
* resolves can be affected. Fails closed: any doubt leaves the copy in place.
|
|
254
|
+
*/
|
|
255
|
+
private async removeStaleManagedPackages(
|
|
256
|
+
legacyRootArg: ILegacyGlobalRootInfo,
|
|
257
|
+
currentPackageNamesArg: Set<string>,
|
|
258
|
+
): Promise<string[]> {
|
|
259
|
+
const shimReferences = await this.getShimReferences(legacyRootArg.globalDir);
|
|
260
|
+
if (shimReferences === null || shimReferences.length > 0) {
|
|
261
|
+
// PNPM_HOME unknown, or something still resolves here.
|
|
262
|
+
return [];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const removed: string[] = [];
|
|
266
|
+
for (const packageInfo of legacyRootArg.packages) {
|
|
267
|
+
if (!packageInfo.packagePath) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (!currentPackageNamesArg.has(packageInfo.name)) {
|
|
271
|
+
// Not provided by the active root — removing it would lose the package.
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
await plugins.fs.rm(packageInfo.packagePath, {
|
|
276
|
+
recursive: true,
|
|
277
|
+
force: true,
|
|
278
|
+
});
|
|
279
|
+
removed.push(`${packageInfo.name}@${packageInfo.version}`);
|
|
280
|
+
} catch {
|
|
281
|
+
// Leave it rather than half-removing it.
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return removed;
|
|
286
|
+
}
|
|
287
|
+
|
|
234
288
|
public async syncCurrentGlobalShims(): Promise<IShimSyncResult[]> {
|
|
235
289
|
const pnpmShimDirs = await this.getPnpmShimDirs();
|
|
236
290
|
if (!pnpmShimDirs) {
|
package/ts/mod_tools/index.ts
CHANGED
|
@@ -485,6 +485,11 @@ async function cleanupLegacyInstalls(
|
|
|
485
485
|
console.log(
|
|
486
486
|
` ${cleanupResult.globalDir} kept (${cleanupResult.reason || "unknown reason"})`,
|
|
487
487
|
);
|
|
488
|
+
for (const stalePackage of cleanupResult.stalePackagesRemoved || []) {
|
|
489
|
+
console.log(
|
|
490
|
+
` removed stale inert copy ${stalePackage} (the active global root provides it)`,
|
|
491
|
+
);
|
|
492
|
+
}
|
|
488
493
|
}
|
|
489
494
|
}
|
|
490
495
|
console.log("");
|