@git.zone/cli 8.10.1 → 9.0.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.
Files changed (69) hide show
  1. package/assets/templates/{asset_deno_binary_installer → asset_binary_installer}/install.sh +2 -2
  2. package/assets/templates/{asset_deno_binary_postinstall → asset_binary_postinstall}/bin/wrapper.js +2 -2
  3. package/assets/templates/{asset_deno_binary_postinstall → asset_binary_postinstall}/scripts/install-binary.js +2 -2
  4. package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +180 -0
  5. package/assets/templates/asset_tspack_release_gitea/.gitea/workflows/release.yml +7 -4
  6. package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.d.mts +9 -3
  7. package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.mjs +50 -6
  8. package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-release-api.mjs +7 -6
  9. package/dist_ts/00_commitinfo_data.js +2 -2
  10. package/dist_ts/helpers.managedassets.d.ts +44 -0
  11. package/dist_ts/helpers.managedassets.js +166 -0
  12. package/dist_ts/helpers.ownerscopes.d.ts +4 -16
  13. package/dist_ts/helpers.ownerscopes.js +5 -16
  14. package/dist_ts/helpers.packagefiles.d.ts +2 -1
  15. package/dist_ts/helpers.packagefiles.js +7 -4
  16. package/dist_ts/helpers.sealedrelease.js +3 -3
  17. package/dist_ts/helpers.tssea.d.ts +11 -0
  18. package/dist_ts/helpers.tssea.js +81 -0
  19. package/dist_ts/helpers.workflow.d.ts +2 -3
  20. package/dist_ts/helpers.workflow.js +9 -19
  21. package/dist_ts/index.d.ts +1 -1
  22. package/dist_ts/index.js +2 -2
  23. package/dist_ts/mod_commit/mod.helpers.d.ts +8 -21
  24. package/dist_ts/mod_commit/mod.helpers.js +32 -83
  25. package/dist_ts/mod_commit/mod.ui.js +1 -5
  26. package/dist_ts/mod_config/index.js +41 -33
  27. package/dist_ts/mod_format/formatters/assets.formatter.js +42 -92
  28. package/dist_ts/mod_format/formatters/packagejson.formatter.js +3 -3
  29. package/dist_ts/mod_format/index.js +30 -11
  30. package/dist_ts/mod_format/interfaces.format.js +1 -2
  31. package/dist_ts/mod_release/classes.releasejournal.d.ts +63 -2
  32. package/dist_ts/mod_release/classes.releasejournal.js +247 -48
  33. package/dist_ts/mod_release/helpers.giteaassets.js +18 -9
  34. package/dist_ts/mod_release/helpers.releasepreparation.d.ts +6 -14
  35. package/dist_ts/mod_release/helpers.releasepreparation.js +27 -53
  36. package/dist_ts/mod_release/index.js +108 -13
  37. package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +2 -2
  38. package/dist_ts/mod_services/classes.serviceoptions.d.ts +2 -2
  39. package/dist_ts/plugins.d.ts +3 -1
  40. package/dist_ts/plugins.js +4 -2
  41. package/package.json +3 -2
  42. package/readme.md +153 -74
  43. package/ts/00_commitinfo_data.ts +1 -1
  44. package/ts/helpers.managedassets.ts +215 -0
  45. package/ts/helpers.ownerscopes.ts +4 -15
  46. package/ts/helpers.packagefiles.ts +6 -3
  47. package/ts/helpers.sealedrelease.ts +2 -2
  48. package/ts/helpers.tssea.ts +102 -0
  49. package/ts/helpers.workflow.ts +12 -28
  50. package/ts/index.ts +1 -1
  51. package/ts/mod_commit/mod.helpers.ts +33 -94
  52. package/ts/mod_commit/mod.ui.ts +0 -4
  53. package/ts/mod_config/index.ts +47 -35
  54. package/ts/mod_format/formatters/assets.formatter.ts +47 -108
  55. package/ts/mod_format/formatters/packagejson.formatter.ts +2 -2
  56. package/ts/mod_format/index.ts +36 -10
  57. package/ts/mod_format/interfaces.format.ts +0 -1
  58. package/ts/mod_release/classes.releasejournal.ts +323 -52
  59. package/ts/mod_release/helpers.giteaassets.ts +19 -10
  60. package/ts/mod_release/helpers.releasepreparation.ts +36 -69
  61. package/ts/mod_release/index.ts +138 -18
  62. package/ts/mod_services/classes.serviceconfiguration.ts +2 -2
  63. package/ts/mod_services/classes.serviceoptions.ts +2 -2
  64. package/ts/plugins.ts +4 -0
  65. package/assets/templates/asset_deno_binary_release_gitea/.gitea/workflows/release.yml +0 -154
  66. package/assets/templates/multienv/deno.json +0 -8
  67. package/dist_ts/mod_format/formatters/deno.formatter.d.ts +0 -18
  68. package/dist_ts/mod_format/formatters/deno.formatter.js +0 -175
  69. package/ts/mod_format/formatters/deno.formatter.ts +0 -219
