create-typescript-app 2.36.2 → 2.38.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.
|
@@ -41,6 +41,7 @@ declare const blockGitHubActionsCI: bingo_stratum.BlockWithAddons<{
|
|
|
41
41
|
if?: string | undefined;
|
|
42
42
|
checkoutWith?: Record<string, string> | undefined;
|
|
43
43
|
}[] | undefined;
|
|
44
|
+
nodeVersion?: string | number | undefined;
|
|
44
45
|
}, {
|
|
45
46
|
access: "public" | "restricted";
|
|
46
47
|
description: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { base } from "../base.js";
|
|
3
4
|
import { resolveUses } from "./actions/resolveUses.js";
|
|
@@ -6,6 +7,7 @@ import { blockRepositoryBranchRuleset } from "./blockRepositoryBranchRuleset.js"
|
|
|
6
7
|
import { createMultiWorkflowFile } from "./files/createMultiWorkflowFile.js";
|
|
7
8
|
import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.js";
|
|
8
9
|
import { formatYaml } from "./files/formatYaml.js";
|
|
10
|
+
import { intakeFileAsYaml } from "./intake/intakeFileAsYaml.js";
|
|
9
11
|
const zActionStep = z.intersection(
|
|
10
12
|
z.object({
|
|
11
13
|
env: z.record(z.string(), z.string()).optional(),
|
|
@@ -26,10 +28,37 @@ const blockGitHubActionsCI = base.createBlock({
|
|
|
26
28
|
name: z.string(),
|
|
27
29
|
steps: z.array(zActionStep)
|
|
28
30
|
})
|
|
29
|
-
).optional()
|
|
31
|
+
).optional(),
|
|
32
|
+
nodeVersion: z.union([z.number(), z.string()]).optional()
|
|
33
|
+
},
|
|
34
|
+
intake({ files }) {
|
|
35
|
+
const actionYml = intakeFileAsYaml(files, [
|
|
36
|
+
".github",
|
|
37
|
+
"actions",
|
|
38
|
+
"prepare",
|
|
39
|
+
"action.yml"
|
|
40
|
+
]);
|
|
41
|
+
if (!actionYml) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const steps = _.get(actionYml, ["runs", "steps"]);
|
|
45
|
+
if (!steps || !Array.isArray(steps)) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
const setupNodeStep = steps.find(
|
|
49
|
+
(step) => typeof step.uses === "string" && step.uses.startsWith("actions/setup-node")
|
|
50
|
+
);
|
|
51
|
+
if (!setupNodeStep) {
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
const nodeVersion = setupNodeStep.with?.["node-version"];
|
|
55
|
+
if (!nodeVersion) {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
return { nodeVersion };
|
|
30
59
|
},
|
|
31
60
|
produce({ addons, options }) {
|
|
32
|
-
const { jobs } = addons;
|
|
61
|
+
const { jobs, nodeVersion = options.node.pinned ?? options.node.minimum } = addons;
|
|
33
62
|
return {
|
|
34
63
|
addons: [
|
|
35
64
|
blockRepositoryBranchRuleset({
|
|
@@ -60,7 +89,7 @@ const blockGitHubActionsCI = base.createBlock({
|
|
|
60
89
|
),
|
|
61
90
|
with: {
|
|
62
91
|
cache: "pnpm",
|
|
63
|
-
"node-version":
|
|
92
|
+
"node-version": nodeVersion
|
|
64
93
|
}
|
|
65
94
|
},
|
|
66
95
|
{
|
package/lib/blocks/index.d.ts
CHANGED
|
@@ -1473,6 +1473,7 @@ declare const blocks: {
|
|
|
1473
1473
|
if?: string | undefined;
|
|
1474
1474
|
checkoutWith?: Record<string, string> | undefined;
|
|
1475
1475
|
}[] | undefined;
|
|
1476
|
+
nodeVersion?: string | number | undefined;
|
|
1476
1477
|
}, {
|
|
1477
1478
|
access: "public" | "restricted";
|
|
1478
1479
|
description: string;
|