@theholocron/astromech 5.0.0-alpha.244 → 5.0.0-alpha.245
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/release/index.d.mts +10 -3
- package/dist/release/index.mjs +23 -3
- package/package.json +2 -2
package/dist/release/index.d.mts
CHANGED
|
@@ -32,8 +32,11 @@ type StepPlugin<Step extends CommitStep> = Partial<Record<Step, StepFn>>;
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/release/folder-scoped/folder-scoped.type.d.ts
|
|
34
34
|
interface FolderScopedDeps {
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Loads a plugin module by specifier, resolved from `cwd` (the repo being released). Defaults to a
|
|
37
|
+
* dynamic `import()` of the module as `cwd` resolves it, which is how semantic-release loads its own plugins.
|
|
38
|
+
*/
|
|
39
|
+
load?: (specifier: string, cwd: string) => Promise<unknown>;
|
|
37
40
|
/** Lists the files each commit changed. Defaults to `git diff-tree`. */
|
|
38
41
|
listFiles?: typeof commitFiles;
|
|
39
42
|
}
|
|
@@ -60,6 +63,10 @@ declare function folderScoped<Step extends CommitStep>(step: Step, paths: readon
|
|
|
60
63
|
* group's commits into the repo's changelog.
|
|
61
64
|
*/
|
|
62
65
|
declare function ungroupedScoped<Step extends CommitStep>(step: Step, groups: readonly string[], deps?: FolderScopedDeps): StepPlugin<Step>;
|
|
66
|
+
/** The file `specifier` resolves to for the repo at `cwd`, else for `semantic-release`; `requireFrom` is a seam for tests. */
|
|
67
|
+
declare function resolvePlugin(specifier: string, cwd: string, requireFrom?: (file: string) => {
|
|
68
|
+
resolve(id: string): string;
|
|
69
|
+
}): string;
|
|
63
70
|
/**
|
|
64
71
|
* Splits the GitHub plugin's entry so its "released in…" comments and labels go only to the PRs and
|
|
65
72
|
* issues of the commits `scoped` keeps. The entry stays as it was, so it still publishes the GitHub
|
|
@@ -138,4 +145,4 @@ interface UngroupedReleaseOptions extends DefineConfigOptions {
|
|
|
138
145
|
*/
|
|
139
146
|
declare function ungroupedReleaseConfig({ groups, ...options }: UngroupedReleaseOptions): object;
|
|
140
147
|
//#endregion
|
|
141
|
-
export { type CommitStep, type DefineConfigOptions, type FolderScopedDeps, GitRun, type GroupReleaseOptions, type ReleaseCommit, type ReleaseContext, type StepPlugin, type UngroupedReleaseOptions, commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, ungroupedReleaseConfig, ungroupedScoped };
|
|
148
|
+
export { type CommitStep, type DefineConfigOptions, type FolderScopedDeps, GitRun, type GroupReleaseOptions, type ReleaseCommit, type ReleaseContext, type StepPlugin, type UngroupedReleaseOptions, commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, resolvePlugin, ungroupedReleaseConfig, ungroupedScoped };
|
package/dist/release/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { t as normalizeTaskEntry } from "../schema-Djtv0sLM.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { join } from "node:path";
|
|
2
4
|
import { execFileSync } from "node:child_process";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
3
6
|
import { defineConfig } from "@theholocron/semantic-release-config";
|
|
4
7
|
//#region src/release/commit-files/commit-files.ts
|
|
5
8
|
const defaultGitRun = (args, input, cwd) => execFileSync("git", args, {
|
|
@@ -88,10 +91,27 @@ function folderScoped(step, paths, deps = {}) {
|
|
|
88
91
|
function ungroupedScoped(step, groups, deps = {}) {
|
|
89
92
|
return scopedBy(step, (files) => outsideFolders(files, groups), deps);
|
|
90
93
|
}
|
|
91
|
-
|
|
94
|
+
/**
|
|
95
|
+
* `import()` of `specifier` the way semantic-release finds its own plugins: as the repo at `cwd` resolves it,
|
|
96
|
+
* else as `semantic-release` does (the stock plugins are its dependencies, not the repo's). A bare `import()`
|
|
97
|
+
* would resolve from this file, inside astromech, where neither is visible.
|
|
98
|
+
*/
|
|
99
|
+
function importFrom(specifier, cwd) {
|
|
100
|
+
return import(pathToFileURL(resolvePlugin(specifier, cwd)).href);
|
|
101
|
+
}
|
|
102
|
+
/** The file `specifier` resolves to for the repo at `cwd`, else for `semantic-release`; `requireFrom` is a seam for tests. */
|
|
103
|
+
function resolvePlugin(specifier, cwd, requireFrom = createRequire) {
|
|
104
|
+
const fromRepo = requireFrom(join(cwd, "package.json"));
|
|
105
|
+
try {
|
|
106
|
+
return fromRepo.resolve(specifier);
|
|
107
|
+
} catch {
|
|
108
|
+
return requireFrom(fromRepo.resolve("semantic-release")).resolve(specifier);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function scopedBy(step, keep, { load = importFrom, listFiles = commitFiles }) {
|
|
92
112
|
const scoped = async (pluginConfig, context) => {
|
|
93
|
-
const inner = await load(MODULES[step]);
|
|
94
113
|
const { commits = [], cwd = process.cwd() } = context;
|
|
114
|
+
const inner = await load(MODULES[step], cwd);
|
|
95
115
|
const files = listFiles(cwd, commits.map((commit) => commit.hash));
|
|
96
116
|
const kept = commits.filter((commit) => keep(files.get(commit.hash) ?? []));
|
|
97
117
|
return inner[step]?.(pluginConfig, {
|
|
@@ -213,4 +233,4 @@ function ungroupedReleaseConfig({ groups, ...options }) {
|
|
|
213
233
|
};
|
|
214
234
|
}
|
|
215
235
|
//#endregion
|
|
216
|
-
export { commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, ungroupedReleaseConfig, ungroupedScoped };
|
|
236
|
+
export { commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, resolvePlugin, ungroupedReleaseConfig, ungroupedScoped };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.245",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@theholocron/fs-utils": "^1.16.0",
|
|
54
54
|
"@theholocron/json-utils": "^1.16.0",
|
|
55
55
|
"@theholocron/pkg-utils": "^1.16.0",
|
|
56
|
-
"@theholocron/datapad": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/datapad": "5.0.0-alpha.245"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@commitlint/config-conventional": "^21.2.3",
|