@git.zone/cli 8.5.1 → 8.7.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/asset_tspack_release_gitea/.gitea/workflows/release.yml +12 -18
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.d.mts +22 -0
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.mjs +48 -0
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-release-api.mjs +244 -74
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-sealed-release.mjs +103 -38
- package/assets/templates/vscode/.vscode/settings.json +57 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.gitzoneconfig.d.ts +3 -0
- package/dist_ts/classes.gitzoneconfig.js +1 -1
- package/dist_ts/helpers.objects.d.ts +2 -0
- package/dist_ts/helpers.objects.js +3 -0
- package/dist_ts/helpers.packagefiles.d.ts +74 -0
- package/dist_ts/helpers.packagefiles.js +177 -0
- package/dist_ts/helpers.workflow.d.ts +18 -0
- package/dist_ts/helpers.workflow.js +45 -2
- package/dist_ts/mod_config/index.js +69 -2
- package/dist_ts/mod_format/formatters/assets.formatter.js +2 -1
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +8 -27
- package/dist_ts/mod_release/helpers.giteaassets.d.ts +4 -14
- package/dist_ts/mod_release/helpers.giteaassets.js +20 -35
- package/dist_ts/mod_release/helpers.npmartifactcheck.d.ts +93 -0
- package/dist_ts/mod_release/helpers.npmartifactcheck.js +279 -0
- package/dist_ts/mod_release/index.d.ts +15 -0
- package/dist_ts/mod_release/index.js +82 -17
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +2 -1
- package/readme.md +147 -33
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +3 -0
- package/ts/helpers.objects.ts +5 -0
- package/ts/helpers.packagefiles.ts +273 -0
- package/ts/helpers.workflow.ts +70 -1
- package/ts/mod_config/index.ts +78 -0
- package/ts/mod_format/formatters/assets.formatter.ts +1 -0
- package/ts/mod_format/formatters/packagejson.formatter.ts +7 -27
- package/ts/mod_release/helpers.giteaassets.ts +28 -44
- package/ts/mod_release/helpers.npmartifactcheck.ts +397 -0
- package/ts/mod_release/index.ts +115 -26
- package/ts/plugins.ts +2 -0
|
@@ -29,7 +29,8 @@ try {
|
|
|
29
29
|
const cli = (await readJson(path.join(root, '.smartconfig.json')))['@git.zone/cli'];
|
|
30
30
|
const config = cli?.assets?.sealedRelease;
|
|
31
31
|
const command = process.argv[2];
|
|
32
|
-
requireValue(process.argv.length === 3 && ['discover', 'prepare', 'restore', 'publish'].includes(command),
|
|
32
|
+
requireValue(process.argv.length === 3 && ['discover', 'prepare', 'retain', 'restore', 'publish'].includes(command),
|
|
33
|
+
'Select discover, prepare, retain, restore or publish.');
|
|
33
34
|
requireValue(/^[a-zA-Z0-9_-]+$/.test(config?.outputDirectory) && config.outputDirectory.startsWith('dist_'),
|
|
34
35
|
'Sealed release outputDirectory must be a single dist_ directory.');
|
|
35
36
|
const output = path.join(root, config.outputDirectory);
|
|
@@ -45,7 +46,6 @@ try {
|
|
|
45
46
|
const ignoredPaths = [`${config.outputDirectory}/.probe`, 'dist_gitzone_retained/.probe'];
|
|
46
47
|
requireValue((await exec('git', ['check-ignore', ...ignoredPaths], { cwd: root })).stdout.trim().split('\n').join() === ignoredPaths.join(),
|
|
47
48
|
'Both release output directories must be Git-ignored.');
|
|
48
|
-
const artifactName = `tspack-${commit}`;
|
|
49
49
|
const repository = `${cli.module.gitscope}/${cli.module.gitrepo}`;
|
|
50
50
|
requireValue(process.env.GITHUB_REPOSITORY === repository, 'Release job repository mismatch.');
|
|
51
51
|
const api = () => new GiteaSealedRelease({ server: `https://${cli.module.githost}`, repository, token: process.env.GITHUB_TOKEN });
|
|
@@ -98,60 +98,125 @@ try {
|
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
+
const tspack = async () => new (await import('@git.zone/tspack')).TsPack(root);
|
|
101
102
|
const verify = async (result) => {
|
|
102
103
|
requireValue(typeof result?.directory === 'string' && /^[a-f0-9]{64}$/.test(result.manifestSha256), 'Invalid component packaging result.');
|
|
103
104
|
const directory = path.resolve(root, result.directory);
|
|
104
105
|
requireValue(path.dirname(directory) === output && await fs.realpath(directory) === directory &&
|
|
105
106
|
await fs.realpath(output) === output, 'Sealed directory must be canonical and directly inside the configured output root.');
|
|
106
|
-
const
|
|
107
|
-
const verified = await new TsPack(root).verify(directory, { requireRelease: true,
|
|
107
|
+
const verified = await (await tspack()).verify(directory, { requireRelease: true,
|
|
108
108
|
expectedManifestSha256: result.manifestSha256, expectedSourceCommit: commit });
|
|
109
109
|
requireValue(verified.manifest.packageName === packageJson.name && verified.manifest.version === packageJson.version,
|
|
110
110
|
'Sealed package identity mismatch.');
|
|
111
111
|
return { directory, manifestSha256: result.manifestSha256, manifest: verified.manifest };
|
|
112
112
|
};
|
|
113
|
-
const
|
|
113
|
+
const receiptName = 'gitzone-release.json';
|
|
114
|
+
const retentionName = 'gitzone-retention.json';
|
|
115
|
+
const expectedManifest = () => {
|
|
116
|
+
requireValue(/^[a-f0-9]{64}$/.test(process.env.EXPECTED_MANIFEST ?? ''), 'Expected this run\'s sealed manifest digest.');
|
|
117
|
+
return process.env.EXPECTED_MANIFEST;
|
|
118
|
+
};
|
|
119
|
+
const absent = async (file) => fs.lstat(file).then(() => false, (error) => { if (error.code === 'ENOENT') return true; throw error; });
|
|
120
|
+
const writeJson = (file, value) => fs.writeFile(file, `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx' });
|
|
121
|
+
const writeReceipt = (directory, manifestSha256, rootArg = output) => writeJson(path.join(rootArg, receiptName),
|
|
122
|
+
{ format: 'gitzone.sealed-release', tag, commit, directory, manifestSha256 });
|
|
123
|
+
const writeRetention = (retained, manifestSha256, rootArg = output) => writeJson(path.join(rootArg, retentionName),
|
|
124
|
+
{ format: 'gitzone.sealed-retention', tag, commit, manifestSha256, releaseId: retained.releaseId, attachments: retained.attachments });
|
|
125
|
+
/** The sealed set this job verified: the receipt names it, and TsPack verifies it against the run's manifest digest and commit. */
|
|
126
|
+
const verifiedSet = async () => {
|
|
127
|
+
const receipt = await readJson(path.join(output, receiptName));
|
|
128
|
+
requireValue(receipt.format === 'gitzone.sealed-release' && receipt.tag === tag && receipt.commit === commit &&
|
|
129
|
+
/^[a-zA-Z0-9_.-]+$/.test(receipt.directory) && receipt.manifestSha256 === expectedManifest(), 'Retained release receipt mismatch.');
|
|
130
|
+
const verified = await verify({ directory: path.join(output, receipt.directory), manifestSha256: receipt.manifestSha256 });
|
|
131
|
+
const files = [];
|
|
132
|
+
for (const name of [...verified.manifest.artifacts.map((file) => file.name), 'tspack-manifest.json', 'SHA256SUMS.txt']) {
|
|
133
|
+
const file = path.join(verified.directory, name);
|
|
134
|
+
files.push({ name, ...await digest(file), blob: () => openAsBlob(file) });
|
|
135
|
+
}
|
|
136
|
+
return { ...verified, files };
|
|
137
|
+
};
|
|
114
138
|
if (command === 'discover') {
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
requireValue(await absent(incoming), 'The retention download directory must be absent before discovery.');
|
|
140
|
+
const packer = await tspack();
|
|
141
|
+
const found = await api().findRetained({ tag, commit, readMetadata: (manifestBytes, checksumsBytes, manifestSha256) =>
|
|
142
|
+
packer.verifyMetadata(manifestBytes, checksumsBytes, { expectedManifestSha256: manifestSha256, expectedSourceCommit: commit,
|
|
143
|
+
requireRelease: true }).manifest });
|
|
144
|
+
let retained = false;
|
|
145
|
+
if (found.state === 'candidate') {
|
|
146
|
+
const manifest = found.manifest;
|
|
147
|
+
requireValue(manifest.packageName === packageJson.name && manifest.version === packageJson.version, 'Retained release package identity mismatch.');
|
|
148
|
+
// TsPack's release directory name for this manifest.
|
|
149
|
+
const directory = `${manifest.name}-${manifest.version}-${commit.slice(0, 12)}`;
|
|
150
|
+
requireValue(/^[a-zA-Z0-9_.-]+$/.test(directory), 'Invalid retained release directory.');
|
|
151
|
+
const staged = path.join(incoming, directory);
|
|
152
|
+
await fs.mkdir(staged, { recursive: true });
|
|
153
|
+
await fs.writeFile(path.join(staged, 'tspack-manifest.json'), found.manifestBytes, { flag: 'wx' });
|
|
154
|
+
await fs.writeFile(path.join(staged, 'SHA256SUMS.txt'), found.checksumsBytes, { flag: 'wx' });
|
|
155
|
+
let mismatch = null;
|
|
156
|
+
for (const attachment of found.attachments.filter((item) => !['tspack-manifest.json', 'SHA256SUMS.txt'].includes(item.name))) {
|
|
157
|
+
const handle = await fs.open(path.join(staged, attachment.name), 'wx');
|
|
158
|
+
let read;
|
|
159
|
+
try {
|
|
160
|
+
read = await api().read(attachment, async (chunk) => {
|
|
161
|
+
requireValue((await handle.write(chunk)).bytesWritten === chunk.length, 'Retained attachment write was incomplete.');
|
|
162
|
+
});
|
|
163
|
+
} finally { await handle.close(); }
|
|
164
|
+
if (read.sha256 !== attachment.sha256) { mismatch = attachment.name; break; }
|
|
165
|
+
}
|
|
166
|
+
if (mismatch) {
|
|
167
|
+
requireValue(found.release.draft, `The published release attachment ${mismatch} does not match its manifest; recover its original bytes.`);
|
|
168
|
+
await fs.rm(incoming, { recursive: true });
|
|
169
|
+
console.error(`The draft release for ${tag} is incomplete (attachment ${mismatch} does not match its manifest); building and sealing again.`);
|
|
170
|
+
} else {
|
|
171
|
+
await writeReceipt(directory, found.release.manifestSha256, incoming);
|
|
172
|
+
await writeRetention({ releaseId: found.release.id, attachments: found.attachments.map(({ id, name, size, uuid, sha256 }) =>
|
|
173
|
+
({ id, name, size, uuid, sha256 })) }, found.release.manifestSha256, incoming);
|
|
174
|
+
console.error(`Resuming from the ${found.release.draft ? 'retained draft' : 'published'} release for ${tag} (manifest sha256 ${found.release.manifestSha256}); nothing is built.`);
|
|
175
|
+
retained = true;
|
|
176
|
+
}
|
|
177
|
+
} else if (found.state === 'incomplete') {
|
|
178
|
+
console.error(`The draft release for ${tag} is incomplete (${found.reason}); building and sealing again.`);
|
|
179
|
+
}
|
|
180
|
+
await setOutputs(retained ? { retained: 'true', manifest: found.release.manifestSha256 } : { retained: 'false' });
|
|
117
181
|
} else if (command === 'prepare') {
|
|
118
|
-
requireValue(await
|
|
119
|
-
'Fresh preparation requires an absent output root; reuse retained output instead.');
|
|
182
|
+
requireValue(await absent(output), 'Fresh preparation requires an absent output root.');
|
|
120
183
|
const verified = await verify(await runAdapter(config.prepareCommand));
|
|
121
|
-
|
|
122
|
-
|
|
184
|
+
// The component must be able to reuse exactly what it prepared.
|
|
185
|
+
const reused = await verify(await runAdapter(config.verifyCommand));
|
|
186
|
+
requireValue(reused.directory === verified.directory && reused.manifestSha256 === verified.manifestSha256,
|
|
187
|
+
'Component reuse does not match the prepared release.');
|
|
188
|
+
await writeReceipt(path.basename(verified.directory), verified.manifestSha256);
|
|
123
189
|
await setOutputs({ manifest: verified.manifestSha256 });
|
|
190
|
+
} else if (command === 'retain') {
|
|
191
|
+
requireValue(await absent(path.join(output, retentionName)), 'This output was already retained.');
|
|
192
|
+
const verified = await verifiedSet();
|
|
193
|
+
const retained = await api().retain({ tag, commit, manifestSha256: verified.manifestSha256, files: verified.files });
|
|
194
|
+
await writeRetention(retained, verified.manifestSha256);
|
|
195
|
+
console.log(JSON.stringify({ retained: true, releaseId: retained.releaseId, manifestSha256: verified.manifestSha256 }));
|
|
196
|
+
} else if (command === 'restore') {
|
|
197
|
+
requireValue(await fs.realpath(incoming) === incoming, 'Expected a fresh canonical retained download.');
|
|
198
|
+
requireValue(await absent(output), 'Restoring retained bytes requires an absent output root.');
|
|
199
|
+
await fs.rename(incoming, output);
|
|
200
|
+
// The retained bytes are hash-bound to the release's manifest digest, which was written only after the
|
|
201
|
+
// component's verifyCommand passed; TsPack verifies them against that digest and the tagged commit.
|
|
202
|
+
const verified = await verifiedSet();
|
|
203
|
+
console.log(JSON.stringify({ restored: true, manifestSha256: verified.manifestSha256 }));
|
|
124
204
|
} else {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
(!process.env.EXPECTED_MANIFEST || process.env.EXPECTED_MANIFEST === receipt.manifestSha256), 'Retained release receipt mismatch.');
|
|
137
|
-
const verified = await verify(await runAdapter(config.verifyCommand));
|
|
138
|
-
requireValue(verified.directory === path.join(output, receipt.directory) && verified.manifestSha256 === receipt.manifestSha256,
|
|
139
|
-
'Component reuse does not match the retained release receipt.');
|
|
140
|
-
if (command === 'publish') {
|
|
141
|
-
requireValue((await exec('git', ['rev-parse', 'HEAD'], { cwd: root })).stdout.trim() === commit &&
|
|
142
|
-
!(await exec('git', ['status', '--porcelain'], { cwd: root })).stdout.trim(), 'Source changed during component verification.');
|
|
143
|
-
requireValue(await api().findRetention({ name: artifactName, runId: Number(process.env.GITHUB_RUN_ID), tag }), 'Publication requires retained artifacts.');
|
|
144
|
-
const files = [];
|
|
145
|
-
for (const name of [...verified.manifest.artifacts.map((file) => file.name), 'tspack-manifest.json', 'SHA256SUMS.txt']) {
|
|
146
|
-
const file = path.join(verified.directory, name);
|
|
147
|
-
files.push({ name, ...await digest(file), blob: () => openAsBlob(file) });
|
|
148
|
-
}
|
|
149
|
-
console.log(JSON.stringify(await api().publish({ tag, commit, manifestSha256: verified.manifestSha256, files })));
|
|
150
|
-
} else console.log(JSON.stringify({ restored: true, manifestSha256: verified.manifestSha256 }));
|
|
205
|
+
const verified = await verifiedSet();
|
|
206
|
+
requireValue((await exec('git', ['rev-parse', 'HEAD'], { cwd: root })).stdout.trim() === commit &&
|
|
207
|
+
!(await exec('git', ['status', '--porcelain'], { cwd: root })).stdout.trim(), 'Source changed during component verification.');
|
|
208
|
+
const retention = await readJson(path.join(output, retentionName));
|
|
209
|
+
requireValue(retention.format === 'gitzone.sealed-retention' && retention.tag === tag && retention.commit === commit &&
|
|
210
|
+
retention.manifestSha256 === verified.manifestSha256 && Array.isArray(retention.attachments) &&
|
|
211
|
+
retention.attachments.length === verified.files.length && verified.files.every((file) => retention.attachments.some((item) =>
|
|
212
|
+
item?.name === file.name && item.size === file.size && item.sha256 === file.sha256)),
|
|
213
|
+
'Publication requires the retained release of exactly these sealed files.');
|
|
214
|
+
console.log(JSON.stringify(await api().publish({ tag, commit, manifestSha256: verified.manifestSha256,
|
|
215
|
+
releaseId: retention.releaseId, attachments: retention.attachments })));
|
|
151
216
|
}
|
|
152
217
|
} catch (error) {
|
|
153
218
|
// Deliberately omit transport errors, response bodies and token-bearing URLs. Component stderr is already in the job log.
|
|
154
219
|
console.error(error instanceof Error && error.message && !error.message.includes('\n') && !error.message.includes('://')
|
|
155
|
-
? error.message : 'Sealed release operation failed.
|
|
220
|
+
? error.message : 'Sealed release operation failed. Rerun the job; the draft release keeps what it retained.');
|
|
156
221
|
process.exitCode = 1;
|
|
157
222
|
}
|
|
@@ -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
|
+
version: '8.7.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
|
};
|
|
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,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5naXR6b25lY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvY2xhc3Nlcy5naXR6b25lY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBQ3hDLE9BQU8sS0FBSyxLQUFLLE1BQU0sWUFBWSxDQUFDO0FBMEJwQzs7R0FFRztBQUNILE1BQU0sT0FBTyxhQUFhO0lBQ2pCLE1BQU0sQ0FBQyxLQUFLLENBQUMsT0FBTztRQUN6QixNQUFNLGFBQWEsR0FBRyxJQUFJLGFBQWEsRUFBRSxDQUFDO1FBQzFDLE1BQU0sYUFBYSxDQUFDLGlCQUFpQixFQUFFLENBQUM7UUFDeEMsT0FBTyxhQUFhLENBQUM7SUFDdkIsQ0FBQztJQUVNLElBQUksQ0FBc0I7SUFFMUIsS0FBSyxDQUFDLGlCQUFpQjtRQUM1QixNQUFNLG1CQUFtQixHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxXQUFXLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQzNFLElBQUksQ0FBQyxJQUFJLEdBQUcsbUJBQW1CLENBQUMsT0FBTyxDQUFxQixlQUFlLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFDbkYsQ0FBQztJQUVELGdCQUFlLENBQUM7Q0FDakIifQ==
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5wYWNrYWdlZ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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
|