@git.zone/cli 8.6.0 → 8.7.1

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.
Files changed (32) hide show
  1. package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-release-api.mjs +9 -3
  2. package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-sealed-release.mjs +10 -3
  3. package/assets/templates/vscode/.vscode/settings.json +57 -0
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/classes.gitzoneconfig.d.ts +3 -0
  6. package/dist_ts/classes.gitzoneconfig.js +1 -1
  7. package/dist_ts/helpers.objects.d.ts +2 -0
  8. package/dist_ts/helpers.objects.js +3 -0
  9. package/dist_ts/helpers.packagefiles.d.ts +74 -0
  10. package/dist_ts/helpers.packagefiles.js +177 -0
  11. package/dist_ts/helpers.workflow.d.ts +18 -0
  12. package/dist_ts/helpers.workflow.js +45 -2
  13. package/dist_ts/mod_config/index.js +69 -2
  14. package/dist_ts/mod_format/formatters/packagejson.formatter.js +8 -27
  15. package/dist_ts/mod_release/helpers.npmartifactcheck.d.ts +93 -0
  16. package/dist_ts/mod_release/helpers.npmartifactcheck.js +279 -0
  17. package/dist_ts/mod_release/index.d.ts +15 -0
  18. package/dist_ts/mod_release/index.js +82 -17
  19. package/dist_ts/plugins.d.ts +2 -1
  20. package/dist_ts/plugins.js +3 -2
  21. package/package.json +4 -3
  22. package/readme.md +107 -15
  23. package/ts/00_commitinfo_data.ts +1 -1
  24. package/ts/classes.gitzoneconfig.ts +3 -0
  25. package/ts/helpers.objects.ts +5 -0
  26. package/ts/helpers.packagefiles.ts +273 -0
  27. package/ts/helpers.workflow.ts +70 -1
  28. package/ts/mod_config/index.ts +78 -0
  29. package/ts/mod_format/formatters/packagejson.formatter.ts +7 -27
  30. package/ts/mod_release/helpers.npmartifactcheck.ts +397 -0
  31. package/ts/mod_release/index.ts +115 -26
  32. package/ts/plugins.ts +2 -0
