@theholocron/astromech 5.0.0-alpha.473 → 5.0.0-alpha.475

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1097,6 +1097,91 @@ export declare const RELEASE_BRANCHES: readonly ["main", "alpha"];
1097
1097
  * dist-tag those prereleases carry. It is one of {@link RELEASE_BRANCHES}.
1098
1098
  */
1099
1099
  export declare const PRERELEASE_CHANNEL: "alpha";
1100
+ /** One line a repo releases on: the repo-wide one (tags `v1.2.3`) or a group's (tags `configs-v1.2.3`). */
1101
+ interface ReleaseLine {
1102
+ /** A name for reports: the group's folder, or `repo` for the line of everything outside a group. */
1103
+ id: string;
1104
+ /** What comes before the version in the line's tags: `v`, `configs-v`. */
1105
+ tagPrefix: string;
1106
+ /** The npm names of the public packages the line publishes. */
1107
+ packages: readonly string[];
1108
+ }
1109
+ /** A git tag and, when known, when it was made. */
1110
+ interface GitTag {
1111
+ /** The tag's name: `v1.2.3`. */
1112
+ name: string;
1113
+ /** Seconds since the epoch. */
1114
+ createdAt?: number;
1115
+ }
1116
+ /** A package's dist-tags on npm (`{ latest: "1.0.0", alpha: "1.1.0-alpha.2" }`), or `undefined` when it is not on npm. */
1117
+ type NpmDistTags = Readonly<Record<string, string>> | undefined;
1118
+ /** How a line's newest tag on one channel compares with npm. */
1119
+ type ReleaseTagState =
1120
+ /** Every package serves that version or a later one. */
1121
+ "published" |
1122
+ /** Some package serves an older version (or none), and the tag is older than the grace period. */
1123
+ "wedged" |
1124
+ /** Some package serves an older version, but the tag is so new its release may still be publishing. */
1125
+ "pending";
1126
+ /** A package that does not serve the line's newest tag. */
1127
+ interface PackageBehind {
1128
+ /** The npm package name. */
1129
+ name: string;
1130
+ /** What npm serves on the channel's dist-tag, or `undefined` when the package or the dist-tag is not there. */
1131
+ onNpm: string | undefined;
1132
+ }
1133
+ /** The newest tag of one channel of one release line, against npm. */
1134
+ interface ReleaseTagCheck {
1135
+ /** The `id` of the release line the tag belongs to. */
1136
+ line: string;
1137
+ /** The npm dist-tag the channel publishes to: `latest`, or the first prerelease identifier (`alpha`). */
1138
+ distTag: string;
1139
+ /** The git tag: `configs-v8.9.0-alpha.20`. */
1140
+ tag: string;
1141
+ /** The version in the tag. */
1142
+ version: string;
1143
+ /** Whether npm serves it, is behind it, or may still be receiving it. */
1144
+ state: ReleaseTagState;
1145
+ /** The packages that do not serve it; empty when `published`. */
1146
+ behind: readonly PackageBehind[];
1147
+ }
1148
+ /** What `checkReleaseLines()` compares: the release lines, the repo's git tags and what npm serves. */
1149
+ interface CheckReleaseLinesInput {
1150
+ /** The release lines to check. */
1151
+ lines: readonly ReleaseLine[];
1152
+ /** Every git tag of the repo. */
1153
+ tags: readonly GitTag[];
1154
+ /** The dist-tags of each package name in `lines`. A name missing from the map counts as not on npm. */
1155
+ npm: ReadonlyMap<string, NpmDistTags>;
1156
+ /** The time now, in seconds since the epoch. Only used with `graceSeconds`. */
1157
+ now?: number;
1158
+ /** A tag younger than this is `pending`, not `wedged`: its release job may still be publishing. Default 0. */
1159
+ graceSeconds?: number;
1160
+ }
1161
+ /**
1162
+ * Compares each release line's newest tag, per channel, with what npm serves on that channel's dist-tag.
1163
+ *
1164
+ * semantic-release pushes its tag (and the `refs/notes/semantic-release-<tag>` note) before it publishes, so a publish
1165
+ * that fails leaves a tag npm never received, and every later run sees the tag, finds nothing new and ends green. A
1166
+ * package that serves an older version than the tag, or none at all, is behind. A line with no tag has nothing to
1167
+ * check and gives no entry. A tag newer than `graceSeconds` is `pending`, because its own release may still be
1168
+ * publishing. Pure: tags and npm's answers come in as data.
1169
+ */
1170
+ export declare function checkReleaseLines(input: CheckReleaseLinesInput): ReleaseTagCheck[];
1171
+ /**
1172
+ * Orders two semver versions: negative when `a` is older, positive when newer, 0 when equal (build metadata is
1173
+ * ignored). A prerelease is older than its release, and prerelease identifiers compare as semver says: numbers
1174
+ * numerically and below words, words by their characters, fewer identifiers first. Not a version is a `TypeError`.
1175
+ */
1176
+ export declare function compareVersions(a: string, b: string): number;
1177
+ /**
1178
+ * What to do about a tag npm never received, one line per step. semantic-release's tag and its note
1179
+ * (`refs/notes/semantic-release-<tag>`) both have to go: with the note left behind it still counts the release as
1180
+ * done. The two known causes are named so the log need not be read: a sigstore 409 (the tarball is identical to a
1181
+ * published one, so the change needs different contents) and `ENEEDAUTH` (the Trusted Publisher entries expired, so
1182
+ * `holocron publish package --sync-trust` registers them again).
1183
+ */
1184
+ export declare function wedgeFix(tag: string): string[];
1100
1185
  /**
1101
1186
  * The paths a release must touch to redeploy `pkg` when its manifest doesn't
1102
1187
  * list them: its own folder plus the folder of every
@@ -1305,4 +1390,4 @@ declare function createConfig$8(): string;
1305
1390
  declare function createConfig$9(): string;
1306
1391
  /** The `.yamlignore` body. */
