@git.zone/cli 7.1.1 → 7.2.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/assets/templates/ci_default/.gitea/workflows/default_nottags.yaml +5 -0
- package/assets/templates/ci_default/.gitea/workflows/default_tags.yaml +5 -0
- package/assets/templates/ci_docker/.gitea/workflows/docker_nottags.yaml +5 -0
- package/assets/templates/ci_docker/.gitea/workflows/docker_tags.yaml +5 -0
- package/assets/templates/npm/.package.json +1 -1
- package/assets/templates/npm/.smartscaf.yml +1 -1
- package/assets/templates/service/.package.json +1 -1
- package/assets/templates/wcc/.package.json +1 -1
- package/assets/templates/wcc/.smartscaf.yml +3 -1
- package/assets/templates/website/.package.json +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/gitzone.cli.js +3 -3
- package/dist_ts/helpers.climode.d.ts +0 -1
- package/dist_ts/helpers.climode.js +2 -30
- package/dist_ts/helpers.smartconfigmigrations.js +29 -51
- package/dist_ts/helpers.workflow.js +2 -3
- package/dist_ts/mod_config/index.js +78 -10
- package/package.json +6 -19
- package/readme.md +2 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/gitzone.cli.ts +2 -7
- package/ts/helpers.climode.ts +1 -34
- package/ts/helpers.smartconfigmigrations.ts +30 -55
- package/ts/helpers.workflow.ts +1 -2
- package/ts/mod_config/index.ts +98 -11
package/readme.md
CHANGED
|
@@ -848,7 +848,7 @@ gitzone config access public
|
|
|
848
848
|
gitzone config migrate 2
|
|
849
849
|
```
|
|
850
850
|
|
|
851
|
-
`@ship.zone/szci` belongs to szci, which GitZone no longer uses or reads. `gitzone config migrate` and `gitzone format` remove
|
|
851
|
+
`@ship.zone/szci` belongs to szci, which GitZone no longer uses or reads. `gitzone config migrate` and `gitzone format` remove only an empty `npmGlobalTools` list, szci's default, and delete a block left empty; every other key stays. szci still reads two keys, and no migration deletes or moves them. `npmRegistryUrl` is the registry `szci npm prepare` installs from, for example in a Dockerfile that installs private packages. It is not a publish registry, even when `release.targets.npm.registries` lists the same URL, so no migration, the one from schema 1 included, moves or copies it into the publish registries: a registry list alone enables the npm target. `npmAccessLevel` is the access level `szci git mirror` checks. GitZone publishes with `release.targets.npm.accessLevel`, so the migration copies `npmAccessLevel` there when that key is absent and keeps it in the block: the duplicate is deliberate. `gitzone config doctor` names the current home of each kept key GitZone once read, for example `@git.zone/tsdocker.registryRepoMap` for `dockerRegistryRepoMap` and `@git.zone/tsdocker.buildArgEnvMap` for `dockerBuildargEnvMap`, and reports `npmRegistryUrl` and `npmAccessLevel` as szci's own. A block that holds only these two keys needs no step once `release.targets.npm.accessLevel` is set.
|
|
852
852
|
|
|
853
853
|
### Managed Assets
|
|
854
854
|
|
|
@@ -1034,7 +1034,7 @@ Formatters include cleanup, smartconfig normalization, dependency license checks
|
|
|
1034
1034
|
|
|
1035
1035
|
The template formatter owns `.vscode/settings.json` and `.vscode/launch.json` in every project, and the Gitea workflows, CLI entry points and HTML entry files of the project types that declare them. Workflow and entry files are written from the template as a whole. The formatter never creates or changes a `Dockerfile` or `.dockerignore`: they describe the project's own image. `gitzone template service` and `gitzone template website` scaffold a first pnpm-based Dockerfile.
|
|
1036
1036
|
|
|
1037
|
-
The Gitea workflows verify and never publish. npm and wcc projects get `default_nottags.yaml` and `default_tags.yaml`, service and website projects `docker_nottags.yaml` and `docker_tags.yaml`. Each runs in `code.foss.global/host.today/ht-docker-node:latest`: a pinned checkout that keeps no credentials, then `pnpm --version`, `pnpm install --frozen-lockfile`, `pnpm build` and `pnpm test`. No setup action installs pnpm: the image's pnpm switches to the version that `package.json` pins in `packageManager`, pnpm 10 included, so the printed version is the one that installs, builds and
|
|
1037
|
+
The Gitea workflows verify and never publish. npm and wcc projects get `default_nottags.yaml` and `default_tags.yaml`, service and website projects `docker_nottags.yaml` and `docker_tags.yaml`. Each runs in `code.foss.global/host.today/ht-docker-node:latest`: a pinned checkout that keeps no credentials, then `pnpm --version`, `pnpm install --frozen-lockfile`, `pnpm build`, `pnpm test` and `pnpm audit --prod --audit-level=high --registry=https://registry.npmjs.org`. The audit fails the workflow when a production dependency has a high or critical advisory; development dependencies do not ship and are not audited. It asks registry.npmjs.org because a private registry may not serve the advisory endpoint, and it runs last, so a newly published advisory never hides a test result. pnpm 12 skips an advisory you have reviewed and accepted when `pnpm-workspace.yaml` lists its GHSA ID under `auditConfig.ignoreGhsas`. No setup action installs pnpm: the image's pnpm switches to the version that `package.json` pins in `packageManager`, pnpm 10 included, so the printed version is the one that installs, builds, tests and audits. The switch downloads that version from the npm registry, so the runner needs registry access, which the install needs anyway. They use no secrets and build no images; a tag workflow verifies the tagged commit, and `gitzone release` publishes packages and images. The two `.vscode` files are merged at the top level instead: every key the template declares is refreshed, and every other top-level key — an editor setting only your project has, such as `deno.enable` — is kept. Two limits follow from that. A key the template itself declares is taken as a whole, so an array such as `json.schemas` or `configurations` is replaced rather than unioned, and a merged file is re-serialized with two-space indentation, so a project that keeps its own key loses hand-made formatting in those two files. A `.vscode` file that is not valid JSON cannot be merged and is replaced by the template as a whole. That never happens silently: the plan line reads `Replace .vscode/settings.json: the current file is not valid JSON (…)` instead of the usual `Apply template …`, and the run prints a warning that keys only your project declares are lost. Both appear in `gitzone format`, `gitzone format check` and `gitzone format plan --json`, so you see them before confirming a write.
|
|
1038
1038
|
|
|
1039
1039
|
`gitzone format fix` intentionally lives outside the default format path. Normal format runs stay deterministic; the fix command uses opencode only after deterministic formatters have done what they can.
|
|
1040
1040
|
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@git.zone/cli',
|
|
6
|
-
version: '7.
|
|
6
|
+
version: '7.2.0',
|
|
7
7
|
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
|
8
8
|
}
|
package/ts/gitzone.cli.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as plugins from "./plugins.js";
|
|
2
2
|
import * as paths from "./paths.js";
|
|
3
|
-
import {
|
|
4
|
-
getProcessUserArgv,
|
|
5
|
-
getRawCliMode,
|
|
6
|
-
parseCliArgv,
|
|
7
|
-
printJson,
|
|
8
|
-
} from "./helpers.climode.js";
|
|
3
|
+
import { getRawCliMode, parseCliArgv, printJson } from "./helpers.climode.js";
|
|
9
4
|
import { commitinfo } from "./00_commitinfo_data.js";
|
|
10
5
|
|
|
11
6
|
const runParsedCommand = async (argvArg: any): Promise<void> => {
|
|
@@ -134,7 +129,7 @@ export let run = async () => {
|
|
|
134
129
|
if (rawCliMode.output === "human") {
|
|
135
130
|
console.log("---------------------------------------------");
|
|
136
131
|
}
|
|
137
|
-
const argvArg = parseCliArgv(
|
|
132
|
+
const argvArg = parseCliArgv(process.argv.slice(2));
|
|
138
133
|
if (argvArg.v || argvArg.version) {
|
|
139
134
|
if (rawCliMode.output === "json") {
|
|
140
135
|
printJson({ version: packageVersion, resolvedFrom: paths.packageDir });
|
package/ts/helpers.climode.ts
CHANGED
|
@@ -172,39 +172,6 @@ const parseRawArgv = (argv: string[]): TArgSource => {
|
|
|
172
172
|
|
|
173
173
|
export const parseCliArgv = parseRawArgv;
|
|
174
174
|
|
|
175
|
-
export const getProcessUserArgv = (): string[] => {
|
|
176
|
-
const rawArgv = process.argv;
|
|
177
|
-
const argv0Base = (rawArgv[0] || "").split(/[\\/]/).pop()?.toLowerCase();
|
|
178
|
-
const runtimeNames = new Set([
|
|
179
|
-
"node",
|
|
180
|
-
"node.exe",
|
|
181
|
-
"nodejs",
|
|
182
|
-
"nodejs.exe",
|
|
183
|
-
"bun",
|
|
184
|
-
"bun.exe",
|
|
185
|
-
"deno",
|
|
186
|
-
"deno.exe",
|
|
187
|
-
"tsx",
|
|
188
|
-
"tsx.exe",
|
|
189
|
-
"ts-node",
|
|
190
|
-
"ts-node.exe",
|
|
191
|
-
]);
|
|
192
|
-
|
|
193
|
-
if (!runtimeNames.has(argv0Base || "")) {
|
|
194
|
-
return rawArgv.slice();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const firstUserArg = rawArgv[1] || "";
|
|
198
|
-
const firstUserArgLooksLikeScript =
|
|
199
|
-
firstUserArg.includes("/") ||
|
|
200
|
-
firstUserArg.endsWith(".js") ||
|
|
201
|
-
firstUserArg.endsWith(".ts") ||
|
|
202
|
-
firstUserArg.endsWith(".mjs") ||
|
|
203
|
-
firstUserArg.endsWith(".cjs");
|
|
204
|
-
|
|
205
|
-
return rawArgv.slice(firstUserArgLooksLikeScript ? 2 : 1);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
175
|
const normalizeOutputMode = (value: unknown): TCliOutputMode | undefined => {
|
|
209
176
|
if (value === "human" || value === "plain" || value === "json") {
|
|
210
177
|
return value;
|
|
@@ -288,7 +255,7 @@ export const getCliMode = async (
|
|
|
288
255
|
|
|
289
256
|
export const getRawCliMode = async (): Promise<ICliMode> => {
|
|
290
257
|
const cliConfig = await getCliModeConfig();
|
|
291
|
-
const rawArgv = parseRawArgv(
|
|
258
|
+
const rawArgv = parseRawArgv(process.argv.slice(2));
|
|
292
259
|
return resolveCliMode(rawArgv, cliConfig);
|
|
293
260
|
};
|
|
294
261
|
|
|
@@ -105,11 +105,15 @@ const resolveNpmTarget = (
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* gitzone neither writes nor reads the `@ship.zone/szci` namespace any more;
|
|
108
|
-
* the block belongs to szci. This removes
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* `
|
|
108
|
+
* the block belongs to szci. This removes only szci's default of no global
|
|
109
|
+
* tools and a block left empty. Every other key stays, and
|
|
110
|
+
* `gitzone config doctor` names its current home. szci still reads two keys,
|
|
111
|
+
* so neither is ever deleted or moved: `npmRegistryUrl` is the registry
|
|
112
|
+
* `szci npm prepare` installs from, not a publish registry even when the npm
|
|
113
|
+
* target lists the same URL, and `npmAccessLevel` is the access level
|
|
114
|
+
* `szci git mirror` checks. The access level is copied to the canonical
|
|
115
|
+
* `@git.zone/cli.release.targets.npm.accessLevel` when that key is absent,
|
|
116
|
+
* because gitzone publishes with the canonical one. Unlike `migrateToV2` the
|
|
113
117
|
* step is not tied to a schema version, because schema-2 configurations still
|
|
114
118
|
* carry the block; a second run changes nothing.
|
|
115
119
|
*/
|
|
@@ -129,34 +133,13 @@ const migrateShipzoneNamespace = (smartconfigJson: Record<string, any>): boolean
|
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
const accessLevel = shipzoneConfig.npmAccessLevel;
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
migrated = true;
|
|
140
|
-
}
|
|
141
|
-
} else if (canonicalAccessLevel === accessLevel) {
|
|
142
|
-
delete shipzoneConfig.npmAccessLevel;
|
|
143
|
-
migrated = true;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const registryUrl = shipzoneConfig.npmRegistryUrl;
|
|
148
|
-
if (typeof registryUrl === "string" && registryUrl.trim()) {
|
|
149
|
-
const registries = resolveNpmTarget(smartconfigJson, false)?.registries;
|
|
150
|
-
const alreadyListed =
|
|
151
|
-
Array.isArray(registries) &&
|
|
152
|
-
registries.some(
|
|
153
|
-
(registry: unknown) =>
|
|
154
|
-
typeof registry === "string" &&
|
|
155
|
-
registry.trim() !== "" &&
|
|
156
|
-
normalizeRegistryUrl(registry) === normalizeRegistryUrl(registryUrl),
|
|
157
|
-
);
|
|
158
|
-
if (alreadyListed) {
|
|
159
|
-
delete shipzoneConfig.npmRegistryUrl;
|
|
136
|
+
if (
|
|
137
|
+
(accessLevel === "public" || accessLevel === "private") &&
|
|
138
|
+
resolveNpmTarget(smartconfigJson, false)?.accessLevel === undefined
|
|
139
|
+
) {
|
|
140
|
+
const npmTarget = resolveNpmTarget(smartconfigJson, true);
|
|
141
|
+
if (npmTarget) {
|
|
142
|
+
npmTarget.accessLevel = accessLevel;
|
|
160
143
|
migrated = true;
|
|
161
144
|
}
|
|
162
145
|
}
|
|
@@ -215,27 +198,19 @@ const migrateToV2 = (smartconfigJson: Record<string, any>): boolean => {
|
|
|
215
198
|
migrated = true;
|
|
216
199
|
}
|
|
217
200
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const npmTarget = ensureObject(targets, "npm");
|
|
230
|
-
const registry = normalizeRegistryUrl(shipzoneConfig.npmRegistryUrl);
|
|
231
|
-
const registries = Array.isArray(npmTarget.registries) ? npmTarget.registries : [];
|
|
232
|
-
if (!registries.includes(registry)) {
|
|
233
|
-
registries.push(registry);
|
|
234
|
-
}
|
|
235
|
-
npmTarget.registries = registries;
|
|
236
|
-
delete shipzoneConfig.npmRegistryUrl;
|
|
237
|
-
migrated = true;
|
|
201
|
+
// Schema 1 fell back to szci's access level where the release configuration
|
|
202
|
+
// set none, so it is copied where the npm target has none. It also stays in
|
|
203
|
+
// the szci block, because `szci git mirror` reads it. szci's
|
|
204
|
+
// `npmRegistryUrl` is never copied: it is the registry `szci npm prepare`
|
|
205
|
+
// installs from, not a publish registry, and a registry list alone enables
|
|
206
|
+
// the npm target. As in schema 1, publish registries come only from the
|
|
207
|
+
// release configuration.
|
|
208
|
+
if (isPlainObject(shipzoneConfig) && shipzoneConfig.npmAccessLevel) {
|
|
209
|
+
const npmTarget = ensureObject(targets, "npm");
|
|
210
|
+
if (!npmTarget.accessLevel) {
|
|
211
|
+
npmTarget.accessLevel = shipzoneConfig.npmAccessLevel;
|
|
238
212
|
}
|
|
213
|
+
migrated = true;
|
|
239
214
|
}
|
|
240
215
|
|
|
241
216
|
if (Array.isArray(releaseConfig.steps)) {
|
|
@@ -322,8 +297,8 @@ export const migrateSmartconfigData = (
|
|
|
322
297
|
currentVersion = 2;
|
|
323
298
|
}
|
|
324
299
|
|
|
325
|
-
// Runs after migrateToV2,
|
|
326
|
-
//
|
|
300
|
+
// Runs after migrateToV2, so that the access level a schema-1 release
|
|
301
|
+
// configuration carries takes precedence over the copy of szci's.
|
|
327
302
|
if (targetVersion >= 2) {
|
|
328
303
|
migrated = migrateShipzoneNamespace(smartconfigJson) || migrated;
|
|
329
304
|
}
|
package/ts/helpers.workflow.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getCliConfigValue } from "./helpers.smartconfig.js";
|
|
2
|
-
import { getProcessUserArgv } from "./helpers.climode.js";
|
|
3
2
|
import { shouldCleanTestArtifactsOnRelease } from "./helpers.tstest.js";
|
|
4
3
|
import {
|
|
5
4
|
detectProjectType,
|
|
@@ -503,7 +502,7 @@ const readCliWorkflowConfig = async (): Promise<ICliWorkflowConfig> => {
|
|
|
503
502
|
};
|
|
504
503
|
|
|
505
504
|
const getOrderedArgsAfterCommand = (commandName: string): string[] => {
|
|
506
|
-
const rawArgs =
|
|
505
|
+
const rawArgs = process.argv.slice(2);
|
|
507
506
|
const commandIndex = rawArgs.indexOf(commandName);
|
|
508
507
|
if (commandIndex === -1) {
|
|
509
508
|
return rawArgs;
|
package/ts/mod_config/index.ts
CHANGED
|
@@ -1233,17 +1233,81 @@ async function collectDoctorFindings(): Promise<IDoctorFinding[]> {
|
|
|
1233
1233
|
* Where each key gitzone once read from `@ship.zone/szci` lives now.
|
|
1234
1234
|
*/
|
|
1235
1235
|
const shipzoneKeyHomes: Record<string, string> = {
|
|
1236
|
-
npmAccessLevel: `${CLI_NAMESPACE}.release.targets.npm.accessLevel`,
|
|
1237
|
-
npmRegistryUrl: `${CLI_NAMESPACE}.release.targets.npm.registries`,
|
|
1238
1236
|
dockerRegistryRepoMap: "@git.zone/tsdocker.registryRepoMap",
|
|
1239
1237
|
dockerBuildargEnvMap: "@git.zone/tsdocker.buildArgEnvMap",
|
|
1240
1238
|
npmGlobalTools: "the devDependencies of package.json",
|
|
1241
1239
|
};
|
|
1242
1240
|
|
|
1241
|
+
/**
|
|
1242
|
+
* Keys szci itself still reads, with what they are to szci. They stay in
|
|
1243
|
+
* `@ship.zone/szci` while a project runs szci, so the migration keeps them and
|
|
1244
|
+
* the doctor names no other home for them.
|
|
1245
|
+
*/
|
|
1246
|
+
const shipzoneSzciKeyRoles: Record<string, string> = {
|
|
1247
|
+
npmRegistryUrl:
|
|
1248
|
+
"is the registry `szci npm prepare` installs from and stays while szci reads it; it is not a publish registry",
|
|
1249
|
+
npmAccessLevel:
|
|
1250
|
+
"is szci's access level, which `szci git mirror` checks before it mirrors, and stays while szci reads it",
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
const isShipzoneSzciKey = (keyArg: string): boolean =>
|
|
1254
|
+
Object.hasOwn(shipzoneSzciKeyRoles, keyArg);
|
|
1255
|
+
|
|
1256
|
+
/** The access level gitzone publishes with, where the configuration sets one. */
|
|
1257
|
+
const getNpmTargetAccessLevel = (
|
|
1258
|
+
smartconfigDataArg: Record<string, any>,
|
|
1259
|
+
): unknown => smartconfigDataArg[CLI_NAMESPACE]?.release?.targets?.npm?.accessLevel;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Names a key szci reads as szci's own. szci's access level is also compared
|
|
1263
|
+
* with the one gitzone publishes with, which the migration copies from it
|
|
1264
|
+
* where that is unset: an equal value is a deliberate duplicate.
|
|
1265
|
+
*/
|
|
1266
|
+
function describeShipzoneSzciKey(
|
|
1267
|
+
keyArg: string,
|
|
1268
|
+
keptBlockArg: Record<string, any>,
|
|
1269
|
+
migratedDataArg: Record<string, any>,
|
|
1270
|
+
): string {
|
|
1271
|
+
const description = `${SHIPZONE_NAMESPACE}.${keyArg} ${shipzoneSzciKeyRoles[keyArg]}`;
|
|
1272
|
+
const publishAccessLevel = getNpmTargetAccessLevel(migratedDataArg);
|
|
1273
|
+
if (keyArg !== "npmAccessLevel" || publishAccessLevel === undefined) {
|
|
1274
|
+
return description;
|
|
1275
|
+
}
|
|
1276
|
+
return publishAccessLevel === keptBlockArg.npmAccessLevel
|
|
1277
|
+
? `${description}; it duplicates release.targets.npm.accessLevel on purpose`
|
|
1278
|
+
: `${description}; gitzone publishes with release.targets.npm.accessLevel, which is ${formatValue(publishAccessLevel)}`;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* What `gitzone config migrate` leaves of a present `@ship.zone/szci` block
|
|
1283
|
+
* with content szci does not read, phrased as the step that settles it.
|
|
1284
|
+
*/
|
|
1285
|
+
function describeShipzoneMigration(
|
|
1286
|
+
keptBlockArg: unknown,
|
|
1287
|
+
copiesAccessLevelArg: boolean,
|
|
1288
|
+
): string {
|
|
1289
|
+
const accessLevelCopy = copiesAccessLevelArg
|
|
1290
|
+
? " It copies npmAccessLevel to release.targets.npm.accessLevel, which gitzone publishes with."
|
|
1291
|
+
: "";
|
|
1292
|
+
if (keptBlockArg === undefined) {
|
|
1293
|
+
return "Run `gitzone config migrate`. The block holds only szci defaults, so the migration removes it.";
|
|
1294
|
+
}
|
|
1295
|
+
if (
|
|
1296
|
+
isPlainObject(keptBlockArg) &&
|
|
1297
|
+
Object.keys(keptBlockArg).every(isShipzoneSzciKey)
|
|
1298
|
+
) {
|
|
1299
|
+
return `Run \`gitzone config migrate\`.${accessLevelCopy} It keeps only the keys szci reads.`;
|
|
1300
|
+
}
|
|
1301
|
+
return `Run \`gitzone config migrate\`, then move every key it keeps that szci does not read to its current home.${accessLevelCopy}`;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1243
1304
|
/**
|
|
1244
1305
|
* Reports `@ship.zone/szci` as `gitzone config migrate` would leave it: keys
|
|
1245
|
-
* the migration removes need no manual step,
|
|
1246
|
-
* with its current home
|
|
1306
|
+
* the migration removes need no manual step, every key it keeps that gitzone
|
|
1307
|
+
* once read is named with its current home, and a key szci reads is named as
|
|
1308
|
+
* szci's own. A block that holds only szci's own keys is szci's configuration
|
|
1309
|
+
* and needs no step, unless the migration still has to copy its access level
|
|
1310
|
+
* for gitzone.
|
|
1247
1311
|
*/
|
|
1248
1312
|
function collectShipzoneNamespaceFindings(
|
|
1249
1313
|
smartconfigDataArg: Record<string, any>,
|
|
@@ -1252,15 +1316,30 @@ function collectShipzoneNamespaceFindings(
|
|
|
1252
1316
|
const migratedData = structuredClone(smartconfigDataArg);
|
|
1253
1317
|
migrateSmartconfigData(migratedData);
|
|
1254
1318
|
const keptBlock: unknown = migratedData[SHIPZONE_NAMESPACE];
|
|
1255
|
-
|
|
1256
|
-
|
|
1319
|
+
const presentBlock: unknown = smartconfigDataArg[SHIPZONE_NAMESPACE];
|
|
1320
|
+
const holdsOnlySzciKeys =
|
|
1321
|
+
isPlainObject(presentBlock) &&
|
|
1322
|
+
Object.keys(presentBlock).length > 0 &&
|
|
1323
|
+
Object.keys(presentBlock).every(isShipzoneSzciKey);
|
|
1324
|
+
const szciAccessLevel: unknown = isPlainObject(presentBlock)
|
|
1325
|
+
? presentBlock.npmAccessLevel
|
|
1326
|
+
: undefined;
|
|
1327
|
+
const copiesAccessLevel =
|
|
1328
|
+
szciAccessLevel !== undefined &&
|
|
1329
|
+
getNpmTargetAccessLevel(smartconfigDataArg) === undefined &&
|
|
1330
|
+
getNpmTargetAccessLevel(migratedData) === szciAccessLevel;
|
|
1331
|
+
|
|
1332
|
+
if (SHIPZONE_NAMESPACE in smartconfigDataArg && !holdsOnlySzciKeys) {
|
|
1257
1333
|
findings.push({
|
|
1258
1334
|
level: "warn",
|
|
1259
1335
|
message: `Legacy namespace '${SHIPZONE_NAMESPACE}' is present`,
|
|
1260
|
-
fix:
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1336
|
+
fix: describeShipzoneMigration(keptBlock, copiesAccessLevel),
|
|
1337
|
+
});
|
|
1338
|
+
} else if (copiesAccessLevel) {
|
|
1339
|
+
findings.push({
|
|
1340
|
+
level: "warn",
|
|
1341
|
+
message: `release.targets.npm.accessLevel is unset while ${SHIPZONE_NAMESPACE}.npmAccessLevel is ${formatValue(szciAccessLevel)}`,
|
|
1342
|
+
fix: "Run `gitzone config migrate`. It copies the value to release.targets.npm.accessLevel, which gitzone publishes with, and szci keeps its own.",
|
|
1264
1343
|
});
|
|
1265
1344
|
}
|
|
1266
1345
|
if (keptBlock === undefined) {
|
|
@@ -1275,6 +1354,13 @@ function collectShipzoneNamespaceFindings(
|
|
|
1275
1354
|
return findings;
|
|
1276
1355
|
}
|
|
1277
1356
|
for (const key of Object.keys(keptBlock)) {
|
|
1357
|
+
if (isShipzoneSzciKey(key)) {
|
|
1358
|
+
findings.push({
|
|
1359
|
+
level: "ok",
|
|
1360
|
+
message: describeShipzoneSzciKey(key, keptBlock, migratedData),
|
|
1361
|
+
});
|
|
1362
|
+
continue;
|
|
1363
|
+
}
|
|
1278
1364
|
const home = shipzoneKeyHomes[key];
|
|
1279
1365
|
findings.push({
|
|
1280
1366
|
level: "warn",
|
|
@@ -1674,7 +1760,8 @@ function buildConfigFixPrompt(
|
|
|
1674
1760
|
"- Use target-based release config: `release.targets.git`, `release.targets.npm`, and `release.targets.docker`.",
|
|
1675
1761
|
'- Docker release targets must use `release.targets.docker.engine = "tsdocker"`; Docker registries belong under `@git.zone/tsdocker`.',
|
|
1676
1762
|
"- Remove `release.targets.docker.noBuild`; journaled Docker qualification always builds.",
|
|
1677
|
-
"- Keep npm registries only at `@git.zone/cli.release.targets.npm.registries`.",
|
|
1763
|
+
"- Keep npm publish registries only at `@git.zone/cli.release.targets.npm.registries`.",
|
|
1764
|
+
"- Leave `@ship.zone/szci.npmRegistryUrl` and `@ship.zone/szci.npmAccessLevel` in place, because szci reads them. The registry is the one `szci npm prepare` installs from, not a publish registry, so never move or copy it into the publish registries. `szci git mirror` checks the access level, which may duplicate `release.targets.npm.accessLevel` on purpose.",
|
|
1678
1765
|
"- Do not add runtime legacy compatibility code. If legacy config exists, migrate it explicitly.",
|
|
1679
1766
|
"- Do not commit, release, install dependencies, or modify unrelated files.",
|
|
1680
1767
|
"- Use pnpm commands only if commands are needed.",
|