@form8ion/github-workflows-core 5.0.0 → 5.2.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 +15 -2
- package/example.js +13 -3
- package/lib/index.js +14 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +13 -3
- package/lib/index.mjs.map +1 -1
- package/package.json +24 -23
package/README.md
CHANGED
|
@@ -17,6 +17,12 @@ core functionality for form8ion plugins that manage github workflows
|
|
|
17
17
|
* [Example](#example)
|
|
18
18
|
* [Import](#import)
|
|
19
19
|
* [Execute](#execute)
|
|
20
|
+
* [API](#api)
|
|
21
|
+
* [`scaffoldCheckoutStep`](#scaffoldcheckoutstep)
|
|
22
|
+
* [`scaffoldNodeSetupStep`](#scaffoldnodesetupstep)
|
|
23
|
+
* [`versionDeterminedBy` __string__ (_required_)](#versiondeterminedby-string-required)
|
|
24
|
+
* [`scaffoldDependencyInstallationStep`](#scaffolddependencyinstallationstep)
|
|
25
|
+
* [`scaffoldVerificationStep`](#scaffoldverificationstep)
|
|
20
26
|
* [Contributing](#contributing)
|
|
21
27
|
* [Dependencies](#dependencies)
|
|
22
28
|
* [Verification](#verification)
|
|
@@ -47,13 +53,17 @@ import {
|
|
|
47
53
|
scaffoldCheckoutStep,
|
|
48
54
|
scaffoldNodeSetupStep,
|
|
49
55
|
scaffoldDependencyInstallationStep,
|
|
50
|
-
scaffoldVerificationStep
|
|
56
|
+
scaffoldVerificationStep,
|
|
57
|
+
loadWorkflowFile,
|
|
58
|
+
writeWorkflowFile
|
|
51
59
|
} from '@form8ion/github-workflows-core';
|
|
52
60
|
```
|
|
53
61
|
|
|
54
62
|
#### Execute
|
|
55
63
|
|
|
56
64
|
```javascript
|
|
65
|
+
const projectRoot = process.cwd();
|
|
66
|
+
|
|
57
67
|
(async () => {
|
|
58
68
|
scaffoldCheckoutStep();
|
|
59
69
|
|
|
@@ -62,6 +72,9 @@ import {
|
|
|
62
72
|
scaffoldDependencyInstallationStep();
|
|
63
73
|
|
|
64
74
|
scaffoldVerificationStep();
|
|
75
|
+
|
|
76
|
+
await loadWorkflowFile({projectRoot, name: 'existing-workflow-name'});
|
|
77
|
+
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
|
|
65
78
|
})();
|
|
66
79
|
```
|
|
67
80
|
|
|
@@ -148,7 +161,7 @@ $ npm test
|
|
|
148
161
|
|
|
149
162
|
[license-link]: LICENSE
|
|
150
163
|
|
|
151
|
-
[license-badge]: https://img.shields.io/github/license/form8ion/github-workflows-core.svg
|
|
164
|
+
[license-badge]: https://img.shields.io/github/license/form8ion/github-workflows-core.svg?logo=opensourceinitiative
|
|
152
165
|
|
|
153
166
|
[npm-link]: https://www.npmjs.com/package/@form8ion/github-workflows-core
|
|
154
167
|
|
package/example.js
CHANGED
|
@@ -5,14 +5,21 @@ import {
|
|
|
5
5
|
scaffoldCheckoutStep,
|
|
6
6
|
scaffoldNodeSetupStep,
|
|
7
7
|
scaffoldDependencyInstallationStep,
|
|
8
|
-
scaffoldVerificationStep
|
|
8
|
+
scaffoldVerificationStep,
|
|
9
|
+
loadWorkflowFile,
|
|
10
|
+
writeWorkflowFile
|
|
9
11
|
} from './lib/index.js';
|
|
10
12
|
|
|
11
|
-
// remark-usage-ignore-next
|
|
12
|
-
stubbedFs(
|
|
13
|
+
// remark-usage-ignore-next 4
|
|
14
|
+
stubbedFs({
|
|
15
|
+
node_modules: stubbedFs.load('node_modules'),
|
|
16
|
+
'.github': {workflows: {'existing-workflow-name.yml': 'foo: bar'}}
|
|
17
|
+
});
|
|
13
18
|
|
|
14
19
|
// #### Execute
|
|
15
20
|
|
|
21
|
+
const projectRoot = process.cwd();
|
|
22
|
+
|
|
16
23
|
(async () => {
|
|
17
24
|
scaffoldCheckoutStep();
|
|
18
25
|
|
|
@@ -21,4 +28,7 @@ stubbedFs();
|
|
|
21
28
|
scaffoldDependencyInstallationStep();
|
|
22
29
|
|
|
23
30
|
scaffoldVerificationStep();
|
|
31
|
+
|
|
32
|
+
await loadWorkflowFile({projectRoot, name: 'existing-workflow-name'});
|
|
33
|
+
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
|
|
24
34
|
})();
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var core = require('@form8ion/core');
|
|
4
|
+
|
|
3
5
|
function setupNode({versionDeterminedBy}) {
|
|
4
6
|
return {
|
|
5
7
|
name: 'Setup node',
|
|
6
|
-
uses: 'actions/setup-node@
|
|
8
|
+
uses: 'actions/setup-node@v4.0.3',
|
|
7
9
|
with: {
|
|
8
10
|
...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},
|
|
9
11
|
// eslint-disable-next-line no-template-curly-in-string
|
|
@@ -25,11 +27,21 @@ function installDependencies() {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
function checkout() {
|
|
28
|
-
return {uses: 'actions/checkout@
|
|
30
|
+
return {uses: 'actions/checkout@v4.1.7'};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function load ({projectRoot, name}) {
|
|
34
|
+
return core.loadConfigFile({path: `${projectRoot}/.github/workflows`, name, format: core.fileTypes.YAML});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function write ({projectRoot, name, config}) {
|
|
38
|
+
return core.writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: core.fileTypes.YAML});
|
|
29
39
|
}
|
|
30
40
|
|
|
41
|
+
exports.loadWorkflowFile = load;
|
|
31
42
|
exports.scaffoldCheckoutStep = checkout;
|
|
32
43
|
exports.scaffoldDependencyInstallationStep = installDependencies;
|
|
33
44
|
exports.scaffoldNodeSetupStep = setupNode;
|
|
34
45
|
exports.scaffoldVerificationStep = executeVerification;
|
|
46
|
+
exports.writeWorkflowFile = write;
|
|
35
47
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/steps/scaffolders.js"],"sourcesContent":["export function setupNode({versionDeterminedBy}) {\n return {\n name: 'Setup node',\n uses: 'actions/setup-node@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/steps/scaffolders.js","../src/workflow-file/load.js","../src/workflow-file/write.js"],"sourcesContent":["export function setupNode({versionDeterminedBy}) {\n return {\n name: 'Setup node',\n uses: 'actions/setup-node@v4.0.3',\n with: {\n ...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},\n // eslint-disable-next-line no-template-curly-in-string\n ...'matrix' === versionDeterminedBy && {'node-version': '${{ matrix.node }}'},\n cache: 'npm'\n }\n };\n}\n\nexport function executeVerification() {\n return {run: 'npm test'};\n}\n\nexport function installDependencies() {\n return [\n {run: 'npm clean-install'},\n {run: 'corepack npm audit signatures'}\n ];\n}\n\nexport function checkout() {\n return {uses: 'actions/checkout@v4.1.7'};\n}\n","import {fileTypes, loadConfigFile} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return loadConfigFile({path: `${projectRoot}/.github/workflows`, name, format: fileTypes.YAML});\n}\n","import {fileTypes, writeConfigFile} from '@form8ion/core';\n\nexport default function ({projectRoot, name, config}) {\n return writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: fileTypes.YAML});\n}\n"],"names":["loadConfigFile","fileTypes","writeConfigFile"],"mappings":";;;;AAAO,SAAS,SAAS,CAAC,CAAC,mBAAmB,CAAC,EAAE;AACjD,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,IAAI,EAAE,2BAA2B;AACrC,IAAI,IAAI,EAAE;AACV,MAAM,GAAG,OAAO,KAAK,mBAAmB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;AAC3E;AACA,MAAM,GAAG,QAAQ,KAAK,mBAAmB,IAAI,CAAC,cAAc,EAAE,oBAAoB,CAAC;AACnF,MAAM,KAAK,EAAE,KAAK;AAClB,KAAK;AACL,GAAG,CAAC;AACJ,CAAC;AACD;AACO,SAAS,mBAAmB,GAAG;AACtC,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC3B,CAAC;AACD;AACO,SAAS,mBAAmB,GAAG;AACtC,EAAE,OAAO;AACT,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC;AAC9B,IAAI,CAAC,GAAG,EAAE,+BAA+B,CAAC;AAC1C,GAAG,CAAC;AACJ,CAAC;AACD;AACO,SAAS,QAAQ,GAAG;AAC3B,EAAE,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;AAC3C;;ACxBe,aAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE;AAC9C,EAAE,OAAOA,mBAAc,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAEC,cAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAClG;;ACFe,cAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;AACtD,EAAE,OAAOC,oBAAe,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAED,cAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3G;;;;;;;;;"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { loadConfigFile, fileTypes, writeConfigFile } from '@form8ion/core';
|
|
2
|
+
|
|
1
3
|
function setupNode({versionDeterminedBy}) {
|
|
2
4
|
return {
|
|
3
5
|
name: 'Setup node',
|
|
4
|
-
uses: 'actions/setup-node@
|
|
6
|
+
uses: 'actions/setup-node@v4.0.3',
|
|
5
7
|
with: {
|
|
6
8
|
...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},
|
|
7
9
|
// eslint-disable-next-line no-template-curly-in-string
|
|
@@ -23,8 +25,16 @@ function installDependencies() {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
function checkout() {
|
|
26
|
-
return {uses: 'actions/checkout@
|
|
28
|
+
return {uses: 'actions/checkout@v4.1.7'};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function load ({projectRoot, name}) {
|
|
32
|
+
return loadConfigFile({path: `${projectRoot}/.github/workflows`, name, format: fileTypes.YAML});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function write ({projectRoot, name, config}) {
|
|
36
|
+
return writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: fileTypes.YAML});
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
export { checkout as scaffoldCheckoutStep, installDependencies as scaffoldDependencyInstallationStep, setupNode as scaffoldNodeSetupStep, executeVerification as scaffoldVerificationStep };
|
|
39
|
+
export { load as loadWorkflowFile, checkout as scaffoldCheckoutStep, installDependencies as scaffoldDependencyInstallationStep, setupNode as scaffoldNodeSetupStep, executeVerification as scaffoldVerificationStep, write as writeWorkflowFile };
|
|
30
40
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/steps/scaffolders.js"],"sourcesContent":["export function setupNode({versionDeterminedBy}) {\n return {\n name: 'Setup node',\n uses: 'actions/setup-node@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/steps/scaffolders.js","../src/workflow-file/load.js","../src/workflow-file/write.js"],"sourcesContent":["export function setupNode({versionDeterminedBy}) {\n return {\n name: 'Setup node',\n uses: 'actions/setup-node@v4.0.3',\n with: {\n ...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},\n // eslint-disable-next-line no-template-curly-in-string\n ...'matrix' === versionDeterminedBy && {'node-version': '${{ matrix.node }}'},\n cache: 'npm'\n }\n };\n}\n\nexport function executeVerification() {\n return {run: 'npm test'};\n}\n\nexport function installDependencies() {\n return [\n {run: 'npm clean-install'},\n {run: 'corepack npm audit signatures'}\n ];\n}\n\nexport function checkout() {\n return {uses: 'actions/checkout@v4.1.7'};\n}\n","import {fileTypes, loadConfigFile} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return loadConfigFile({path: `${projectRoot}/.github/workflows`, name, format: fileTypes.YAML});\n}\n","import {fileTypes, writeConfigFile} from '@form8ion/core';\n\nexport default function ({projectRoot, name, config}) {\n return writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: fileTypes.YAML});\n}\n"],"names":[],"mappings":";;AAAO,SAAS,SAAS,CAAC,CAAC,mBAAmB,CAAC,EAAE;AACjD,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,IAAI,EAAE,2BAA2B;AACrC,IAAI,IAAI,EAAE;AACV,MAAM,GAAG,OAAO,KAAK,mBAAmB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;AAC3E;AACA,MAAM,GAAG,QAAQ,KAAK,mBAAmB,IAAI,CAAC,cAAc,EAAE,oBAAoB,CAAC;AACnF,MAAM,KAAK,EAAE,KAAK;AAClB,KAAK;AACL,GAAG,CAAC;AACJ,CAAC;AACD;AACO,SAAS,mBAAmB,GAAG;AACtC,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC3B,CAAC;AACD;AACO,SAAS,mBAAmB,GAAG;AACtC,EAAE,OAAO;AACT,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC;AAC9B,IAAI,CAAC,GAAG,EAAE,+BAA+B,CAAC;AAC1C,GAAG,CAAC;AACJ,CAAC;AACD;AACO,SAAS,QAAQ,GAAG;AAC3B,EAAE,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;AAC3C;;ACxBe,aAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE;AAC9C,EAAE,OAAO,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAClG;;ACFe,cAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;AACtD,EAAE,OAAO,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3G;;;;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@form8ion/github-workflows-core",
|
|
3
3
|
"description": "core functionality for form8ion plugins that manage github workflows",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.2.0",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^18.17 || >=20.6.1"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"build": "npm-run-all --print-label --parallel build:*",
|
|
37
37
|
"prepack": "run-s build",
|
|
38
38
|
"test:unit": "cross-env NODE_ENV=test c8 run-s test:unit:base",
|
|
39
|
-
"test:unit:base": "DEBUG=any
|
|
39
|
+
"test:unit:base": "DEBUG=any vitest run",
|
|
40
40
|
"lint:lockfile": "lockfile-lint",
|
|
41
41
|
"lint:js": "eslint . --cache",
|
|
42
42
|
"lint:js:fix": "run-s 'lint:js -- --fix'",
|
|
@@ -57,38 +57,39 @@
|
|
|
57
57
|
"access": "public",
|
|
58
58
|
"provenance": true
|
|
59
59
|
},
|
|
60
|
-
"packageManager": "npm@10.
|
|
60
|
+
"packageManager": "npm@10.8.2+sha512.c7f0088c520a46596b85c6f8f1da943400199748a0f7ea8cb8df75469668dc26f6fb3ba26df87e2884a5ebe91557292d0f3db7d0929cdb4f14910c3032ac81fb",
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/register": "7.
|
|
63
|
-
"@cucumber/cucumber": "9.
|
|
64
|
-
"@form8ion/babel-preset": "1.6.
|
|
62
|
+
"@babel/register": "7.24.6",
|
|
63
|
+
"@cucumber/cucumber": "10.9.0",
|
|
64
|
+
"@form8ion/babel-preset": "1.6.135",
|
|
65
65
|
"@form8ion/commitlint-config": "1.0.76",
|
|
66
66
|
"@form8ion/eslint-config": "7.0.9",
|
|
67
67
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
68
|
-
"@form8ion/eslint-config-mocha": "3.0.
|
|
69
|
-
"@form8ion/remark-lint-preset": "6.0.
|
|
68
|
+
"@form8ion/eslint-config-mocha": "3.0.6",
|
|
69
|
+
"@form8ion/remark-lint-preset": "6.0.4",
|
|
70
70
|
"@rollup/plugin-babel": "6.0.4",
|
|
71
|
-
"@travi/any": "3.1.
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"c8": "9.1.0",
|
|
75
|
-
"chai": "4.4.1",
|
|
71
|
+
"@travi/any": "3.1.2",
|
|
72
|
+
"ban-sensitive-files": "1.10.5",
|
|
73
|
+
"c8": "10.1.2",
|
|
76
74
|
"cross-env": "7.0.3",
|
|
77
75
|
"cz-conventional-changelog": "3.3.0",
|
|
78
76
|
"gherkin-lint": "4.2.4",
|
|
79
|
-
"husky": "9.
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
77
|
+
"husky": "9.1.5",
|
|
78
|
+
"jest-when": "3.6.0",
|
|
79
|
+
"lockfile-lint": "4.14.0",
|
|
80
|
+
"ls-engines": "0.9.3",
|
|
83
81
|
"mock-fs": "5.2.0",
|
|
84
|
-
"npm-run-all2": "6.
|
|
85
|
-
"publint": "0.2.
|
|
86
|
-
"remark-cli": "12.0.
|
|
82
|
+
"npm-run-all2": "6.2.2",
|
|
83
|
+
"publint": "0.2.10",
|
|
84
|
+
"remark-cli": "12.0.1",
|
|
87
85
|
"remark-toc": "9.0.0",
|
|
88
86
|
"remark-usage": "11.0.1",
|
|
89
|
-
"rimraf": "
|
|
90
|
-
"rollup": "4.
|
|
87
|
+
"rimraf": "6.0.1",
|
|
88
|
+
"rollup": "4.21.0",
|
|
91
89
|
"rollup-plugin-auto-external": "2.0.0",
|
|
92
|
-
"
|
|
90
|
+
"vitest": "2.0.5"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@form8ion/core": "^4.7.1"
|
|
93
94
|
}
|
|
94
95
|
}
|