1307
1392
  declare function createIgnoreConfig(): string;
1308
- export { type AggregateChecks, type Astromech, type AstromechOptions, type CiJobReport, type CiOptions, type CiReport, type CreateHeaderOptions, type DependabotConfigOptions, type DeployOnReleaseOptions, type DeployOnReleaseReport, type DeployOnReleaseResult, type WorkspacePackage as DeployWorkspacePackage, type DocsCoverageMode, type ExecFn, type GroupJobReport, type GroupOptions, type GroupReport, type HeaderFunctions, type LegacyTarget, type LocalRunner, type MergedScripts, type OrgContext, type PackageRole, type PackageScriptProblem, type PlannedKind, type PlannedTask, type PreviewConfig, type RepoShape, type RunLogger, type RunOptions, type RunTaskInput, type RunTaskReport, type StatusContext, type TaskDef, type TaskGroup, type TaskScope, type TsconfigOptions, type WorkflowHeaderFormat, type WorkspacePackage$1 as WorkspacePackage, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint };
1393
+ export { type AggregateChecks, type Astromech, type AstromechOptions, type CheckReleaseLinesInput, type CiJobReport, type CiOptions, type CiReport, type CreateHeaderOptions, type DependabotConfigOptions, type DeployOnReleaseOptions, type DeployOnReleaseReport, type DeployOnReleaseResult, type WorkspacePackage as DeployWorkspacePackage, type DocsCoverageMode, type ExecFn, type GitTag, type GroupJobReport, type GroupOptions, type GroupReport, type HeaderFunctions, type LegacyTarget, type LocalRunner, type MergedScripts, type NpmDistTags, type OrgContext, type PackageBehind, type PackageRole, type PackageScriptProblem, type PlannedKind, type PlannedTask, type PreviewConfig, type ReleaseLine, type ReleaseTagCheck, type ReleaseTagState, type RepoShape, type RunLogger, type RunOptions, type RunTaskInput, type RunTaskReport, type StatusContext, type TaskDef, type TaskGroup, type TaskScope, type TsconfigOptions, type WorkflowHeaderFormat, type WorkspacePackage$1 as WorkspacePackage, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint };
package/dist/index.mjs CHANGED
@@ -3828,6 +3828,120 @@ function createAstromech(options) {
3828
3828
  ensureTurboDependency: (packageJson, workspaceYaml) => ensureTurboDependency(packageJson, workspaceYaml)
3829
3829
  };
3830
3830
  }
