@theholocron/astromech 5.0.0-alpha.41 → 5.0.0-alpha.411
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/README.md +188 -70
- package/dist/config/index.d.mts +52 -8
- package/dist/config/index.mjs +26 -23
- package/dist/editorconfig-checker-B-hWWYHk.mjs +40 -0
- package/dist/index.d.mts +1070 -528
- package/dist/index.mjs +3716 -1361
- package/dist/lint/index.d.mts +106 -0
- package/dist/lint/index.mjs +156 -0
- package/dist/load-VxcQc1ey.mjs +521 -0
- package/dist/repo-validation/index.d.mts +300 -0
- package/dist/repo-validation/index.mjs +541 -0
- package/dist/{schema-D01VYg43.d.mts → schema.type-BfeI4AnM.d.mts} +27 -17
- package/dist/upgrade/index.d.mts +126 -0
- package/dist/upgrade/index.mjs +283 -0
- package/package.json +47 -21
- package/dist/schema-Cf5dfaDO.mjs +0 -11
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { FetchLatest } from "@theholocron/pkg-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Read the repo's current Node.js major from `.nvmrc`, `.node-version`, then `package.json` `engines.node`.
|
|
4
|
+
*
|
|
5
|
+
* @param cwd - The repo root.
|
|
6
|
+
* @param readFile - Reads a file as text; throws when absent.
|
|
7
|
+
* @returns The major, or `null` when no pin is found.
|
|
8
|
+
*/
|
|
9
|
+
export declare function detectNodeMajor(cwd: string, readFile: (path: string) => string): number | null;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a package's `latest` dist-tag from the npm registry.
|
|
12
|
+
*
|
|
13
|
+
* Never throws: a network failure, timeout, or non-2xx response resolves to `null`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchLatestFromNpm: FetchLatest;
|
|
16
|
+
/**
|
|
17
|
+
* Rewrite `FROM node:N` (any tag suffix is kept) in a Dockerfile.
|
|
18
|
+
*
|
|
19
|
+
* @param content - The raw Dockerfile text.
|
|
20
|
+
* @param from - The major being replaced.
|
|
21
|
+
* @param to - The major to pin.
|
|
22
|
+
* @returns The new text, or `null` when nothing changed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function patchDockerfile(content: string, from: number, to: number): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Rewrite the Node.js pins in a `package.json`: `engines.node` (`>=N` / `>=N.0.0`) and an exact
|
|
27
|
+
* `@types/node` range (`^N.0.0`). `catalog:` pins are left alone.
|
|
28
|
+
*
|
|
29
|
+
* @param content - The raw `package.json` text.
|
|
30
|
+
* @param from - The major being replaced.
|
|
31
|
+
* @param to - The major to pin.
|
|
32
|
+
* @returns The new text, or `null` when nothing changed (or the JSON is unparseable).
|
|
33
|
+
*/
|
|
34
|
+
export declare function patchPackageJson(content: string, from: number, to: number): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Rewrite a `.nvmrc` / `.node-version` file holding `N` or `N.x.y`.
|
|
37
|
+
*
|
|
38
|
+
* @param content - The raw file text.
|
|
39
|
+
* @param from - The major being replaced.
|
|
40
|
+
* @param to - The major to pin.
|
|
41
|
+
* @returns `"<to>\n"`, or `null` when the file pins a different major.
|
|
42
|
+
*/
|
|
43
|
+
export declare function patchPinFile(content: string, from: number, to: number): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Rewrite the `nodejs N` line in an asdf `.tool-versions` file.
|
|
46
|
+
*
|
|
47
|
+
* @param content - The raw file text.
|
|
48
|
+
* @param from - The major being replaced.
|
|
49
|
+
* @param to - The major to pin.
|
|
50
|
+
* @returns The new text, or `null` when nothing changed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function patchToolVersions(content: string, from: number, to: number): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Rewrite `node-version: N` (bare, single- or double-quoted) in a YAML file such as a GitHub Actions workflow.
|
|
55
|
+
*
|
|
56
|
+
* @param content - The raw YAML text.
|
|
57
|
+
* @param from - The major being replaced.
|
|
58
|
+
* @param to - The major to pin.
|
|
59
|
+
* @returns The new text, or `null` when nothing changed.
|
|
60
|
+
*/
|
|
61
|
+
export declare function patchYaml(content: string, from: number, to: number): string | null;
|
|
62
|
+
/** One kind of file that pins the Node.js major. */
|
|
63
|
+
interface NodePinPattern {
|
|
64
|
+
/** True when this pattern applies to the file's basename. */
|
|
65
|
+
matches: (filename: string) => boolean;
|
|
66
|
+
/** The new content, or `null` when nothing in the file changed. */
|
|
67
|
+
patch: (content: string, from: number, to: number) => string | null;
|
|
68
|
+
}
|
|
69
|
+
/** Structured-logging sink for `runUpgradeNode`; any pino-style logger fits. */
|
|
70
|
+
interface UpgradeNodeLogger {
|
|
71
|
+
/** Records a per-file debug line. */
|
|
72
|
+
debug(obj: Record<string, unknown>, msg?: string): void;
|
|
73
|
+
/** Records the start and the outcome of a run. */
|
|
74
|
+
info(obj: Record<string, unknown>, msg?: string): void;
|
|
75
|
+
/** Records a run that could not proceed. */
|
|
76
|
+
warn(obj: Record<string, unknown>, msg?: string): void;
|
|
77
|
+
}
|
|
78
|
+
/** Input to `runUpgradeNode`. */
|
|
79
|
+
interface RunUpgradeNodeInput {
|
|
80
|
+
/** Target Node.js major version (e.g., 22). */
|
|
81
|
+
to: number;
|
|
82
|
+
/** Source major version. Auto-detected from .nvmrc / engines.node when omitted. */
|
|
83
|
+
from?: number;
|
|
84
|
+
/** Working directory (repo root). Defaults to process.cwd(). */
|
|
85
|
+
cwd?: string;
|
|
86
|
+
/** Print what would change without writing anything. */
|
|
87
|
+
dryRun?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Extra file paths (relative to cwd) to scan in addition to the normal walk. Use for non-conventional
|
|
90
|
+
* locations not covered by the pattern registry (e.g., a `.tool-versions` in a subdirectory).
|
|
91
|
+
*/
|
|
92
|
+
extra?: string[];
|
|
93
|
+
/** Writes one line of progress output. Defaults to `console.log`. */
|
|
94
|
+
print?: (line: string) => void;
|
|
95
|
+
/** Structured-logging sink. Defaults to a no-op. */
|
|
96
|
+
logger?: UpgradeNodeLogger;
|
|
97
|
+
/** Injectable for testing. */
|
|
98
|
+
readFile?: (path: string) => string;
|
|
99
|
+
/** Injectable for testing. */
|
|
100
|
+
writeFile?: (path: string, content: string) => void;
|
|
101
|
+
/** Injectable for testing; lists every file under `dir`, skipping build and VCS folders by default. */
|
|
102
|
+
walkFiles?: (dir: string) => string[];
|
|
103
|
+
}
|
|
104
|
+
/** How a run ended: files written, nothing written because of `dryRun`, or a failure. */
|
|
105
|
+
type UpgradeNodeStatus = "ok" | "fail" | "dry-run";
|
|
106
|
+
/** What `runUpgradeNode` did. */
|
|
107
|
+
interface UpgradeNodeReport {
|
|
108
|
+
/** How the run ended. */
|
|
109
|
+
status: UpgradeNodeStatus;
|
|
110
|
+
/** Repo-relative paths that were (or, in dry-run, would be) patched. */
|
|
111
|
+
updated: readonly string[];
|
|
112
|
+
/** Why the run failed; set only when `status` is `"fail"`. */
|
|
113
|
+
message?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Scan a repo and rewrite every Node.js version pin (`engines.node`, `@types/node`, `.nvmrc`,
|
|
117
|
+
* `.node-version`, workflow `node-version:`, Dockerfile `FROM node:`, `.tool-versions`) from one major to
|
|
118
|
+
* another. The current major is auto-detected when `from` is omitted.
|
|
119
|
+
*
|
|
120
|
+
* Never throws: an unreadable tree or an undetectable version resolves to `{ status: "fail", message }`.
|
|
121
|
+
*
|
|
122
|
+
* @param input - Target major, optional source major, and injectable I/O.
|
|
123
|
+
* @returns The status and the repo-relative paths that were (or, in dry-run, would be) patched.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runUpgradeNode(input: RunUpgradeNodeInput): Promise<UpgradeNodeReport>;
|
|
126
|
+
export type { NodePinPattern, RunUpgradeNodeInput, UpgradeNodeLogger, UpgradeNodeReport, UpgradeNodeStatus };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { basename, join, resolve, sep } from "node:path";
|
|
3
|
+
import { stringifyJson } from "@theholocron/json-utils";
|
|
4
|
+
import { walkFilesSync } from "@theholocron/fs-utils";
|
|
5
|
+
import { errorMessage } from "@theholocron/misc-utils";
|
|
6
|
+
// src/upgrade/detect-node-major/detect-node-major.ts
|
|
7
|
+
/**
|
|
8
|
+
* Read the repo's current Node.js major from `.nvmrc`, `.node-version`, then `package.json` `engines.node`.
|
|
9
|
+
*
|
|
10
|
+
* @param cwd - The repo root.
|
|
11
|
+
* @param readFile - Reads a file as text; throws when absent.
|
|
12
|
+
* @returns The major, or `null` when no pin is found.
|
|
13
|
+
*/
|
|
14
|
+
function detectNodeMajor(cwd, readFile) {
|
|
15
|
+
for (const name of [".nvmrc", ".node-version"]) try {
|
|
16
|
+
const major = parseInt(readFile(join(cwd, name)).trim(), 10);
|
|
17
|
+
if (!isNaN(major)) return major;
|
|
18
|
+
} catch {}
|
|
19
|
+
try {
|
|
20
|
+
const node = JSON.parse(readFile(join(cwd, "package.json"))).engines?.node;
|
|
21
|
+
if (node) {
|
|
22
|
+
const m = node.match(/(\d+)/);
|
|
23
|
+
if (m) return parseInt(m[1], 10);
|
|
24
|
+
}
|
|
25
|
+
} catch {}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
// src/upgrade/fetch-latest-from-npm/fetch-latest-from-npm.ts
|
|
29
|
+
const FETCH_TIMEOUT_MS = 4e3;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a package's `latest` dist-tag from the npm registry.
|
|
32
|
+
*
|
|
33
|
+
* Never throws: a network failure, timeout, or non-2xx response resolves to `null`.
|
|
34
|
+
*/
|
|
35
|
+
const fetchLatestFromNpm = async (pkg) => {
|
|
36
|
+
try {
|
|
37
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`, {
|
|
38
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
39
|
+
headers: { accept: "application/vnd.npm.install-v1+json" }
|
|
40
|
+
});
|
|
41
|
+
if (!res.ok) return null;
|
|
42
|
+
return (await res.json())["dist-tags"]?.["latest"] ?? null;
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// src/upgrade/patch-dockerfile/patch-dockerfile.ts
|
|
48
|
+
/**
|
|
49
|
+
* Rewrite `FROM node:N` (any tag suffix is kept) in a Dockerfile.
|
|
50
|
+
*
|
|
51
|
+
* @param content - The raw Dockerfile text.
|
|
52
|
+
* @param from - The major being replaced.
|
|
53
|
+
* @param to - The major to pin.
|
|
54
|
+
* @returns The new text, or `null` when nothing changed.
|
|
55
|
+
*/
|
|
56
|
+
function patchDockerfile(content, from, to) {
|
|
57
|
+
const updated = content.replace(/^(FROM\s+node:)(\d+)/gm, (match, prefix, ver) => ver === String(from) ? `${prefix}${to}` : match);
|
|
58
|
+
return updated !== content ? updated : null;
|
|
59
|
+
}
|
|
60
|
+
// src/upgrade/patch-package-json/patch-package-json.ts
|
|
61
|
+
/**
|
|
62
|
+
* Rewrite the Node.js pins in a `package.json`: `engines.node` (`>=N` / `>=N.0.0`) and an exact
|
|
63
|
+
* `@types/node` range (`^N.0.0`). `catalog:` pins are left alone.
|
|
64
|
+
*
|
|
65
|
+
* @param content - The raw `package.json` text.
|
|
66
|
+
* @param from - The major being replaced.
|
|
67
|
+
* @param to - The major to pin.
|
|
68
|
+
* @returns The new text, or `null` when nothing changed (or the JSON is unparseable).
|
|
69
|
+
*/
|
|
70
|
+
function patchPackageJson(content, from, to) {
|
|
71
|
+
let pkg;
|
|
72
|
+
try {
|
|
73
|
+
pkg = JSON.parse(content);
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
let changed = false;
|
|
78
|
+
const engines = pkg.engines;
|
|
79
|
+
if (engines?.node && /^>=\d+(?:\.0\.0)?$/.test(engines.node)) {
|
|
80
|
+
if (parseInt(engines.node.match(/\d+/)[0], 10) === from) {
|
|
81
|
+
engines.node = `>=${to}.0.0`;
|
|
82
|
+
changed = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (const field of ["devDependencies", "dependencies"]) {
|
|
86
|
+
const deps = pkg[field];
|
|
87
|
+
if (!deps?.["@types/node"]) continue;
|
|
88
|
+
if (deps["@types/node"] === `^${from}.0.0`) {
|
|
89
|
+
deps["@types/node"] = `^${to}.0.0`;
|
|
90
|
+
changed = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return changed ? stringifyJson(pkg, { like: content }) : null;
|
|
94
|
+
}
|
|
95
|
+
// src/upgrade/patch-pin-file/patch-pin-file.ts
|
|
96
|
+
/**
|
|
97
|
+
* Rewrite a `.nvmrc` / `.node-version` file holding `N` or `N.x.y`.
|
|
98
|
+
*
|
|
99
|
+
* @param content - The raw file text.
|
|
100
|
+
* @param from - The major being replaced.
|
|
101
|
+
* @param to - The major to pin.
|
|
102
|
+
* @returns `"<to>\n"`, or `null` when the file pins a different major.
|
|
103
|
+
*/
|
|
104
|
+
function patchPinFile(content, from, to) {
|
|
105
|
+
const trimmed = content.trim();
|
|
106
|
+
if (trimmed === String(from) || trimmed.startsWith(`${from}.`)) return `${to}\n`;
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
// src/upgrade/patch-tool-versions/patch-tool-versions.ts
|
|
110
|
+
/**
|
|
111
|
+
* Rewrite the `nodejs N` line in an asdf `.tool-versions` file.
|
|
112
|
+
*
|
|
113
|
+
* @param content - The raw file text.
|
|
114
|
+
* @param from - The major being replaced.
|
|
115
|
+
* @param to - The major to pin.
|
|
116
|
+
* @returns The new text, or `null` when nothing changed.
|
|
117
|
+
*/
|
|
118
|
+
function patchToolVersions(content, from, to) {
|
|
119
|
+
const updated = content.replace(/^(nodejs\s+)(\d+)/gm, (match, prefix, ver) => ver === String(from) ? `${prefix}${to}` : match);
|
|
120
|
+
return updated !== content ? updated : null;
|
|
121
|
+
}
|
|
122
|
+
// src/upgrade/patch-yaml/patch-yaml.ts
|
|
123
|
+
/**
|
|
124
|
+
* Rewrite `node-version: N` (bare, single- or double-quoted) in a YAML file such as a GitHub Actions workflow.
|
|
125
|
+
*
|
|
126
|
+
* @param content - The raw YAML text.
|
|
127
|
+
* @param from - The major being replaced.
|
|
128
|
+
* @param to - The major to pin.
|
|
129
|
+
* @returns The new text, or `null` when nothing changed.
|
|
130
|
+
*/
|
|
131
|
+
function patchYaml(content, from, to) {
|
|
132
|
+
const updated = content.replace(/node-version:\s+['"]?(\d+)['"]?/g, (match, ver) => ver === String(from) ? match.replace(String(from), String(to)) : match);
|
|
133
|
+
return updated !== content ? updated : null;
|
|
134
|
+
}
|
|
135
|
+
// src/upgrade/upgrade-node/upgrade-node.ts
|
|
136
|
+
/** Directories skipped when walking the repo tree. */
|
|
137
|
+
const SKIP_DIRS = [
|
|
138
|
+
"node_modules",
|
|
139
|
+
".git",
|
|
140
|
+
"dist",
|
|
141
|
+
"coverage",
|
|
142
|
+
"build",
|
|
143
|
+
".turbo",
|
|
144
|
+
".next",
|
|
145
|
+
"out"
|
|
146
|
+
];
|
|
147
|
+
/**
|
|
148
|
+
* The registry of files that pin a Node.js major. To cover a new file type, add an entry here: a `matches`
|
|
149
|
+
* predicate on the basename and a `patch` function.
|
|
150
|
+
*/
|
|
151
|
+
const PATTERNS = [
|
|
152
|
+
{
|
|
153
|
+
matches: (n) => n === "package.json",
|
|
154
|
+
patch: patchPackageJson
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
matches: (n) => n.endsWith(".yml") || n.endsWith(".yaml"),
|
|
158
|
+
patch: patchYaml
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
matches: (n) => n === ".nvmrc" || n === ".node-version",
|
|
162
|
+
patch: patchPinFile
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
matches: (n) => n === "Dockerfile" || n.startsWith("Dockerfile."),
|
|
166
|
+
patch: patchDockerfile
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
matches: (n) => n === ".tool-versions",
|
|
170
|
+
patch: patchToolVersions
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
const noopLogger = {
|
|
174
|
+
debug() {},
|
|
175
|
+
info() {},
|
|
176
|
+
warn() {}
|
|
177
|
+
};
|
|
178
|
+
const defaultWalkFiles = (dir) => walkFilesSync(dir, { skip: SKIP_DIRS });
|
|
179
|
+
/**
|
|
180
|
+
* Scan a repo and rewrite every Node.js version pin (`engines.node`, `@types/node`, `.nvmrc`,
|
|
181
|
+
* `.node-version`, workflow `node-version:`, Dockerfile `FROM node:`, `.tool-versions`) from one major to
|
|
182
|
+
* another. The current major is auto-detected when `from` is omitted.
|
|
183
|
+
*
|
|
184
|
+
* Never throws: an unreadable tree or an undetectable version resolves to `{ status: "fail", message }`.
|
|
185
|
+
*
|
|
186
|
+
* @param input - Target major, optional source major, and injectable I/O.
|
|
187
|
+
* @returns The status and the repo-relative paths that were (or, in dry-run, would be) patched.
|
|
188
|
+
*/
|
|
189
|
+
async function runUpgradeNode(input) {
|
|
190
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
191
|
+
const logger = input.logger ?? noopLogger;
|
|
192
|
+
const cwd = input.cwd ?? process.cwd();
|
|
193
|
+
const { to, dryRun = false, extra = [] } = input;
|
|
194
|
+
const _readFile = input.readFile ?? ((p) => readFileSync(p, "utf8"));
|
|
195
|
+
const _writeFile = input.writeFile ?? ((p, c) => writeFileSync(p, c));
|
|
196
|
+
const _walkFiles = input.walkFiles ?? defaultWalkFiles;
|
|
197
|
+
let walked;
|
|
198
|
+
try {
|
|
199
|
+
walked = _walkFiles(cwd);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
const message = `could not read ${cwd}: ${errorMessage(error)}`;
|
|
202
|
+
logger.warn({
|
|
203
|
+
to,
|
|
204
|
+
reason: message
|
|
205
|
+
}, "upgrade node: done");
|
|
206
|
+
return {
|
|
207
|
+
status: "fail",
|
|
208
|
+
updated: [],
|
|
209
|
+
message
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const from = input.from ?? detectNodeMajor(cwd, _readFile);
|
|
213
|
+
if (from === null) {
|
|
214
|
+
const message = "could not detect current Node version — pass --from <major>";
|
|
215
|
+
logger.warn({
|
|
216
|
+
to,
|
|
217
|
+
reason: message
|
|
218
|
+
}, "upgrade node: done");
|
|
219
|
+
return {
|
|
220
|
+
status: "fail",
|
|
221
|
+
updated: [],
|
|
222
|
+
message
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
logger.info({
|
|
226
|
+
from,
|
|
227
|
+
to,
|
|
228
|
+
dryRun: dryRun || void 0
|
|
229
|
+
}, "upgrade node: start");
|
|
230
|
+
if (from === to) {
|
|
231
|
+
print(`Already at Node.js ${to} — nothing to do.`);
|
|
232
|
+
logger.info({
|
|
233
|
+
from,
|
|
234
|
+
to,
|
|
235
|
+
updated: 0,
|
|
236
|
+
status: "ok"
|
|
237
|
+
}, "upgrade node: done");
|
|
238
|
+
return {
|
|
239
|
+
status: "ok",
|
|
240
|
+
updated: []
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
print(`Upgrading Node.js ${from} → ${to}${dryRun ? " (dry-run)" : ""}…`);
|
|
244
|
+
const updated = [];
|
|
245
|
+
const root = resolve(cwd);
|
|
246
|
+
const scanned = [...walked, ...extra.map((p) => join(cwd, p))];
|
|
247
|
+
for (const abs of scanned) {
|
|
248
|
+
const name = basename(abs);
|
|
249
|
+
const pattern = PATTERNS.find((p) => p.matches(name));
|
|
250
|
+
if (!pattern) continue;
|
|
251
|
+
let content;
|
|
252
|
+
try {
|
|
253
|
+
content = _readFile(abs);
|
|
254
|
+
} catch {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const patched = pattern.patch(content, from, to);
|
|
258
|
+
if (patched === null) continue;
|
|
259
|
+
const absolute = resolve(abs);
|
|
260
|
+
const rel = absolute.startsWith(root + sep) ? absolute.slice(root.length + 1) : abs;
|
|
261
|
+
if (!dryRun) _writeFile(abs, patched);
|
|
262
|
+
print(` ${dryRun ? "~" : "✓"} ${rel}`);
|
|
263
|
+
logger.debug({
|
|
264
|
+
file: rel,
|
|
265
|
+
from,
|
|
266
|
+
to
|
|
267
|
+
}, "upgrade node: patched");
|
|
268
|
+
updated.push(rel);
|
|
269
|
+
}
|
|
270
|
+
if (updated.length === 0) print(` · no files contained Node.js ${from} pins`);
|
|
271
|
+
const status = dryRun ? "dry-run" : "ok";
|
|
272
|
+
logger.info({
|
|
273
|
+
from,
|
|
274
|
+
to,
|
|
275
|
+
updated: updated.length,
|
|
276
|
+
status
|
|
277
|
+
}, "upgrade node: done");
|
|
278
|
+
return {
|
|
279
|
+
status,
|
|
280
|
+
updated
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
export { detectNodeMajor, fetchLatestFromNpm, patchDockerfile, patchPackageJson, patchPinFile, patchToolVersions, patchYaml, runUpgradeNode };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
4
|
-
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
3
|
+
"version": "5.0.0-alpha.411",
|
|
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",
|
|
7
7
|
"holocron",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"theholocron",
|
|
11
11
|
"turbo"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://docs.theholocron.dev/holocron/astromech/",
|
|
14
14
|
"bugs": "https://github.com/theholocron/holocron/issues",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git+https://github.com/theholocron/holocron.git",
|
|
18
|
-
"directory": "
|
|
18
|
+
"directory": "cli/astromech"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": "Newton Koumantzelis",
|
|
@@ -31,29 +31,55 @@
|
|
|
31
31
|
"types": "./dist/config/index.d.mts",
|
|
32
32
|
"import": "./dist/config/index.mjs",
|
|
33
33
|
"default": "./dist/config/index.mjs"
|
|
34
|
+
},
|
|
35
|
+
"./lint": {
|
|
36
|
+
"types": "./dist/lint/index.d.mts",
|
|
37
|
+
"import": "./dist/lint/index.mjs",
|
|
38
|
+
"default": "./dist/lint/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./repo-validation": {
|
|
41
|
+
"types": "./dist/repo-validation/index.d.mts",
|
|
42
|
+
"import": "./dist/repo-validation/index.mjs",
|
|
43
|
+
"default": "./dist/repo-validation/index.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./upgrade": {
|
|
46
|
+
"types": "./dist/upgrade/index.d.mts",
|
|
47
|
+
"import": "./dist/upgrade/index.mjs",
|
|
48
|
+
"default": "./dist/upgrade/index.mjs"
|
|
34
49
|
}
|
|
35
50
|
},
|
|
36
51
|
"files": [
|
|
37
52
|
"dist"
|
|
38
53
|
],
|
|
39
54
|
"dependencies": {
|
|
40
|
-
"@
|
|
55
|
+
"@commitlint/lint": "^21.2.3",
|
|
56
|
+
"@commitlint/load": "^21.2.3",
|
|
57
|
+
"@commitlint/types": "^21.2.3",
|
|
58
|
+
"@theholocron/datapad": "5.0.0-alpha.411",
|
|
59
|
+
"@theholocron/json-utils": "^1.17.0-alpha.4",
|
|
60
|
+
"@theholocron/fs-utils": "^1.17.0-alpha.4",
|
|
61
|
+
"@theholocron/misc-utils": "^1.17.0-alpha.4",
|
|
62
|
+
"@theholocron/pkg-utils": "^1.17.0-alpha.4"
|
|
41
63
|
},
|
|
42
64
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@theholocron/tsconfig": "^8.0.0",
|
|
45
|
-
"@theholocron/tsdown-config": "^8.0.0",
|
|
46
|
-
"@theholocron/vitest-config": "^8.0.0",
|
|
65
|
+
"@commitlint/config-conventional": "^21.2.3",
|
|
47
66
|
"@types/node": "^26",
|
|
48
|
-
"@vitest/coverage-v8": "^
|
|
49
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
50
|
-
"eslint": "^10.
|
|
51
|
-
"eslint-plugin-n": "^18.
|
|
52
|
-
"globals": "^17.
|
|
53
|
-
"
|
|
67
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
68
|
+
"@vitest/eslint-plugin": "^1.6.28",
|
|
69
|
+
"eslint": "^10.14.0",
|
|
70
|
+
"eslint-plugin-n": "^18.5.0",
|
|
71
|
+
"globals": "^17.14.0",
|
|
72
|
+
"prettier": "^3.9.10",
|
|
73
|
+
"tsdown": "^0.23.5",
|
|
54
74
|
"typescript": "^5.9.3",
|
|
55
|
-
"vitest": "^
|
|
56
|
-
"@theholocron/
|
|
75
|
+
"vitest": "^5.1.0",
|
|
76
|
+
"@theholocron/ci": "1.0.0",
|
|
77
|
+
"@theholocron/commitlint-config": "^8.9.0-alpha.16",
|
|
78
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.16",
|
|
79
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.16",
|
|
80
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.16",
|
|
81
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.16",
|
|
82
|
+
"@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.16"
|
|
57
83
|
},
|
|
58
84
|
"engines": {
|
|
59
85
|
"node": ">=22"
|
|
@@ -62,10 +88,10 @@
|
|
|
62
88
|
"access": "public"
|
|
63
89
|
},
|
|
64
90
|
"scripts": {
|
|
65
|
-
"
|
|
66
|
-
"
|
|
91
|
+
"build": "tsdown",
|
|
92
|
+
"lint:code": "eslint .",
|
|
93
|
+
"test:unit": "vitest run --coverage",
|
|
67
94
|
"test:watch": "vitest",
|
|
68
|
-
"
|
|
69
|
-
"verification.unitTests": "vitest run"
|
|
95
|
+
"typecheck": "tsc --noEmit"
|
|
70
96
|
}
|
|
71
97
|
}
|
package/dist/schema-Cf5dfaDO.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/config/schema.ts
|
|
2
|
-
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
3
|
-
function normalizeTaskEntry(item) {
|
|
4
|
-
return {
|
|
5
|
-
ci: true,
|
|
6
|
-
local: true,
|
|
7
|
-
...typeof item === "string" ? { name: item } : item
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { normalizeTaskEntry as t };
|