@intellectual-frontiers/libraries 0.2.1 → 0.4.1
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/LICENSE +75 -21
- package/dist/affected.d.ts +15 -2
- package/dist/affected.js +51 -20
- package/dist/dev.d.ts +83 -0
- package/dist/dev.js +359 -0
- package/dist/family.d.ts +58 -0
- package/dist/family.js +125 -0
- package/dist/generate-ontology.js +4 -0
- package/dist/generate-workflows.js +2 -10
- package/dist/install-bun.js +19 -14
- package/dist/libraries.d.ts +8 -0
- package/dist/libraries.js +24 -3
- package/dist/license/standard.d.ts +46 -0
- package/dist/license/standard.js +43 -0
- package/dist/license/third-party.d.ts +25 -0
- package/dist/license/third-party.js +71 -0
- package/dist/license.d.ts +61 -0
- package/dist/license.js +204 -0
- package/dist/link.d.ts +12 -0
- package/dist/link.js +98 -0
- package/dist/pack-library.d.ts +2 -0
- package/dist/pack-library.js +21 -3
- package/dist/pins.d.ts +34 -7
- package/dist/pins.js +36 -9
- package/dist/plan.d.ts +28 -0
- package/dist/plan.js +135 -0
- package/dist/readme.d.ts +59 -0
- package/dist/readme.js +272 -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 +201 -278
- package/dist/workflows/model.d.ts +19 -3
- package/dist/workflows/render.js +10 -2
- package/package.json +44 -14
- package/src/affected.ts +56 -17
- package/src/dev.ts +379 -0
- package/src/family.ts +144 -0
- package/src/generate-ontology.ts +4 -0
- package/src/generate-workflows.ts +3 -11
- package/src/install-bun.ts +16 -13
- package/src/libraries.ts +27 -3
- package/src/license/standard.ts +67 -0
- package/src/license/third-party.ts +87 -0
- package/src/license.ts +222 -0
- package/src/link.ts +97 -0
- package/src/pack-library.ts +21 -3
- package/src/pins.ts +55 -10
- package/src/plan.ts +143 -0
- package/src/readme.ts +278 -0
- package/src/releasing.ts +735 -0
- package/src/versions.ts +3 -7
- package/src/workflows/definitions.ts +262 -397
- package/src/workflows/model.ts +15 -3
- package/src/workflows/render.ts +10 -2
package/src/workflows/model.ts
CHANGED
|
@@ -85,20 +85,29 @@ 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
|
+
|
|
91
|
+
/** What starts a generated workflow: pushes, pull requests, dispatch and schedule. */
|
|
88
92
|
export type Triggers = {
|
|
89
93
|
readonly push?: Filter;
|
|
90
94
|
readonly pullRequest?: Filter;
|
|
91
|
-
/** Run by hand from the Actions page. */
|
|
92
|
-
readonly workflowDispatch?: true;
|
|
95
|
+
/** Run by hand from the Actions page, with the inputs it asks for (true asks for none). */
|
|
96
|
+
readonly workflowDispatch?: true | { readonly inputs: Readonly<Record<string, DispatchInput>> };
|
|
93
97
|
/** Called by another workflow. */
|
|
94
98
|
readonly workflowCall?: true;
|
|
95
99
|
};
|
|
96
100
|
|
|
101
|
+
/** 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. */
|
|
102
|
+
export type Matrix = Readonly<Record<string, readonly (string | number)[]>> | Expr;
|
|
103
|
+
|
|
104
|
+
/** The matrix strategy of a job of a generated workflow. */
|
|
97
105
|
export type Strategy = {
|
|
98
106
|
readonly failFast?: boolean;
|
|
99
|
-
readonly matrix:
|
|
107
|
+
readonly matrix: Matrix;
|
|
100
108
|
};
|
|
101
109
|
|
|
110
|
+
/** A job of a generated workflow. */
|
|
102
111
|
export type Job = {
|
|
103
112
|
readonly name?: string;
|
|
104
113
|
readonly runsOn: Runner;
|
|
@@ -109,6 +118,8 @@ export type Job = {
|
|
|
109
118
|
readonly permissions?: Permissions;
|
|
110
119
|
readonly environment?: { readonly name: string; readonly url?: string };
|
|
111
120
|
readonly env?: Readonly<Record<string, Scalar>>;
|
|
121
|
+
/** What the job gives the jobs that need it, by name: an expression of its steps' outputs. */
|
|
122
|
+
readonly outputs?: Readonly<Record<string, Expr>>;
|
|
112
123
|
readonly strategy?: Strategy;
|
|
113
124
|
readonly steps: readonly [Step, ...Step[]];
|
|
114
125
|
/** A comment written above the job. */
|
|
@@ -118,6 +129,7 @@ export type Job = {
|
|
|
118
129
|
/** A job, written as a function so that its steps are read as a non-empty tuple. */
|
|
119
130
|
export const job = (j: Job): Job => j;
|
|
120
131
|
|
|
132
|
+
/** A generated workflow: its name, triggers, permissions and jobs. */
|
|
121
133
|
export type Workflow = {
|
|
122
134
|
/** The file's name without its directory and extension: `data` is `.github/workflows/data.auto.yml`. */
|
|
123
135
|
readonly file: string;
|
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), "");
|