3831
+ // src/release-tags/compare-versions/compare-versions.ts
3832
+ const PATTERN = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
3833
+ /** Splits a version into its three numbers and prerelease identifiers, or `undefined` when it is not semver. */
3834
+ function parseVersion(version) {
3835
+ const match = PATTERN.exec(version);
3836
+ if (!match) return void 0;
3837
+ return {
3838
+ numbers: [
3839
+ Number(match[1]),
3840
+ Number(match[2]),
3841
+ Number(match[3])
3842
+ ],
3843
+ pre: match[4] ? match[4].split(".") : []
3844
+ };
3845
+ }
3846
+ const isNumeric = (id) => /^\d+$/.test(id);
3847
+ /**
3848
+ * Orders two semver versions: negative when `a` is older, positive when newer, 0 when equal (build metadata is
3849
+ * ignored). A prerelease is older than its release, and prerelease identifiers compare as semver says: numbers
3850
+ * numerically and below words, words by their characters, fewer identifiers first. Not a version is a `TypeError`.
3851
+ */
3852
+ function compareVersions(a, b) {
3853
+ const left = parseVersion(a);
3854
+ const right = parseVersion(b);
3855
+ if (!left || !right) throw new TypeError(`not a semver version: ${left ? b : a}`);
3856
+ for (let i = 0; i < 3; i++) {
3857
+ const diff = left.numbers[i] - right.numbers[i];
3858
+ if (diff !== 0) return diff;
3859
+ }
3860
+ if (left.pre.length === 0 || right.pre.length === 0) return right.pre.length - left.pre.length;
3861
+ for (let i = 0; i < Math.max(left.pre.length, right.pre.length); i++) {
3862
+ const x = left.pre[i];
3863
+ const y = right.pre[i];
3864
+ if (x === void 0) return -1;
3865
+ if (y === void 0) return 1;
3866
+ if (x === y) continue;
3867
+ if (isNumeric(x) && isNumeric(y)) return Number(x) - Number(y);
3868
+ if (isNumeric(x)) return -1;
3869
+ if (isNumeric(y)) return 1;
3870
+ return x < y ? -1 : 1;
3871
+ }
3872
+ return 0;
3873
+ }
3874
+ // src/release-tags/check-release-lines/check-release-lines.ts
3875
+ /** The newest tag of each channel of a line. */
3876
+ function newestTags(line, tags) {
3877
+ const newest = /* @__PURE__ */ new Map();
3878
+ for (const { name, createdAt } of tags) {
3879
+ if (!name.startsWith(line.tagPrefix)) continue;
3880
+ const version = name.slice(line.tagPrefix.length);
3881
+ const parsed = parseVersion(version);
3882
+ if (!parsed) continue;
3883
+ const distTag = parsed.pre.length === 0 ? "latest" : parsed.pre[0];
3884
+ const current = newest.get(distTag);
3885
+ if (current && compareVersions(current.version, version) >= 0) continue;
3886
+ newest.set(distTag, {
3887
+ distTag,
3888
+ tag: name,
3889
+ version,
3890
+ ...createdAt === void 0 ? {} : { createdAt }
3891
+ });
3892
+ }
3893
+ return [...newest.values()];
3894
+ }
3895
+ /**
3896
+ * Compares each release line's newest tag, per channel, with what npm serves on that channel's dist-tag.
3897
+ *
3898
+ * semantic-release pushes its tag (and the `refs/notes/semantic-release-<tag>` note) before it publishes, so a publish
3899
+ * that fails leaves a tag npm never received, and every later run sees the tag, finds nothing new and ends green. A
3900
+ * package that serves an older version than the tag, or none at all, is behind. A line with no tag has nothing to
3901
+ * check and gives no entry. A tag newer than `graceSeconds` is `pending`, because its own release may still be
3902
+ * publishing. Pure: tags and npm's answers come in as data.
3903
+ */
3904
+ function checkReleaseLines(input) {
3905
+ const grace = input.graceSeconds ?? 0;
3906
+ const checks = [];
3907
+ for (const line of input.lines) for (const { distTag, tag, version, createdAt } of newestTags(line, input.tags)) {
3908
+ const behind = [];
3909
+ for (const name of line.packages) {
3910
+ const onNpm = input.npm.get(name)?.[distTag];
3911
+ if (onNpm === void 0 || compareVersions(onNpm, version) < 0) behind.push({
3912
+ name,
3913
+ onNpm
3914
+ });
3915
+ }
3916
+ const fresh = grace > 0 && input.now !== void 0 && createdAt !== void 0 && input.now - createdAt < grace;
3917
+ const state = behind.length === 0 ? "published" : fresh ? "pending" : "wedged";
3918
+ checks.push({
3919
+ line: line.id,
3920
+ distTag,
3921
+ tag,
3922
+ version,
3923
+ state,
3924
+ behind
3925
+ });
3926
+ }
3927
+ return checks;
3928
+ }
3929
+ // src/release-tags/wedge-fix/wedge-fix.ts
3930
+ /**
3931
+ * What to do about a tag npm never received, one line per step. semantic-release's tag and its note
3932
+ * (`refs/notes/semantic-release-<tag>`) both have to go: with the note left behind it still counts the release as
3933
+ * done. The two known causes are named so the log need not be read: a sigstore 409 (the tarball is identical to a
3934
+ * published one, so the change needs different contents) and `ENEEDAUTH` (the Trusted Publisher entries expired, so
3935
+ * `holocron publish package --sync-trust` registers them again).
3936
+ */
3937
+ function wedgeFix(tag) {
3938
+ return [
3939
+ `delete the tag: git push --delete origin ${tag}`,
3940
+ `delete its note: git push origin :refs/notes/semantic-release-${tag}`,
3941
+ "cause 1, a sigstore 409 on an identical tarball: the next release needs different contents",
3942
+ "cause 2, ENEEDAUTH: the Trusted Publisher entries expired; run holocron publish package --sync-trust"
3943
+ ];
3944
+ }
3831
3945
  // src/templates/configs/commit-msg/commit-msg