@@ -229,7 +229,9 @@ export class GiteaSealedRelease {
229
229
  /**
230
230
  * Retains the verified sealed files in the tag's draft release and returns the attachment
231
231
  * identities it read back and hashed. Attachments that already match are kept; a draft
232
- * attachment that conflicts with the sealed set is replaced, never one of a published release.
232
+ * attachment that conflicts with the sealed set (an interrupted upload) is replaced, never one of
233
+ * a published release. A draft that already names another manifest holds an earlier build of the
234
+ * same commit: release builds are reproducible, so a different build is refused, never swapped in.
233
235
  */
234
236
  async retain({ tag, commit, manifestSha256, files }) {
235
237
  requireValue(/^v\d+\.\d+\.\d+$/.test(tag) && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(commit) &&
@@ -243,6 +245,10 @@ export class GiteaSealedRelease {
243
245
  let release = await this.inspect(tag, commit);
244
246
  if (!release) release = await this.createDraft(tag, commit, manifestSha256);
245
247
  requireValue(release.draft, 'The release for this tag is already published and is never changed; rerun the job to verify it.');
248
+ requireValue(!release.manifestSha256 || release.manifestSha256 === manifestSha256,
249
+ `The unpublished draft ${tag} holds an earlier build of this commit with manifest sha256 ${release.manifestSha256}, `
250
+ + `but this build sealed ${manifestSha256}: the release build is not reproducible, and a rerun never replaces retained bytes `
251
+ + 'with a different build. Make the build reproducible, or delete the draft release to release a new build.');
246
252
  const retained = new Map();
247
253
  for (const asset of await this.assets(release.id)) {
248
254
  const file = files.find((item) => item.name === asset.name);
@@ -256,9 +262,9 @@ export class GiteaSealedRelease {
256
262
  `(${read.size} of ${asset.size} bytes), the sealed set ${file ? `has sha256 ${file.sha256}` : 'has no such file'}.`);
257
263
  await this.json(`/releases/${release.id}/assets/${asset.id}`, { method: 'DELETE' }, [204]);
258
264
  }
259
- if (release.manifestSha256 !== manifestSha256) {
265
+ if (!release.manifestSha256) {
260
266
  await this.requireDraft(tag, commit, release.id);
261
- this.log(`Describing the unpublished draft ${tag} with manifest sha256 ${manifestSha256} instead of ${release.manifestSha256 ?? 'none'}.`);
267
+ this.log(`Describing the unpublished draft ${tag}, which named no manifest, with manifest sha256 ${manifestSha256}.`);
262
268
  const edited = await this.json(`/releases/${release.id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' },
263
269
  body: JSON.stringify({ body: releaseBody(manifestSha256) }) });
264
270
  const after = this.assertRelease(edited, tag, commit);
@@ -53,9 +53,15 @@ try {
53
53
  requireValue(process.env.GITHUB_OUTPUT, 'Expected the Actions step output file.');
54
54
  await fs.appendFile(process.env.GITHUB_OUTPUT, Object.entries(values).map(([key, value]) => `${key}=${value}\n`).join(''));
55
55
  };
56
- const runAdapter = (args) => {
56
+ const runAdapter = async (args) => {
57
57
  requireValue(Array.isArray(args) && args.length > 0 && args.every((value) => typeof value === 'string' && !value.includes('\0')), 'Expected an explicit component command argument array.');
58
- const environment = { ...process.env };
58
+ // Every build of the tag is dated with its commit (https://reproducible-builds.org/specs/source-date-epoch/),
59
+ // so tools that record or embed a time produce the same bytes on every attempt.
60
+ const sourceDateEpoch = (await exec('git', ['log', '-1', '--format=%ct', commit], { cwd: root })).stdout.trim();
61
+ requireValue(/^\d+$/.test(sourceDateEpoch), 'Could not read the tagged commit time.');
62
+ requireValue(process.env.SOURCE_DATE_EPOCH === undefined || process.env.SOURCE_DATE_EPOCH === sourceDateEpoch,
63
+ `SOURCE_DATE_EPOCH must be the tagged commit time ${sourceDateEpoch} when the job sets it.`);
64
+ const environment = { ...process.env, SOURCE_DATE_EPOCH: sourceDateEpoch };
59
65
  delete environment.GITHUB_TOKEN;
60
66
  delete environment.ACTIONS_RUNTIME_TOKEN;
61
67
  const name = `Component command ${JSON.stringify(args)}`;
@@ -175,7 +181,8 @@ try {
175
181
  retained = true;
176
182
  }
177
183
  } else if (found.state === 'incomplete') {
178
- console.error(`The draft release for ${tag} is incomplete (${found.reason}); building and sealing again.`);
184
+ console.error(`The draft release for ${tag} is incomplete (${found.reason}); building and sealing again`
185
+ + `${found.release.manifestSha256 ? `, which must reproduce manifest sha256 ${found.release.manifestSha256}` : ''}.`);
179
186
  }
180
187
  await setOutputs(retained ? { retained: 'true', manifest: found.release.manifestSha256 } : { retained: 'false' });
181
188
  } else if (command === 'prepare') {
@@ -12,6 +12,63 @@
12
12
  "projectType": {
13
13
  "type": "string",
14
14
  "enum": ["website", "element", "service", "npm", "wcc"]
15
+ },
16
+ "packageFiles": {
17
+ "type": "object",
18
+ "description": "What package.json files ships. gitzone format writes the list; a release refuses a package.json whose files differ from it. Without sets every set applies.",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "sets": {
22
+ "type": "array",
23
+ "description": "Named groups of files entries, written in set order. Omit to ship every set.",
24
+ "uniqueItems": true,
25
+ "items": {
26
+ "type": "string",
27
+ "enum": ["source", "dist", "assets", "cli", "config", "docs", "binary"]
28
+ }
29
+ },
30
+ "include": {
31
+ "type": "array",
32
+ "description": "Further paths or globs, written after the entries of the sets.",
33
+ "items": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "pattern": "^[^!/]"
37
+ }
38
+ },
39
+ "exclude": {
40
+ "type": "array",
41
+ "description": "Paths or globs to leave out, written without the leading !; gitzone adds it and places every exclusion last. package.json, root readme and license files, the main file and bin files are always packed and cannot be excluded.",
42
+ "items": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "pattern": "^[^!/]"
46
+ }
47
+ }
48
+ }
49
+ },
50
+ "release": {
51
+ "type": "object",
52
+ "properties": {
53
+ "targets": {
54
+ "type": "object",
55
+ "properties": {
56
+ "npm": {
57
+ "type": "object",
58
+ "properties": {
59
+ "maxPublishBytes": {
60
+ "type": "object",
61
+ "description": "Largest publish body in bytes, keyed by a configured registry URL. A release whose estimated body (base64 tarball plus manifest) exceeds it stops before anything is pushed. A registry without an entry has no limit.",
62
+ "additionalProperties": {
63
+ "type": "integer",
64
+ "minimum": 1
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
15
72
  }
16
73
  }
17
74
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/cli',
6
- version: '8.6.0',
6
+ version: '8.7.1',
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
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxlQUFlO0lBQ3JCLE9BQU8sRUFBRSxPQUFPO0lBQ2hCLFdBQVcsRUFBRSwrTEFBK0w7Q0FDN00sQ0FBQSJ9
@@ -1,3 +1,4 @@
1
+ import type { IPackageFilesConfig } from './helpers.packagefiles.js';
1
2
  export type TGitzoneProjectType = 'npm' | 'service' | 'wcc' | 'website';
2
3
  /**
3
4
  * type of the actual gitzone data
@@ -18,6 +19,8 @@ export interface IGitzoneConfigData {
18
19
  copy: {
19
20
  [key: string]: string;
20
21
  };
22
+ /** What package.json `files` ships; `gitzone format` writes it, a release checks it. */
23
+ packageFiles?: IPackageFilesConfig;
21
24
  }
22
25
  /**
23
26
  * gitzone config
@@ -16,4 +16,4 @@ export class GitzoneConfig {
16
16
  }
17
17
  constructor() { }
18
18
  }
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5naXR6b25lY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvY2xhc3Nlcy5naXR6b25lY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBQ3hDLE9BQU8sS0FBSyxLQUFLLE1BQU0sWUFBWSxDQUFDO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ENBQUM7SUFDdkIsQ0FBQztJQUVNLElBQUksQ0FBc0I7SUFFMUIsS0FBSyxDQUFDLGlCQUFpQjtRQUM1QixNQUFNLG1CQUFtQixHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxXQUFXLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQzNFLElBQUksQ0FBQyxJQUFJLEdBQUcsbUJBQW1CLENBQUMsT0FBTyxDQUFxQixlQUFlLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFDbkYsQ0FBQztJQUVELGdCQUFlLENBQUM7Q0FDakIifQ==
@@ -0,0 +1,2 @@
1
+ /** A JSON object: not null, not an array. */
2
+ export declare const isPlainObject: (valueArg: unknown) => valueArg is Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ /** A JSON object: not null, not an array. */
2
+ export const isPlainObject = (valueArg) => typeof valueArg === "object" && valueArg !== null && !Array.isArray(valueArg);
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5vYmplY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvaGVscGVycy5vYmplY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxNQUFNLENBQUMsTUFBTSxhQUFhLEdBQUcsQ0FDM0IsUUFBaUIsRUFDb0IsRUFBRSxDQUN2QyxPQUFPLFFBQVEsS0FBSyxRQUFRLElBQUksUUFBUSxLQUFLLElBQUksSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUMifQ==
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The named groups of package.json `files` entries, in the order the generated
3
+ * list carries them. Without a `packageFiles.sets` selection every set applies,
4
+ * which reproduces the list gitzone has always written.
5
+ */
6
+ export declare const packageFileSetNames: readonly ["source", "dist", "assets", "cli", "config", "docs", "binary"];
7
+ export type TPackageFileSetName = (typeof packageFileSetNames)[number];
8
+ /** `@git.zone/cli.packageFiles` in `.smartconfig.json`. */
9
+ export interface IPackageFilesConfig {
10
+ /** Named sets to ship; all of them when omitted. */
11
+ sets?: TPackageFileSetName[];
12
+ /** Further paths or globs, written after the entries of the sets. */
13
+ include?: string[];
14
+ /** Paths or globs to leave out, written without `!` and placed last. */
15
+ exclude?: string[];
16
+ }
17
+ /** The managed asset settings that add package files. */
18
+ export interface IPackageFilesAssetsConfig {
19
+ enabled?: boolean;
20
+ kind?: string;
21
+ installer?: {
22
+ enabled?: boolean;
23
+ file?: string;
24
+ };
25
+ npmWrapper?: {
26
+ enabled?: boolean;
27
+ postinstallFile?: string;
28
+ };
29
+ }
30
+ /** The package.json fields npm and pnpm pack whatever `files` says. */
31
+ export interface IPackageFilesManifest {
32
+ main?: unknown;
33
+ bin?: unknown;
34
+ }
35
+ export interface IPackageFileSet {
36
+ include: string[];
37
+ /** Exclusions without their `!`. */
38
+ exclude: string[];
39
+ }
40
+ export interface IResolvePackageFilesOptions {
41
+ /** The raw `@git.zone/cli.packageFiles` value; validated here. */
42
+ packageFiles: unknown;
43
+ /** The raw `@git.zone/cli.assets` value. */
44
+ assets?: IPackageFilesAssetsConfig;
45
+ manifest: IPackageFilesManifest;
46
+ }
47
+ /**
48
+ * The sets as they stand for one project. `binary` carries the installer and
49
+ * npm wrapper of managed `denoBinaryCli` assets and is empty otherwise.
50
+ */
51
+ export declare const getPackageFileSets: (assetsArg: IPackageFilesAssetsConfig | undefined) => Record<TPackageFileSetName, IPackageFileSet>;
52
+ /**
53
+ * pnpm packs these files whatever `files` says, so an exclusion naming one of
54
+ * them has no effect: `package.json`, every root file whose name starts with
55
+ * `readme`, `license` or `licence` (any case), the `main` file and every `bin`
56
+ * file. Returns why the entry is ignored, or undefined.
57
+ */
58
+ export declare const describeForceIncludedPackagePath: (entryArg: string, manifestArg: IPackageFilesManifest) => string | undefined;
59
+ /** Validates `@git.zone/cli.packageFiles`; undefined when it is absent. */
60
+ export declare const parsePackageFilesConfig: (valueArg: unknown) => IPackageFilesConfig | undefined;
61
+ /**
62
+ * The package.json `files` list: the entries of the selected sets in set
63
+ * order, then `include`, then every exclusion. pnpm 10 and 12 apply an
64
+ * exclusion only after the entries that include the file, so the exclusions
65
+ * of the sets and of `exclude` come last. Repeated entries keep their first
66
+ * position. Without `packageFiles`, or without `sets`, every set applies.
67
+ */
68
+ export declare const resolvePackageFiles: (optionsArg: IResolvePackageFilesOptions) => string[];
69
+ /**
70
+ * A release of a project that configures `packageFiles` ships what that
71
+ * configuration generates, and `gitzone format` is the one writer of the list.
72
+ * Projects without `packageFiles` are not checked.
73
+ */
74
+ export declare const assertPackageJsonFilesCurrent: (cwdArg: string) => Promise<void>;
@@ -0,0 +1,177 @@
1
+ import * as plugins from "./plugins.js";
2
+ import { getCliNamespaceConfig, readSmartconfigFile } from "./helpers.smartconfig.js";
3
+ import { isPlainObject } from "./helpers.objects.js";
4
+ /**
5
+ * The named groups of package.json `files` entries, in the order the generated
6
+ * list carries them. Without a `packageFiles.sets` selection every set applies,
7
+ * which reproduces the list gitzone has always written.
8
+ */
9
+ export const packageFileSetNames = [
10
+ "source",
11
+ "dist",
12
+ "assets",
13
+ "cli",
14
+ "config",
15
+ "docs",
16
+ "binary",
17
+ ];
18
+ const configPath = "@git.zone/cli.packageFiles";
19
+ /**
20
+ * The sets as they stand for one project. `binary` carries the installer and
21
+ * npm wrapper of managed `denoBinaryCli` assets and is empty otherwise.
22
+ */
23
+ export const getPackageFileSets = (assetsArg) => {
24
+ const assets = assetsArg?.enabled === false ? undefined : assetsArg;
25
+ const binary = [];
26
+ if (assets?.kind === "denoBinaryCli" && assets.installer?.enabled !== false) {
27
+ binary.push(assets.installer?.file || "install.sh");
28
+ }
29
+ if (assets?.kind === "denoBinaryCli" && assets.npmWrapper?.enabled) {
30
+ binary.push("bin/");
31
+ binary.push(assets.npmWrapper.postinstallFile || "scripts/install-binary.js");
32
+ }
33
+ return {
34
+ // @git.zone/tsbuild reads a folder's compiler options from <folder>/tsconfig.json,
35
+ // which extends the root tsconfig.json. The package does not ship the root file,
36
+ // so a shipped folder file would extend a file that is not there.
37
+ source: {
38
+ include: ["ts/**/*", "ts_web/**/*"],
39
+ exclude: ["ts/tsconfig.json", "ts_web/tsconfig.json"],
40
+ },
41
+ dist: {
42
+ include: ["dist/**/*", "dist_*/**/*", "dist_ts/**/*", "dist_ts_web/**/*"],
43
+ exclude: [],
44
+ },
45
+ assets: { include: ["assets/**/*"], exclude: [] },
46
+ cli: { include: ["cli.js"], exclude: [] },
47
+ config: { include: [".smartconfig.json"], exclude: [] },
48
+ docs: { include: ["readme.md"], exclude: [] },
49
+ binary: { include: binary, exclude: [] },
50
+ };
51
+ };
52
+ const normalizePackagePath = (pathArg) => pathArg.replace(/^(\.\/)+/, "").replace(/\/+$/, "");
53
+ const readBinPaths = (binArg) => {
54
+ if (typeof binArg === "string")
55
+ return [binArg];
56
+ if (isPlainObject(binArg))
57
+ return Object.values(binArg).filter((valueArg) => typeof valueArg === "string");
58
+ return [];
59
+ };
60
+ /**
61
+ * pnpm packs these files whatever `files` says, so an exclusion naming one of
62
+ * them has no effect: `package.json`, every root file whose name starts with
63
+ * `readme`, `license` or `licence` (any case), the `main` file and every `bin`
64
+ * file. Returns why the entry is ignored, or undefined.
65
+ */
66
+ export const describeForceIncludedPackagePath = (entryArg, manifestArg) => {
67
+ const entry = normalizePackagePath(entryArg);
68
+ if (entry === "package.json")
69
+ return "package.json is always packed";
70
+ if (!entry.includes("/") && /^(readme|licen[cs]e)/i.test(entry))
71
+ return "root readme and license files are always packed";
72
+ if (typeof manifestArg.main === "string" &&
73
+ normalizePackagePath(manifestArg.main) === entry)
74
+ return "the package.json main file is always packed";
75
+ if (readBinPaths(manifestArg.bin).some((binPathArg) => normalizePackagePath(binPathArg) === entry))
76
+ return "package.json bin files are always packed";
77
+ return undefined;
78
+ };
79
+ const parseEntryList = (valueArg, keyArg) => {
80
+ if (valueArg === undefined)
81
+ return [];
82
+ if (!Array.isArray(valueArg))
83
+ throw new Error(`${configPath}.${keyArg} must be an array of paths or globs.`);
84
+ return valueArg.map((entryArg, indexArg) => {
85
+ if (typeof entryArg !== "string" || entryArg.trim() === "")
86
+ throw new Error(`${configPath}.${keyArg}[${indexArg}] must be a non-empty path or glob.`);
87
+ if (entryArg !== entryArg.trim())
88
+ throw new Error(`${configPath}.${keyArg}[${indexArg}] must not start or end with whitespace.`);
89
+ if (entryArg.startsWith("!"))
90
+ throw new Error(keyArg === "include"
91
+ ? `${configPath}.include[${indexArg}] "${entryArg}" is an exclusion; list it under exclude without the "!".`
92
+ : `${configPath}.exclude[${indexArg}] "${entryArg}" must be written without the "!"; gitzone adds it.`);
93
+ if (entryArg.startsWith("/"))
94
+ throw new Error(`${configPath}.${keyArg}[${indexArg}] "${entryArg}" must be relative to the package root.`);
95
+ return entryArg;
96
+ });
97
+ };
98
+ /** Validates `@git.zone/cli.packageFiles`; undefined when it is absent. */
99
+ export const parsePackageFilesConfig = (valueArg) => {
100
+ if (valueArg === undefined)
101
+ return undefined;
102
+ if (!isPlainObject(valueArg))
103
+ throw new Error(`${configPath} must be an object with sets, include and/or exclude.`);
104
+ const unknownKeys = Object.keys(valueArg).filter((keyArg) => !["sets", "include", "exclude"].includes(keyArg));
105
+ if (unknownKeys.length > 0)
106
+ throw new Error(`${configPath} has unknown key(s) ${unknownKeys.join(", ")}; use sets, include and exclude.`);
107
+ const config = {};
108
+ if (valueArg.sets !== undefined) {
109
+ if (!Array.isArray(valueArg.sets))
110
+ throw new Error(`${configPath}.sets must be an array of set names: ${packageFileSetNames.join(", ")}.`);
111
+ config.sets = valueArg.sets.map((setArg) => {
112
+ if (typeof setArg !== "string" ||
113
+ !packageFileSetNames.includes(setArg))
114
+ throw new Error(`${configPath}.sets names unknown set ${JSON.stringify(setArg)}; known sets: ${packageFileSetNames.join(", ")}.`);
115
+ return setArg;
116
+ });
117
+ }
118
+ const include = parseEntryList(valueArg.include, "include");
119
+ const exclude = parseEntryList(valueArg.exclude, "exclude");
120
+ if (valueArg.include !== undefined)
121
+ config.include = include;
122
+ if (valueArg.exclude !== undefined)
123
+ config.exclude = exclude;
124
+ return config;
125
+ };
126
+ /**
127
+ * The package.json `files` list: the entries of the selected sets in set
128
+ * order, then `include`, then every exclusion. pnpm 10 and 12 apply an
129
+ * exclusion only after the entries that include the file, so the exclusions
130
+ * of the sets and of `exclude` come last. Repeated entries keep their first
131
+ * position. Without `packageFiles`, or without `sets`, every set applies.
132
+ */
133
+ export const resolvePackageFiles = (optionsArg) => {
134
+ const config = parsePackageFilesConfig(optionsArg.packageFiles) ?? {};
135
+ for (const [indexArg, entryArg] of (config.exclude ?? []).entries()) {
136
+ const reason = describeForceIncludedPackagePath(entryArg, optionsArg.manifest);
137
+ if (reason)
138
+ throw new Error(`${configPath}.exclude[${indexArg}] "${entryArg}" has no effect: ${reason}, so npm and pnpm ignore the exclusion. Remove it.`);
139
+ }
140
+ const sets = getPackageFileSets(optionsArg.assets);
141
+ const selected = packageFileSetNames.filter((nameArg) => !config.sets || config.sets.includes(nameArg));
142
+ const files = [
143
+ ...selected.flatMap((nameArg) => sets[nameArg].include),
144
+ ...(config.include ?? []),
145
+ ...selected.flatMap((nameArg) => sets[nameArg].exclude).map((entryArg) => `!${entryArg}`),
146
+ ...(config.exclude ?? []).map((entryArg) => `!${entryArg}`),
147
+ ];
148
+ return [...new Set(files)];
149
+ };
150
+ /**
151
+ * A release of a project that configures `packageFiles` ships what that
152
+ * configuration generates, and `gitzone format` is the one writer of the list.
153
+ * Projects without `packageFiles` are not checked.
154
+ */
155
+ export const assertPackageJsonFilesCurrent = async (cwdArg) => {
156
+ const cliConfig = getCliNamespaceConfig(await readSmartconfigFile(cwdArg));
157
+ if (cliConfig.packageFiles === undefined)
158
+ return;
159
+ let manifest;
160
+ try {
161
+ manifest = JSON.parse(await plugins.fs.readFile(plugins.path.join(cwdArg, "package.json"), "utf8"));
162
+ }
163
+ catch (error) {
164
+ throw new Error(`${configPath} is configured, but package.json cannot be read.`, { cause: error });
165
+ }
166
+ if (!isPlainObject(manifest))
167
+ throw new Error("package.json must contain a JSON object.");
168
+ const expected = resolvePackageFiles({
169
+ packageFiles: cliConfig.packageFiles,
170
+ assets: isPlainObject(cliConfig.assets) ? cliConfig.assets : undefined,
171
+ manifest,
172
+ });
173
+ if (JSON.stringify(manifest.files) !== JSON.stringify(expected)) {
174
+ throw new Error(`package.json files does not match ${configPath}: expected ${JSON.stringify(expected)}, found ${JSON.stringify(manifest.files ?? null)}. Run \`gitzone format\`, commit the result, and release again.`);
175
+ }
176
+ };
177
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5wYWNrYWdlZmlsZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9oZWxwZXJzLnBhY2thZ2VmaWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQUN4QyxPQUFPLEVBQUUscUJBQXFCLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUN0RixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFckQ7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxNQUFNLG1CQUFtQixHQUFHO0lBQ2pDLFFBQVE7SUFDUixNQUFNO0lBQ04sUUFBUTtJQUNSLEtBQUs7SUFDTCxRQUFRO0lBQ1IsTUFBTTtJQUNOLFFBQVE7Q0FDQSxDQUFDO0FBMENYLE1BQU0sVUFBVSxHQUFHLDRCQUE0QixDQUFDO0FBR2hEOzs7R0FHRztBQUNILE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFHLENBQ2hDLFNBQWdELEVBQ0YsRUFBRTtJQUNoRCxNQUFNLE1BQU0sR0FBRyxTQU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BQyxTQUFTLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxLQUFLLElBQUksQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDLEVBQUUsQ0FBQztRQUNoRSxNQUFNLElBQUksS0FBSyxDQUNiLHFDQUFxQyxVQUFVLGNBQWMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsV0FBVyxJQUFJLENBQUMsU0FBUyxDQUFDLFFBQVEsQ0FBQyxLQUFLLElBQUksSUFBSSxDQUFDLGlFQUFpRSxDQUN4TSxDQUFDO0lBQ0osQ0FBQztBQUNILENBQUMsQ0FBQyJ9
@@ -42,6 +42,12 @@ export interface IReleaseNpmTargetConfig {
42
42
  alreadyPublished?: "success" | "error";
43
43
  /** Minutes one accepted upload may stay unreadable before resume takes over. */
44
44
  verificationWindowMinutes?: number;
45
+ /**
46
+ * Largest publish body, in bytes, each named registry accepts. A release
47
+ * whose estimated body exceeds it stops before anything is pushed. A
48
+ * registry without an entry has no limit.
49
+ */
50
+ maxPublishBytes?: Record<string, number>;
45
51
  }
46
52
  export interface IReleaseGiteaAssetsTargetConfig {
47
53
  enabled?: boolean;
@@ -169,6 +175,10 @@ export interface IResolvedReleaseWorkflow {
169
175
  npmAccessLevel: "public" | "private";
170
176
  npmAlreadyPublished: "success" | "error";
171
177
  npmVerificationWindowMinutes: number;
178
+ /** Publish body limits by normalized registry URL; empty without limits. */
179
+ npmMaxPublishBytes: Record<string, number>;
180
+ /** `@git.zone/cli.packageFiles` is configured, so preflight checks package.json files. */
181
+ packageFilesConfigured: boolean;
172
182
  giteaAssets?: IResolvedReleaseGiteaAssetsConfiguration;
173
183
  giteaAssetTransfer?: IGiteaAssetTransferLimits;
174
184
  /** Attachments of a draft in progress at the same time. */
@@ -222,6 +232,14 @@ export declare const resolveCommitWorkflow: (argvArg: any, inputMode?: "ai" | "m
222
232
  export declare const resolveGitRemoteTimeoutSeconds: (valueArg: unknown) => number;
223
233
  /** One accepted upload may wait this long for the registry to serve it. */
224
234
  export declare const resolveNpmVerificationWindowMinutes: (valueArg: unknown) => number;
235
+ /**
236
+ * `release.targets.npm.maxPublishBytes`: whole byte limits keyed by registry
237
+ * URL. Every key must be one of the configured registries, so a typo cannot
238
+ * silently leave a registry without its limit.
239
+ */
240
+ export declare const resolveNpmMaxPublishBytes: (valueArg: unknown, registriesArg: string[]) => Record<string, number>;
241
+ /** The registry URL form `release.targets.npm.registries` resolves to. */
242
+ export declare const normalizeReleaseRegistryUrl: (urlArg: string) => string;
225
243
  /**
226
244
  * Resolves the release from its configuration and command line. A resume of
227
245
  * a recorded release passes `recordedPlanArg`, which replaces every command