@@ -0,0 +1,215 @@
1
+ import * as plugins from './plugins.js';
2
+ import { isPlainObject } from './helpers.objects.js';
3
+ import { resolveProjectTsseaOutputs, type ITsseaOutput } from './helpers.tssea.js';
4
+
5
+ /** The managed asset kinds `@git.zone/cli.assets.kind` accepts. */
6
+ export const managedAssetKinds = ['binaryCli', 'tspackRelease'] as const;
7
+ export type TManagedAssetKind = (typeof managedAssetKinds)[number];
8
+
9
+ /** The operating system names the installer uses. */
10
+ export type TBinaryTargetOs = 'linux' | 'macos' | 'windows';
11
+
12
+ /** One executable `@git.zone/tssea` builds, as the managed installer, npm wrapper and release workflow address it. */
13
+ export interface IBinaryTarget {
14
+ /** The tssea target, e.g. `linux-x64`. */
15
+ target: ITsseaOutput['target'];
16
+ /** The exact executable file name, which is also its release asset name. */
17
+ name: string;
18
+ /** The installer's operating system label (`uname -s` mapped). */
19
+ os: TBinaryTargetOs;
20
+ arch: ITsseaOutput['arch'];
21
+ /** `<process.platform>:<process.arch>`, the npm wrapper's lookup key. */
22
+ nodeKey: string;
23
+ /** Human-readable platform, e.g. `macOS ARM64`. */
24
+ label: string;
25
+ /** The notice files tssea writes next to the executable. */
26
+ noticeFiles: string[];
27
+ }
28
+
29
+ /** The executables of a `binaryCli` project. */
30
+ export interface IBinaryBuild {
31
+ /** tssea's output directory, relative to the project, `/`-separated. */
32
+ outDir: string;
33
+ targets: IBinaryTarget[];
34
+ }
35
+
36
+ const osOfPlatform = (platformArg: ITsseaOutput['platform']): TBinaryTargetOs => {
37
+ switch (platformArg) {
38
+ case 'linux':
39
+ return 'linux';
40
+ case 'darwin':
41
+ return 'macos';
42
+ case 'win32':
43
+ return 'windows';
44
+ default: {
45
+ const unknownPlatform: never = platformArg;
46
+ throw new Error(`Unknown tssea platform: ${String(unknownPlatform)}`);
47
+ }
48
+ }
49
+ };
50
+
51
+ const osLabel = (osArg: TBinaryTargetOs): string => {
52
+ switch (osArg) {
53
+ case 'linux':
54
+ return 'Linux';
55
+ case 'macos':
56
+ return 'macOS';
57
+ case 'windows':
58
+ return 'Windows';
59
+ default: {
60
+ const unknownOs: never = osArg;
61
+ throw new Error(`Unknown operating system: ${String(unknownOs)}`);
62
+ }
63
+ }
64
+ };
65
+
66
+ const archLabel = (archArg: ITsseaOutput['arch']): string => {
67
+ switch (archArg) {
68
+ case 'x64':
69
+ return 'x64';
70
+ case 'arm64':
71
+ return 'ARM64';
72
+ default: {
73
+ const unknownArch: never = archArg;
74
+ throw new Error(`Unknown tssea architecture: ${String(unknownArch)}`);
75
+ }
76
+ }
77
+ };
78
+
79
+ /**
80
+ * The executables of the project's `@git.zone/tssea` configuration, resolved by the tssea
81
+ * the project installs. The output directory must lie inside the project, because the
82
+ * release workflow addresses it from the checkout.
83
+ */
84
+ export const readBinaryBuild = async (
85
+ projectDirArg: string,
86
+ smartconfigDataArg: Record<string, unknown>,
87
+ ): Promise<IBinaryBuild> => {
88
+ const resolved = await resolveProjectTsseaOutputs(projectDirArg, smartconfigDataArg);
89
+ const relativeOutDir = plugins.path.relative(plugins.path.resolve(projectDirArg), resolved.outDir);
90
+ if (!relativeOutDir || relativeOutDir.startsWith('..') || plugins.path.isAbsolute(relativeOutDir)) {
91
+ throw new Error(
92
+ `@git.zone/tssea.outDir resolves to ${resolved.outDir}, which is not a directory inside the project: binaryCli releases its executables from the project checkout.`,
93
+ );
94
+ }
95
+ return {
96
+ outDir: relativeOutDir.split(plugins.path.sep).join('/'),
97
+ targets: resolved.outputs.map((outputArg) => {
98
+ const os = osOfPlatform(outputArg.platform);
99
+ return {
100
+ target: outputArg.target,
101
+ name: outputArg.name,
102
+ os,
103
+ arch: outputArg.arch,
104
+ nodeKey: `${outputArg.platform}:${outputArg.arch}`,
105
+ label: `${osLabel(os)} ${archLabel(outputArg.arch)}`,
106
+ noticeFiles: [...outputArg.noticeFiles],
107
+ };
108
+ }),
109
+ };
110
+ };
111
+
112
+ const removedIn = 'was removed in @git.zone/cli 9';
113
+
114
+ /** The value at a key path inside `@git.zone/cli.assets`; undefined when any segment is missing. */
115
+ const valueAt = (rootArg: Record<string, unknown>, pathArg: string[]): unknown => {
116
+ let value: unknown = rootArg;
117
+ for (const segment of pathArg) {
118
+ if (!isPlainObject(value)) {
119
+ return undefined;
120
+ }
121
+ value = value[segment];
122
+ }
123
+ return value;
124
+ };
125
+
126
+ /** Keys of the binary asset model that @git.zone/cli 9 removed, with the key that replaces each. */
127
+ const removedBinaryCliKeys: ReadonlyArray<{ path: string[]; replacement: string }> = [
128
+ {
129
+ path: ['binary', 'targets'],
130
+ replacement: 'binaryCli builds the targets of @git.zone/tssea.targets',
131
+ },
132
+ {
133
+ path: ['binary', 'outDir'],
134
+ replacement: 'binaryCli reads the output directory from @git.zone/tssea.outDir',
135
+ },
136
+ { path: ['releaseAssets'], replacement: 'use @git.zone/cli.assets.releaseWorkflow' },
137
+ { path: ['rawBranch'], replacement: 'use @git.zone/cli.assets.repository.branch' },
138
+ { path: ['repository', 'rawBranch'], replacement: 'use @git.zone/cli.assets.repository.branch' },
139
+ { path: ['installer', 'delivery'], replacement: 'use @git.zone/cli.assets.installer.distribution' },
140
+ { path: ['installer', 'defaultMode'], replacement: 'use @git.zone/cli.assets.installer.modes.default' },
141
+ { path: ['installer', 'source'], replacement: 'use @git.zone/cli.assets.installer.modes.source' },
142
+ {
143
+ path: ['installer', 'modes', 'source', 'validateCommand'],
144
+ replacement: 'use @git.zone/cli.assets.installer.modes.source.validate',
145
+ },
146
+ {
147
+ path: ['installer', 'service', 'legacyUnitNames'],
148
+ replacement: 'use @git.zone/cli.assets.installer.service.removeLegacyUnits',
149
+ },
150
+ {
151
+ path: ['releaseWorkflow', 'assetGlobs'],
152
+ replacement: 'the release workflow uploads exactly the @git.zone/tssea executables, their notice files and SHA256SUMS.txt',
153
+ },
154
+ {
155
+ path: ['releaseWorkflow', 'include'],
156
+ replacement: 'the release workflow uploads exactly the @git.zone/tssea executables, their notice files and SHA256SUMS.txt',
157
+ },
158
+ ];
159
+
160
+ /** The binary asset templates @git.zone/cli 9 renamed. */
161
+ const renamedTemplates: Readonly<Record<string, string>> = {
162
+ asset_deno_binary_installer: 'asset_binary_installer',
163
+ asset_deno_binary_postinstall: 'asset_binary_postinstall',
164
+ asset_deno_binary_release_gitea: 'asset_binary_release_gitea',
165
+ };
166
+
167
+ /**
168
+ * The configuration errors of an enabled `@git.zone/cli.assets` object that come from
169
+ * keys @git.zone/cli 9 removed or renamed. Each message names the migration.
170
+ */
171
+ export const getManagedAssetsMigrationErrors = (assetsArg: Record<string, unknown>): string[] => {
172
+ const errors: string[] = [];
173
+ if (assetsArg.kind === 'denoBinaryCli') {
174
+ errors.push(
175
+ `Managed asset kind "denoBinaryCli" ${removedIn}: set @git.zone/cli.assets.kind to "binaryCli" and move @git.zone/tsdeno.compileTargets to @git.zone/tssea.targets (see "Migrating from tsdeno" in the @git.zone/tssea readme).`,
176
+ );
177
+ }
178
+ if (assetsArg.kind === 'binaryCli' || assetsArg.kind === 'denoBinaryCli') {
179
+ for (const removed of removedBinaryCliKeys) {
180
+ if (valueAt(assetsArg, removed.path) !== undefined) {
181
+ errors.push(`@git.zone/cli.assets.${removed.path.join('.')} ${removedIn}: ${removed.replacement}.`);
182
+ }
183
+ }
184
+ }
185
+ if (isPlainObject(assetsArg.sealedRelease) && assetsArg.sealedRelease.denoVersion !== undefined) {
186
+ errors.push(
187
+ `@git.zone/cli.assets.sealedRelease.denoVersion ${removedIn}: set sealedRelease.nodeVersion to the exact Node.js release (x.y.z) that runs the prepare and verify commands.`,
188
+ );
189
+ }
190
+ if (Array.isArray(assetsArg.managed)) {
191
+ for (const entry of assetsArg.managed) {
192
+ const template = isPlainObject(entry) ? entry.template : undefined;
193
+ if (typeof template === 'string' && renamedTemplates[template]) {
194
+ errors.push(
195
+ `Managed asset template "${template}" was renamed in @git.zone/cli 9: use "${renamedTemplates[template]}".`,
196
+ );
197
+ }
198
+ }
199
+ }
200
+ return errors;
201
+ };
202
+
203
+ /**
204
+ * Throws the migration errors of an enabled `@git.zone/cli.assets` object, so every
205
+ * reader of the asset model refuses a removed key the same way.
206
+ */
207
+ export const assertManagedAssetsCurrent = (assetsArg: unknown): void => {
208
+ if (!isPlainObject(assetsArg) || assetsArg.enabled === false) {
209
+ return;
210
+ }
211
+ const errors = getManagedAssetsMigrationErrors(assetsArg);
212
+ if (errors.length > 0) {
213
+ throw new Error(errors.join('\n'));
214
+ }
215
+ };
@@ -1,12 +1,8 @@
1
1
  /**
2
2
  * The npm scopes the owner publishes under. A release-age rule (pnpm
3
- * `minimumReleaseAge`, Deno `minimumDependencyAge`) holds back freshly
4
- * published third-party versions; it must never hold back our own packages,
5
- * which are consumed right after their release.
6
- *
7
- * This list is the single source for those exemptions. `gitzone format`
8
- * writes it into the root `deno.json` as `minimumDependencyAge.exclude`
9
- * (`npm:<scope>/*` per scope), so no repository keeps a hand-copied list.
3
+ * `minimumReleaseAge`) holds back freshly published third-party versions; it
4
+ * must never hold back our own packages, which are consumed right after their
5
+ * release. This list is the single source for those exemptions.
10
6
  */