3832
3946
  var commit_msg_default = "__HOLOCRON_SCRIPT__ run lint commit-msg \"$1\"\n";
3833
3947
  // src/templates/configs/commit-msg/create-config.ts
@@ -3982,4 +4096,4 @@ function createConfig$9() {
3982
4096
  function createIgnoreConfig() {
3983
4097
  return `${workflowHeader()}${_yamlignore_default}`;
3984
4098
  }
3985
- export { AGGREGATE_CHECK, CI_ORDER, DCO_CHECK, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, REUSABLE_ACTIONS, REUSABLE_WORKFLOWS, SUITES, TASKS, TEMPLATE_HOME, WORKFLOW_CHECK_CONTEXTS, WORKFLOW_TEMPLATES, WORKFLOW_TEMPLATE_PROPERTIES, aggregateChecks, checkPackageScripts, codecovFlagNames, codecovUploads, createAstromech, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createHeader, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createTsconfig, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, deriveDeployPaths, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateCombinedDeployContent, generateThinCallerContent, hostedReusableWorkflows, idFromSource, isDeprecated, isGeneratedScript, isTask, legacyCaller, legacyCallerFile, legacyFile, legacyGate, legacyName, legacyWorkflowKey, localize, localizeActions, matchNamespace, mergeScripts, normalizeWorkflowWith, packageLocation, planSuites, planTasks, readWorkspacePackages, requiredChecks, resolveTaskName, reusableTemplates, runCi, runGroup, runTask, scriptName, scriptsFor, stampDeprecated, suiteMembers, taskKey, workflowFile, workflowKey, workflowKeys, workspacePackages };
4099
+ export { AGGREGATE_CHECK, CI_ORDER, DCO_CHECK, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, REUSABLE_ACTIONS, REUSABLE_WORKFLOWS, SUITES, TASKS, TEMPLATE_HOME, WORKFLOW_CHECK_CONTEXTS, WORKFLOW_TEMPLATES, WORKFLOW_TEMPLATE_PROPERTIES, aggregateChecks, checkPackageScripts, checkReleaseLines, codecovFlagNames, codecovUploads, compareVersions, createAstromech, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createHeader, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createTsconfig, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, deriveDeployPaths, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateCombinedDeployContent, generateThinCallerContent, hostedReusableWorkflows, idFromSource, isDeprecated, isGeneratedScript, isTask, legacyCaller, legacyCallerFile, legacyFile, legacyGate, legacyName, legacyWorkflowKey, localize, localizeActions, matchNamespace, mergeScripts, normalizeWorkflowWith, packageLocation, planSuites, planTasks, readWorkspacePackages, requiredChecks, resolveTaskName, reusableTemplates, runCi, runGroup, runTask, scriptName, scriptsFor, stampDeprecated, suiteMembers, taskKey, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.473",
3
+ "version": "5.0.0-alpha.475",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -55,11 +55,11 @@
55
55
  "@commitlint/lint": "^21.2.3",
56
56
  "@commitlint/load": "^21.2.3",
57
57
  "@commitlint/types": "^21.2.3",
58
- "@theholocron/datapad": "5.0.0-alpha.473",
59
58
  "@theholocron/fs-utils": "^1.17.0-alpha.5",
60
59
  "@theholocron/json-utils": "^1.17.0-alpha.5",
60
+ "@theholocron/misc-utils": "^1.17.0-alpha.5",
61
61
  "@theholocron/pkg-utils": "^1.17.0-alpha.5",
62
- "@theholocron/misc-utils": "^1.17.0-alpha.5"
62
+ "@theholocron/datapad": "5.0.0-alpha.475"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@commitlint/config-conventional": "^21.2.3",
@@ -78,8 +78,8 @@
78
78
  "@theholocron/eslint-config": "^8.9.0-alpha.20",
79
79
  "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.20",
80
80
  "@theholocron/tsconfig": "^8.9.0-alpha.20",
81
- "@theholocron/vitest-config": "^8.9.0-alpha.20",
82
- "@theholocron/tsdown-config": "^8.9.0-alpha.20"
81
+ "@theholocron/tsdown-config": "^8.9.0-alpha.20",
82
+ "@theholocron/vitest-config": "^8.9.0-alpha.20"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=22"