gagen 0.3.4 → 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/README.md +20 -110
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/cli.d.ts +4 -0
- package/esm/cli.d.ts.map +1 -0
- package/esm/cli.js +48 -0
- package/esm/job.d.ts.map +1 -1
- package/esm/job.js +3 -2
- package/esm/mod.js +4 -0
- package/esm/step.d.ts +4 -2
- package/esm/step.d.ts.map +1 -1
- package/esm/step.js +8 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -100,10 +100,28 @@ up to date:
|
|
|
100
100
|
```ts
|
|
101
101
|
const lintStep = step({
|
|
102
102
|
name: "Lint CI generation",
|
|
103
|
+
// alternatively, use `npx gagen --lint` to lint all the files
|
|
104
|
+
// in the `.github/workflows` folder
|
|
103
105
|
run: "./.github/workflows/ci.ts --lint",
|
|
104
106
|
});
|
|
105
107
|
```
|
|
106
108
|
|
|
109
|
+
## CLI
|
|
110
|
+
|
|
111
|
+
If you store your generations scripts beside your `.yml` files in the
|
|
112
|
+
`.github/workflows` folder, then you can automatically run all these scripts by
|
|
113
|
+
using the `gagen` binary:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
# generate the output
|
|
117
|
+
npx gagen
|
|
118
|
+
|
|
119
|
+
# lint the output
|
|
120
|
+
npx gagen --lint
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The requires your scripts to use the `writeOrLint` function.
|
|
124
|
+
|
|
107
125
|
## Dependency pinning—the output is a lockfile
|
|
108
126
|
|
|
109
127
|
By default, `writeOrLint` pins action references to their resolved commit hashes
|
|
@@ -417,68 +435,6 @@ workflow({
|
|
|
417
435
|
});
|
|
418
436
|
```
|
|
419
437
|
|
|
420
|
-
Also works with key-value arrays:
|
|
421
|
-
|
|
422
|
-
```ts
|
|
423
|
-
const matrix = defineMatrix({
|
|
424
|
-
os: ["linux", "macos"],
|
|
425
|
-
node: [18, 20],
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
matrix.os.equals("linux"); // condition for use in step `if`
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
### Matrix exclude
|
|
432
|
-
|
|
433
|
-
Pass an `exclude` array to remove specific combinations:
|
|
434
|
-
|
|
435
|
-
```ts
|
|
436
|
-
const matrix = defineMatrix({
|
|
437
|
-
os: ["linux", "macos"],
|
|
438
|
-
node: [18, 20],
|
|
439
|
-
exclude: [{ os: "macos", node: 18 }],
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
// matrix.os and matrix.node are still typed — exclude is not a key
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
## Permissions
|
|
446
|
-
|
|
447
|
-
Type-safe workflow and job permissions:
|
|
448
|
-
|
|
449
|
-
```ts
|
|
450
|
-
import { workflow } from "gagen";
|
|
451
|
-
|
|
452
|
-
const wf = workflow({
|
|
453
|
-
name: "ci",
|
|
454
|
-
on: ["push", "pull_request"],
|
|
455
|
-
permissions: { contents: "read", packages: "write" },
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
// or use a scalar value
|
|
459
|
-
const wf2 = workflow({
|
|
460
|
-
name: "ci",
|
|
461
|
-
on: ["push", "pull_request"],
|
|
462
|
-
permissions: "read-all",
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
// job-level permissions
|
|
466
|
-
workflow({
|
|
467
|
-
...,
|
|
468
|
-
jobs: [
|
|
469
|
-
{
|
|
470
|
-
id: "deploy",
|
|
471
|
-
runsOn: "ubuntu-latest",
|
|
472
|
-
permissions: { contents: "read", "id-token": "write" },
|
|
473
|
-
steps: [deploy],
|
|
474
|
-
},
|
|
475
|
-
],
|
|
476
|
-
});
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
Permission scopes (`contents`, `packages`, `id-token`, etc.) and levels (`read`,
|
|
480
|
-
`write`, `none`) are fully typed.
|
|
481
|
-
|
|
482
438
|
## Artifacts
|
|
483
439
|
|
|
484
440
|
Link upload and download artifact steps across jobs with automatic `needs`
|
|
@@ -507,10 +463,10 @@ const wf = workflow({
|
|
|
507
463
|
runsOn: "ubuntu-latest",
|
|
508
464
|
steps: [
|
|
509
465
|
buildOutput.download({ dirPath: "output/" }),
|
|
510
|
-
|
|
466
|
+
{
|
|
511
467
|
name: "Deploy",
|
|
512
468
|
run: "make deploy",
|
|
513
|
-
}
|
|
469
|
+
},
|
|
514
470
|
],
|
|
515
471
|
},
|
|
516
472
|
],
|
|
@@ -528,49 +484,3 @@ const buildOutput = artifact("build-output", {
|
|
|
528
484
|
retentionDays: 5,
|
|
529
485
|
});
|
|
530
486
|
```
|
|
531
|
-
|
|
532
|
-
## Job configuration
|
|
533
|
-
|
|
534
|
-
```ts
|
|
535
|
-
const matrix = defineMatrix({
|
|
536
|
-
include: [
|
|
537
|
-
{ runner: "ubuntu-latest" },
|
|
538
|
-
{ runner: "macos-latest" },
|
|
539
|
-
],
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
workflow({
|
|
543
|
-
...,
|
|
544
|
-
jobs: [
|
|
545
|
-
{
|
|
546
|
-
id: "build",
|
|
547
|
-
name: "Build",
|
|
548
|
-
runsOn: matrix.runner,
|
|
549
|
-
timeoutMinutes: 60,
|
|
550
|
-
defaults: { run: { shell: "bash" } },
|
|
551
|
-
env: { CARGO_TERM_COLOR: "always" },
|
|
552
|
-
permissions: { contents: "read" },
|
|
553
|
-
concurrency: { group: "build-${{ github.ref }}", cancelInProgress: true },
|
|
554
|
-
strategy: { matrix, failFast: true },
|
|
555
|
-
steps: [test],
|
|
556
|
-
},
|
|
557
|
-
],
|
|
558
|
-
});
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
## Step configuration
|
|
562
|
-
|
|
563
|
-
```ts
|
|
564
|
-
step({
|
|
565
|
-
name: "Deploy",
|
|
566
|
-
id: "deploy",
|
|
567
|
-
uses: "actions/deploy@v1",
|
|
568
|
-
with: { token: "${{ secrets.GITHUB_TOKEN }}" },
|
|
569
|
-
env: { NODE_ENV: "production" },
|
|
570
|
-
if: "github.ref == 'refs/heads/main'",
|
|
571
|
-
shell: "bash",
|
|
572
|
-
workingDirectory: "./app",
|
|
573
|
-
continueOnError: true,
|
|
574
|
-
timeoutMinutes: 10,
|
|
575
|
-
});
|
|
576
|
-
```
|
package/esm/_dnt.polyfills.d.ts
CHANGED
|
@@ -1,3 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
1
100
|
declare global {
|
|
2
101
|
interface Object {
|
|
3
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC;AAgBxB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;;;WAIG;QACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC"}
|
package/esm/_dnt.polyfills.js
CHANGED
|
@@ -1,3 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
+
configurable: true,
|
|
23
|
+
get() {
|
|
24
|
+
return fn;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
+
(() => {
|
|
31
|
+
const moduleImportMetaWM = new WeakMap();
|
|
32
|
+
return (require, module) => {
|
|
33
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
+
if (importMetaCache == null) {
|
|
35
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
+
url: pathToFileURL(module.filename).href,
|
|
37
|
+
main: require.main == module,
|
|
38
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
+
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
+
? require
|
|
41
|
+
: createRequire(parentURL))
|
|
42
|
+
.resolve(specifier)).href;
|
|
43
|
+
},
|
|
44
|
+
filename: module.filename,
|
|
45
|
+
dirname: module.path,
|
|
46
|
+
});
|
|
47
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
+
importMetaCache = importMeta;
|
|
49
|
+
}
|
|
50
|
+
return importMetaCache;
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
+
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
+
((importMeta) => {
|
|
56
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
+
const shimWs = new WeakSet();
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
60
|
+
.replace(/\/{3,}/, "///");
|
|
61
|
+
const commonShim = (importMeta) => {
|
|
62
|
+
if (typeof importMeta.main !== "boolean") {
|
|
63
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
+
}
|
|
65
|
+
if (typeof importMeta.filename !== "string") {
|
|
66
|
+
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
+
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
+
resolveFunStr === "undefined" ||
|
|
73
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
+
resolveFunStr.startsWith("async")
|
|
75
|
+
// enable by --experimental-import-meta-resolve flag
|
|
76
|
+
) {
|
|
77
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
+
if (!shimWs.has(importMeta)) {
|
|
79
|
+
shimWs.add(importMeta);
|
|
80
|
+
const importMetaUrlRequire = {
|
|
81
|
+
url: importMeta.url,
|
|
82
|
+
require: createRequire(importMeta.url),
|
|
83
|
+
};
|
|
84
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
+
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
+
? importMetaUrlRequire.require
|
|
87
|
+
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
+
};
|
|
89
|
+
commonShim(importMeta);
|
|
90
|
+
}
|
|
91
|
+
return importMeta;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
/// native support
|
|
96
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
+
if (!shimWs.has(importMeta)) {
|
|
98
|
+
shimWs.add(importMeta);
|
|
99
|
+
commonShim(importMeta);
|
|
100
|
+
}
|
|
101
|
+
return importMeta;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
+
}));
|
|
106
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
+
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
+
const _MODULE = (() => {
|
|
109
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
+
return "commonjs";
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// eval("typeof import.meta");
|
|
114
|
+
return "esmodule";
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
if (_MODULE === "commonjs") {
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
+
}
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
return import_meta_ponyfill(...args);
|
|
127
|
+
});
|
|
1
128
|
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
2
129
|
if (!Object.hasOwn) {
|
|
3
130
|
Object.defineProperty(Object, "hasOwn", {
|
|
@@ -12,4 +139,3 @@ if (!Object.hasOwn) {
|
|
|
12
139
|
writable: true,
|
|
13
140
|
});
|
|
14
141
|
}
|
|
15
|
-
export {};
|
package/esm/cli.d.ts
ADDED
package/esm/cli.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AAM7B,wBAAsB,MAAM,kBA6B3B"}
|
package/esm/cli.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./_dnt.polyfills.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
export async function runCli() {
|
|
8
|
+
const workflowsDir = findWorkflowsDir();
|
|
9
|
+
if (workflowsDir == null) {
|
|
10
|
+
console.error("No .github/workflows directory found.");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
const entries = fs.readdirSync(workflowsDir);
|
|
14
|
+
const extensions = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"];
|
|
15
|
+
const tsFiles = entries
|
|
16
|
+
.filter((f) => extensions.some((ext) => f.endsWith(ext)))
|
|
17
|
+
.sort();
|
|
18
|
+
if (tsFiles.length === 0) {
|
|
19
|
+
console.error("No script files found in .github/workflows");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const isLinting = process.argv.includes("--lint");
|
|
23
|
+
for (const file of tsFiles) {
|
|
24
|
+
const fullPath = resolve(workflowsDir, file);
|
|
25
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
26
|
+
if (!content.includes("writeOrLint"))
|
|
27
|
+
continue;
|
|
28
|
+
const label = isLinting ? "Linting" : "Generating";
|
|
29
|
+
const color = isLinting ? "\x1b[36m" : "\x1b[32m";
|
|
30
|
+
console.error(`${color}${label}\x1b[0m ${file}`);
|
|
31
|
+
await import(pathToFileURL(fullPath).href);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function findWorkflowsDir() {
|
|
35
|
+
let dir = resolve(".");
|
|
36
|
+
while (true) {
|
|
37
|
+
const candidate = join(dir, ".github", "workflows");
|
|
38
|
+
if (fs.existsSync(candidate))
|
|
39
|
+
return candidate;
|
|
40
|
+
const parent = dirname(dir);
|
|
41
|
+
if (parent === dir)
|
|
42
|
+
return undefined;
|
|
43
|
+
dir = parent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).main) {
|
|
47
|
+
await runCli();
|
|
48
|
+
}
|
package/esm/job.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAIhB,IAAI,EACJ,KAAK,QAAQ,EAId,MAAM,WAAW,CAAC;AAEnB,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC;IACrE,eAAe,CAAC,E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AU,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAoKvE;AA6kBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQhD;AAID,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAUnD"}
|
package/esm/job.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _Job_instances, _Job_id, _Job_config, _Job_leafItems, _Job_outputDefs, _Job_cachedGraph, _Job_cachedLeafSteps, _Job_buildGraph;
|
|
13
13
|
import { Condition, ExpressionValue, isAlwaysFalse, isAlwaysTrue, } from "./expression.js";
|
|
14
14
|
import { Matrix } from "./matrix.js";
|
|
15
|
-
import { serializeConditionLike, serializeConfigValues, Step, StepRef, toCondition, unwrapSteps, } from "./step.js";
|
|
15
|
+
import { normalizeStepLike, serializeConditionLike, serializeConfigValues, Step, StepRef, toCondition, unwrapSteps, } from "./step.js";
|
|
16
16
|
function ensureEntry(graph, step) {
|
|
17
17
|
let entry = graph.get(step);
|
|
18
18
|
if (!entry) {
|
|
@@ -93,7 +93,8 @@ function propagatableConfigIf(step) {
|
|
|
93
93
|
* collected in `deferredAfterDeps` and resolved later, so that comesAfter
|
|
94
94
|
* only adds ordering edges for steps already present in the graph.
|
|
95
95
|
*/
|
|
96
|
-
function flattenStepLike(
|
|
96
|
+
function flattenStepLike(rawItem, graph, isLeaf, leafSteps, deferredAfterDeps, contextCondition) {
|
|
97
|
+
const item = normalizeStepLike(rawItem);
|
|
97
98
|
if (item instanceof StepRef) {
|
|
98
99
|
const step = item.step;
|
|
99
100
|
// AND this StepRef's condition with the parent context
|
package/esm/mod.js
CHANGED
|
@@ -13,3 +13,7 @@ import { artifact as artifact_ } from "./artifact.js";
|
|
|
13
13
|
export const createWorkflow = workflow_;
|
|
14
14
|
/** @deprecated Use `artifact` instead. */
|
|
15
15
|
export const defineArtifact = artifact_;
|
|
16
|
+
// run the cli
|
|
17
|
+
if (globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).main) {
|
|
18
|
+
import("./cli.js").then((mod) => mod.runCli());
|
|
19
|
+
}
|
package/esm/step.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface StepConfig<O extends string = never> {
|
|
|
16
16
|
readonly outputs?: readonly O[];
|
|
17
17
|
}
|
|
18
18
|
export declare function resetStepCounter(): void;
|
|
19
|
-
export type StepLike = Step<string> | StepRef<string
|
|
19
|
+
export type StepLike = Step<string> | StepRef<string> | StepConfig;
|
|
20
20
|
export declare class Step<O extends string = never> implements ExpressionSource {
|
|
21
21
|
#private;
|
|
22
22
|
readonly config: StepConfig<O>;
|
|
@@ -68,8 +68,10 @@ export declare class StepRef<O extends string = never> {
|
|
|
68
68
|
export declare function serializeConditionLike(c: ConditionLike): string;
|
|
69
69
|
export declare function toCondition(c: ConditionLike): Condition;
|
|
70
70
|
export declare function serializeConfigValues(record: Record<string, ConfigValue>): Record<string, string | number | boolean>;
|
|
71
|
+
/** Normalizes a StepLike to a Step or StepRef, auto-wrapping plain objects. */
|
|
72
|
+
export declare function normalizeStepLike(item: StepLike): Step<string> | StepRef<string>;
|
|
71
73
|
/** Extracts the underlying Step from a StepLike (Step or StepRef). */
|
|
72
|
-
export declare function unwrapStep(item:
|
|
74
|
+
export declare function unwrapStep(item: StepLike): Step<string>;
|
|
73
75
|
/** Extracts all underlying leaf Steps from a StepLike (recursively for composites). */
|
|
74
76
|
export declare function unwrapSteps(item: StepLike): Step<string>[];
|
|
75
77
|
//# sourceMappingURL=step.d.ts.map
|
package/esm/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sour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AE,GAAG,OAAO,CAAC,CAAC,CAAC;IAQ1C,UAAU,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAQ3C,EAAE,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;CAOzC;AAID,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAQ/D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,SAAS,CAMvD;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAM3C;AAID,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,GACb,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAGhC;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAGvD;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAM1D"}
|
package/esm/step.js
CHANGED
|
@@ -290,9 +290,16 @@ export function serializeConfigValues(record) {
|
|
|
290
290
|
return result;
|
|
291
291
|
}
|
|
292
292
|
// --- helpers ---
|
|
293
|
+
/** Normalizes a StepLike to a Step or StepRef, auto-wrapping plain objects. */
|
|
294
|
+
export function normalizeStepLike(item) {
|
|
295
|
+
if (item instanceof Step || item instanceof StepRef)
|
|
296
|
+
return item;
|
|
297
|
+
return new Step(item);
|
|
298
|
+
}
|
|
293
299
|
/** Extracts the underlying Step from a StepLike (Step or StepRef). */
|
|
294
300
|
export function unwrapStep(item) {
|
|
295
|
-
|
|
301
|
+
const normalized = normalizeStepLike(item);
|
|
302
|
+
return normalized instanceof StepRef ? normalized.step : normalized;
|
|
296
303
|
}
|
|
297
304
|
/** Extracts all underlying leaf Steps from a StepLike (recursively for composites). */
|
|
298
305
|
export function unwrapSteps(item) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gagen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Generate complex GitHub Actions YAML files using a declarative API.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"test": "node test_runner.js"
|
|
21
21
|
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"gagen": "./esm/cli.js"
|
|
24
|
+
},
|
|
22
25
|
"devDependencies": {
|
|
23
26
|
"@types/node": "^20.9.0",
|
|
24
27
|
"picocolors": "^1.0.0",
|