11
7
  export const ownerNpmScopes = [
12
8
  '@api.global',
@@ -44,6 +40,7 @@ export const ownerNpmScopes = [
44
40
  '@losslessone_private',
45
41
  '@losslessone_websites',
46
42
  '@maintainable.xyz',
43
+ '@metadata.company',
47
44
  '@modelgrid.com',
48
45
  '@modelprofile.com',
49
46
  '@mojoio',
@@ -73,11 +70,3 @@ export const ownerNpmScopes = [
73
70
  '@workspace.global_private',
74
71
  ] as const;
75
72
 
76
- /**
77
- * The minimum dependency age `gitzone format` writes into a root `deno.json`
78
- * that sets none (a missing or `null` age): 7 days, as an ISO 8601 duration.
79
- * It mirrors the owner's pnpm `minimumReleaseAge` of 10080 minutes, so
80
- * third-party packages wait as long under Deno as under pnpm. An age a project
81
- * already sets is never changed.
82
- */
83
- export const ownerMinimumDependencyAge = 'P7D';
@@ -1,6 +1,7 @@
1
1
  import * as plugins from "./plugins.js";
2
2
  import { getCliNamespaceConfig, readSmartconfigFile } from "./helpers.smartconfig.js";
3
3
  import { isPlainObject } from "./helpers.objects.js";
4
+ import { assertManagedAssetsCurrent } from "./helpers.managedassets.js";
4
5
 
5
6
  /**
6
7
  * The named groups of package.json `files` entries, in the order the generated
@@ -62,17 +63,19 @@ const configPath = "@git.zone/cli.packageFiles";
62
63
 
63
64
  /**
64
65
  * The sets as they stand for one project. `binary` carries the installer and
65
- * npm wrapper of managed `denoBinaryCli` assets and is empty otherwise.
66
+ * npm wrapper of managed `binaryCli` assets and is empty otherwise. Assets that
67
+ * use a key @git.zone/cli 9 removed are refused with the migration.
66
68
  */
67
69
  export const getPackageFileSets = (
68
70
  assetsArg: IPackageFilesAssetsConfig | undefined,
69
71
  ): Record<TPackageFileSetName, IPackageFileSet> => {
72
+ assertManagedAssetsCurrent(assetsArg);
70
73
  const assets = assetsArg?.enabled === false ? undefined : assetsArg;
71
74
  const binary: string[] = [];
72
- if (assets?.kind === "denoBinaryCli" && assets.installer?.enabled !== false) {
75
+ if (assets?.kind === "binaryCli" && assets.installer?.enabled !== false) {
73
76
  binary.push(assets.installer?.file || "install.sh");
74
77
  }
75
- if (assets?.kind === "denoBinaryCli" && assets.npmWrapper?.enabled) {
78
+ if (assets?.kind === "binaryCli" && assets.npmWrapper?.enabled) {
76
79
  binary.push("bin/");
77
80
  binary.push(assets.npmWrapper.postinstallFile || "scripts/install-binary.js");
78
81
  }
@@ -2,12 +2,12 @@
2
2
  export const getSealedReleaseConfigError = (value: unknown): string | undefined => {
3
3
  const config = value as Record<string, unknown> | null;
4
4
  if (!config || typeof config !== 'object' || Array.isArray(config) ||
5
- typeof config.denoVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(config.denoVersion) ||
5
+ typeof config.nodeVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(config.nodeVersion) ||
6
6
  typeof config.outputDirectory !== 'string' || !/^dist_[a-zA-Z0-9_-]+$/.test(config.outputDirectory) ||
7
7
  config.outputDirectory === 'dist_gitzone_retained' ||
8
8
  !['prepareCommand', 'verifyCommand'].every((key) => Array.isArray(config[key]) && config[key].length > 0 &&
9
9
  config[key].every((item: unknown) => typeof item === 'string' && item.length > 0 && !item.includes('\0')))) {
10
- return 'tspackRelease requires a pinned Deno version, a dist_ output directory and explicit prepare/verify command arrays.';
10
+ return 'tspackRelease requires an exact Node.js version (sealedRelease.nodeVersion, x.y.z), a dist_ output directory and explicit prepare/verify command arrays.';
11
11
  }
12
12
  return undefined;
13
13
  };
@@ -0,0 +1,102 @@
1
+ import type { ITsseaOutputs, resolveOutputs } from '@git.zone/tssea/config';
2
+ import * as plugins from './plugins.js';
3
+ import { isPlainObject } from './helpers.objects.js';
4
+
5
+ export type { ITsseaOutput, ITsseaOutputs } from '@git.zone/tssea/config';
6
+
7
+ /** The tssea package whose `./config` export resolves a project's executables. */
8
+ export const tsseaPackageName = '@git.zone/tssea';
9
+
10
+ /** The `@git.zone/tssea` versions whose `./config` export this CLI reads: `^1.1.0`. */
11
+ export const supportedTsseaRange = '^1.1.0';
12
+
13
+ /** The `./config` module of the project's tssea; loaded at run time from the project, typed from the CLI's devDependency. */
14
+ interface ITsseaConfigModule {
15
+ resolveOutputs: typeof resolveOutputs;
16
+ }
17
+
18
+ /** A tssea failure, recognized by shape: `instanceof` fails across package copies. */
19
+ const isTsseaError = (errorArg: unknown): errorArg is Error & { code: string } =>
20
+ errorArg instanceof Error &&
21
+ errorArg.name === 'TsseaError' &&
22
+ typeof (errorArg as Error & { code?: unknown }).code === 'string';
23
+
24
+ /** Whether an exact `x.y.z` version satisfies `^1.1.0`; prereleases do not. */
25
+ const isSupportedTsseaVersion = (versionArg: string): boolean => {
26
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(versionArg);
27
+ if (!match) {
28
+ return false;
29
+ }
30
+ const [major, minor] = [Number(match[1]), Number(match[2])];
31
+ return major === 1 && minor >= 1;
32
+ };
33
+
34
+ const readProjectManifest = async (projectDirArg: string): Promise<Record<string, unknown>> => {
35
+ const manifestPath = plugins.path.join(projectDirArg, 'package.json');
36
+ let content: string;
37
+ try {
38
+ content = await plugins.fs.readFile(manifestPath, 'utf8');
39
+ } catch (error) {
40
+ throw new Error(`binaryCli assets need the project's package.json: ${manifestPath} cannot be read.`, {
41
+ cause: error,
42
+ });
43
+ }
44
+ const manifest: unknown = JSON.parse(content);
45
+ if (!isPlainObject(manifest)) {
46
+ throw new Error(`${manifestPath} does not hold a JSON object.`);
47
+ }
48
+ return manifest;
49
+ };
50
+
51
+ const declaresDependency = (manifestArg: Record<string, unknown>, nameArg: string): boolean =>
52
+ ['dependencies', 'devDependencies'].some((fieldArg) => {
53
+ const field = manifestArg[fieldArg];
54
+ return isPlainObject(field) && typeof field[nameArg] === 'string';
55
+ });
56
+
57
+ /**
58
+ * Resolves the executables of the project's `@git.zone/tssea` configuration with the tssea
59
+ * the project itself installs, so the project's tssea version interprets its own config.
60
+ */
61
+ export const resolveProjectTsseaOutputs = async (
62
+ projectDirArg: string,
63
+ smartconfigDataArg: Record<string, unknown>,
64
+ ): Promise<ITsseaOutputs> => {
65
+ const manifest = await readProjectManifest(projectDirArg);
66
+ if (!declaresDependency(manifest, tsseaPackageName)) {
67
+ throw new Error(
68
+ `binaryCli builds with ${tsseaPackageName}; \`pnpm install --save-dev ${tsseaPackageName}\`, then rerun.`,
69
+ );
70
+ }
71
+ // The project's own direct link, never one an ancestor folder would resolve.
72
+ const installPath = plugins.path.join(projectDirArg, 'node_modules', ...tsseaPackageName.split('/'));
73
+ try {
74
+ await plugins.fs.lstat(installPath);
75
+ } catch {
76
+ throw new Error(`${tsseaPackageName} is declared but not installed in ${projectDirArg}: run \`pnpm install\`, then rerun.`);
77
+ }
78
+ const projectRequire = plugins.nodeModule.createRequire(plugins.path.join(projectDirArg, 'package.json'));
79
+ const installedManifest: unknown = projectRequire(`${tsseaPackageName}/package.json`);
80
+ const installedVersion =
81
+ isPlainObject(installedManifest) && typeof installedManifest.version === 'string'
82
+ ? installedManifest.version
83
+ : 'unknown';
84
+ if (!isSupportedTsseaVersion(installedVersion)) {
85
+ const newerMajor = /^(\d+)\./.exec(installedVersion);
86
+ throw new Error(
87
+ newerMajor && Number(newerMajor[1]) > 1
88
+ ? `The project installs ${tsseaPackageName} ${installedVersion}, but this @git.zone/cli supports ${supportedTsseaRange}: update @git.zone/cli.`
89
+ : `The project installs ${tsseaPackageName} ${installedVersion}, but this @git.zone/cli supports ${supportedTsseaRange}: upgrade ${tsseaPackageName} in the project.`,
90
+ );
91
+ }
92
+ const configModuleUrl = plugins.nodeUrl.pathToFileURL(projectRequire.resolve(`${tsseaPackageName}/config`)).href;
93
+ const configModule = (await import(configModuleUrl)) as ITsseaConfigModule;
94
+ try {
95
+ return configModule.resolveOutputs(smartconfigDataArg[tsseaPackageName], projectDirArg);
96
+ } catch (error) {
97
+ if (isTsseaError(error)) {
98
+ throw new Error(`${tsseaPackageName}: ${error.message} [${error.code}]`, { cause: error });
99
+ }
100
+ throw error;
101
+ }
102
+ };
@@ -1,10 +1,5 @@
1
1
  import { getCliConfigValue } from "./helpers.smartconfig.js";
2
2
  import { shouldCleanTestArtifactsOnRelease } from "./helpers.tstest.js";
3
- import {
4
- detectProjectType,
5
- projectTypeHasPackageJson,
6
- type ProjectType,
7
- } from "./mod_commit/mod.helpers.js";
8
3
  import {
9
4
  parseReleaseVersionFloor,
10
5
  parseReleasePrerelease,
@@ -321,8 +316,6 @@ export interface IResolvedReleaseWorkflow {
321
316
  confirmation: TConfirmationMode;
322
317
  recordRetention: number;
323
318
  plan: string[];
324
- /** Version files and dependency installation the project owns. */
325
- projectType: ProjectType;
326
319
  targets: TReleaseTarget[];
327
320
  runTests: boolean;
328
321
  runBuild: boolean;
@@ -809,7 +802,6 @@ const buildReleasePlan = (options: {
809
802
  mergeRequested: boolean;
810
803
  runTests: boolean;
811
804
  runBuild: boolean;
812
- projectType: ProjectType;
813
805
  targets: TReleaseTarget[];
814
806
  npmModules: boolean;
815
807
  cleanTestArtifacts: boolean;
@@ -819,14 +811,9 @@ const buildReleasePlan = (options: {
819
811
  const plan: string[] = ["preflight.branch", "preflight.cleanTree"];
820
812
  // package.json files must be what `.smartconfig.json` packageFiles generates.
821
813
  if (options.packageFiles) plan.push("preflight.packageFiles");
822
- // Only a checkout with a package.json installs from a committed pnpm
823
- // lockfile, so only such a release proves that install before it creates its
824
- // commit and tag. A Deno-only project has no pnpm lockfile to prove.
825
- if (
826
- releaseNeedsIsolatedCheckout(options) &&
827
- projectTypeHasPackageJson(options.projectType)
828
- )
829
- plan.push("preflight.lockfile");
814
+ // A release checkout installs from the committed pnpm lockfile, so the
815
+ // release proves that install before it creates its commit and tag.
816
+ if (releaseNeedsIsolatedCheckout(options)) plan.push("preflight.lockfile");
830
817
  // Every npm release reads the registries' dist-tags before it creates
831
818
  // anything: `latest` never moves downwards, and a line takes it only when
832
819
  // its dist-tag is `latest` and every higher major is a prerelease.
@@ -886,6 +873,12 @@ export const resolveReleaseRecordRetention = (valueArg: unknown): number => {
886
873
  return valueArg;
887
874
  };
888
875
 
876
+ /** `release.recordRetention` of the current project, for on-demand pruning. */
877
+ export const readReleaseRecordRetention = async (): Promise<number> =>
878
+ resolveReleaseRecordRetention(
879
+ (await readCliWorkflowConfig()).release?.recordRetention,
880
+ );
881
+
889
882
  export const resolveCommitWorkflow = async (
890
883
  argvArg: any,
891
884
  inputMode: "ai" | "manual" = "ai",
@@ -1239,16 +1232,9 @@ export const resolveReleaseWorkflow = async (
1239
1232
  const cleanTestArtifacts = await shouldCleanTestArtifactsOnRelease(
1240
1233
  process.cwd(),
1241
1234
  );
1242
- // The plan names `preflight.lockfile` when the release runs it, and the
1243
- // release core has to know which version files it owns. The release worktree
1244
- // is clean before anything is created, so the working folder answers both
1245
- // questions the way the release commit does for every tracked manifest; the
1246
- // preflight itself reads the commit. An ignored `package.json` in the working
1247
- // folder of a Deno-only commit is the one case where the plan lists the step
1248
- // and the step then does nothing.
1249
- const projectType = await detectProjectType(process.cwd());
1250
- // The same holds for the npm package set: the release checkout re-reads it
1251
- // from the release commit and refuses to publish a different one.
1235
+ // The release worktree is clean before anything is created, so the working
1236
+ // folder's npm package set is the release commit's: the release checkout
1237
+ // re-reads it from the release commit and refuses to publish a different one.
1252
1238
  const npmPackages = targets.includes("npm")
1253
1239
  ? (await planReleaseNpmPackages(process.cwd())).packageSet
1254
1240
  : undefined;
@@ -1264,7 +1250,6 @@ export const resolveReleaseWorkflow = async (
1264
1250
  mergeRequested,
1265
1251
  runTests,
1266
1252
  runBuild,
1267
- projectType,
1268
1253
  targets,
1269
1254
  npmModules: (npmPackages?.modules.length ?? 0) > 0,
1270
1255
  cleanTestArtifacts,
@@ -1274,7 +1259,6 @@ export const resolveReleaseWorkflow = async (
1274
1259
  recordRetention: resolveReleaseRecordRetention(
1275
1260
  releaseConfig.recordRetention,
1276
1261
  ),
1277
- projectType,
1278
1262
  targets,
1279
1263
  runTests,
1280
1264
  runBuild,
package/ts/index.ts CHANGED
@@ -8,4 +8,4 @@ export const runCli = async () => {
8
8
  });
9
9
  };
10
10
 
11
- export { ownerMinimumDependencyAge, ownerNpmScopes } from './helpers.ownerscopes.js';
11
+ export { ownerNpmScopes } from './helpers.ownerscopes.js';