@intellectual-frontiers/libraries 0.1.1 → 0.4.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.
- package/dist/affected.d.ts +15 -2
- package/dist/affected.js +51 -20
- package/dist/dev.d.ts +81 -0
- package/dist/dev.js +347 -0
- package/dist/family.d.ts +58 -0
- package/dist/family.js +124 -0
- package/dist/generate-ontology.d.ts +2 -0
- package/dist/generate-ontology.js +33 -1
- package/dist/generate-workflows.js +2 -10
- package/dist/libraries.d.ts +8 -0
- package/dist/libraries.js +30 -4
- package/dist/link.d.ts +12 -0
- package/dist/link.js +98 -0
- package/dist/oscal-register.d.ts +2 -1
- package/dist/oscal-register.js +112 -88
- package/dist/pack-library.js +6 -1
- package/dist/plan.d.ts +28 -0
- package/dist/plan.js +135 -0
- package/dist/releasing.d.ts +176 -0
- package/dist/releasing.js +680 -0
- package/dist/versions.js +4 -7
- package/dist/workflows/definitions.d.ts +33 -30
- package/dist/workflows/definitions.js +200 -272
- package/dist/workflows/model.d.ts +15 -3
- package/dist/workflows/render.js +10 -2
- package/package.json +24 -4
- package/src/affected.ts +56 -17
- package/src/dev.ts +368 -0
- package/src/family.ts +143 -0
- package/src/generate-ontology.ts +34 -1
- package/src/generate-workflows.ts +3 -11
- package/src/libraries.ts +35 -3
- package/src/link.ts +97 -0
- package/src/oscal-register.ts +139 -117
- package/src/pack-library.ts +6 -1
- package/src/plan.ts +143 -0
- package/src/releasing.ts +735 -0
- package/src/versions.ts +3 -7
- package/src/workflows/definitions.ts +260 -387
- package/src/workflows/model.ts +11 -3
- package/src/workflows/render.ts +10 -2
package/src/workflows/model.ts
CHANGED
|
@@ -85,18 +85,24 @@ export type Permissions = Readonly<
|
|
|
85
85
|
/** The branches, paths and tags a push or a pull request is run for; none is every one. */
|
|
86
86
|
export type Filter = { readonly branches?: readonly string[]; readonly paths?: readonly string[]; readonly tags?: readonly string[] };
|
|
87
87
|
|
|
88
|
+
/** A question a run by hand asks: a yes or no with its default. */
|
|
89
|
+
export type DispatchInput = { readonly description: string; readonly type: "boolean"; readonly default: boolean };
|
|
90
|
+
|
|
88
91
|
export type Triggers = {
|
|
89
92
|
readonly push?: Filter;
|
|
90
93
|
readonly pullRequest?: Filter;
|
|
91
|
-
/** Run by hand from the Actions page. */
|
|
92
|
-
readonly workflowDispatch?: true;
|
|
94
|
+
/** Run by hand from the Actions page, with the inputs it asks for (true asks for none). */
|
|
95
|
+
readonly workflowDispatch?: true | { readonly inputs: Readonly<Record<string, DispatchInput>> };
|
|
93
96
|
/** Called by another workflow. */
|
|
94
97
|
readonly workflowCall?: true;
|
|
95
98
|
};
|
|
96
99
|
|
|
100
|
+
/** The cells of a matrix: the values of each axis, or an expression that gives the whole matrix (`expr("fromJSON(needs.plan.outputs.linux)")`), which a job reads from the output of another. */
|
|
101
|
+
export type Matrix = Readonly<Record<string, readonly (string | number)[]>> | Expr;
|
|
102
|
+
|
|
97
103
|
export type Strategy = {
|
|
98
104
|
readonly failFast?: boolean;
|
|
99
|
-
readonly matrix:
|
|
105
|
+
readonly matrix: Matrix;
|
|
100
106
|
};
|
|
101
107
|
|
|
102
108
|
export type Job = {
|
|
@@ -109,6 +115,8 @@ export type Job = {
|
|
|
109
115
|
readonly permissions?: Permissions;
|
|
110
116
|
readonly environment?: { readonly name: string; readonly url?: string };
|
|
111
117
|
readonly env?: Readonly<Record<string, Scalar>>;
|
|
118
|
+
/** What the job gives the jobs that need it, by name: an expression of its steps' outputs. */
|
|
119
|
+
readonly outputs?: Readonly<Record<string, Expr>>;
|
|
112
120
|
readonly strategy?: Strategy;
|
|
113
121
|
readonly steps: readonly [Step, ...Step[]];
|
|
114
122
|
/** A comment written above the job. */
|
package/src/workflows/render.ts
CHANGED
|
@@ -126,10 +126,12 @@ function jobLines(id: string, j: Job): string[] {
|
|
|
126
126
|
if (j.environment.url !== undefined) out.push(...entry("url", j.environment.url, 6));
|
|
127
127
|
}
|
|
128
128
|
out.push(...mapping("env", j.env, 4));
|
|
129
|
+
out.push(...mapping("outputs", j.outputs, 4));
|
|
129
130
|
if (j.strategy !== undefined) {
|
|
130
131
|
out.push(" strategy:");
|
|
131
132
|
if (j.strategy.failFast !== undefined) out.push(...entry("fail-fast", j.strategy.failFast, 6));
|
|
132
|
-
|
|
133
|
+
const m = j.strategy.matrix;
|
|
134
|
+
out.push(...(typeof m === "string" ? entry("matrix", m, 6) : [" matrix:", ...Object.entries(m).flatMap(([k, v]) => flowList(k, v, 8))]));
|
|
133
135
|
}
|
|
134
136
|
out.push(" steps:", ...j.steps.flatMap((s) => step(s, 6)));
|
|
135
137
|
return out;
|
|
@@ -141,7 +143,13 @@ export function renderWorkflow(w: Workflow): string {
|
|
|
141
143
|
if (w.comment !== undefined) out.push(...comment(w.comment, 0));
|
|
142
144
|
out.push("on:");
|
|
143
145
|
out.push(...filter("push", w.on.push, 2), ...filter("pull_request", w.on.pullRequest, 2));
|
|
144
|
-
|
|
146
|
+
const dispatch = w.on.workflowDispatch;
|
|
147
|
+
if (dispatch === true) out.push(" workflow_dispatch:");
|
|
148
|
+
else if (dispatch !== undefined) {
|
|
149
|
+
out.push(" workflow_dispatch:", " inputs:");
|
|
150
|
+
for (const [k, v] of Object.entries(dispatch.inputs))
|
|
151
|
+
out.push(` ${key(k)}:`, ...entry("description", v.description, 8), ...entry("type", v.type, 8), ...entry("default", v.default, 8));
|
|
152
|
+
}
|
|
145
153
|
if (w.on.workflowCall === true) out.push(" workflow_call:");
|
|
146
154
|
out.push("");
|
|
147
155
|
if (w.permissions !== undefined) out.push(...permissions(w.permissions, 0), "");
|