@form8ion/github-workflows-core 1.0.0-alpha.1 → 1.0.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 +46 -2
- package/example.js +13 -2
- package/lib/index.js +27 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +24 -3
- package/lib/index.mjs.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ core functionality for form8ion plugins that manage github workflows
|
|
|
14
14
|
* [Usage](#usage)
|
|
15
15
|
* [Installation](#installation)
|
|
16
16
|
* [Example](#example)
|
|
17
|
+
* [Import](#import)
|
|
18
|
+
* [Execute](#execute)
|
|
17
19
|
* [Contributing](#contributing)
|
|
18
20
|
* [Dependencies](#dependencies)
|
|
19
21
|
* [Verification](#verification)
|
|
@@ -25,6 +27,7 @@ core functionality for form8ion plugins that manage github workflows
|
|
|
25
27
|
[![MIT license][license-badge]][license-link]
|
|
26
28
|
[![npm][npm-badge]][npm-link]
|
|
27
29
|
[![Try @form8ion/github-workflows-core on RunKit][runkit-badge]][runkit-link]
|
|
30
|
+
![node][node-badge]
|
|
28
31
|
|
|
29
32
|
<!--consumer-badges end -->
|
|
30
33
|
|
|
@@ -39,17 +42,56 @@ $ npm install @form8ion/github-workflows-core --save-prod
|
|
|
39
42
|
#### Import
|
|
40
43
|
|
|
41
44
|
```javascript
|
|
42
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
scaffoldCheckoutStep,
|
|
47
|
+
scaffoldNodeSetupStep,
|
|
48
|
+
scaffoldDependencyInstallationStep,
|
|
49
|
+
scaffoldVerificationStep
|
|
50
|
+
} from '@form8ion/github-workflows-core';
|
|
43
51
|
```
|
|
44
52
|
|
|
45
53
|
#### Execute
|
|
46
54
|
|
|
47
55
|
```javascript
|
|
48
56
|
(async () => {
|
|
49
|
-
|
|
57
|
+
scaffoldCheckoutStep();
|
|
58
|
+
|
|
59
|
+
scaffoldNodeSetupStep({versionDeterminedBy: 'nvmrc'});
|
|
60
|
+
|
|
61
|
+
scaffoldDependencyInstallationStep();
|
|
62
|
+
|
|
63
|
+
scaffoldVerificationStep();
|
|
50
64
|
})();
|
|
51
65
|
```
|
|
52
66
|
|
|
67
|
+
### API
|
|
68
|
+
|
|
69
|
+
#### `scaffoldCheckoutStep`
|
|
70
|
+
|
|
71
|
+
Scaffolder to define the details for a step to check out the project in a
|
|
72
|
+
GitHub workflow
|
|
73
|
+
|
|
74
|
+
#### `scaffoldNodeSetupStep`
|
|
75
|
+
|
|
76
|
+
Scaffolder to define the details for a step to set up a node.js environment in
|
|
77
|
+
a GitHub workflow
|
|
78
|
+
|
|
79
|
+
Takes a single options object as an argument, containing:
|
|
80
|
+
|
|
81
|
+
##### `versionDeterminedBy` __string__ (_required_)
|
|
82
|
+
|
|
83
|
+
Source of node version for use in the configured step. Valid options are `nvmrc`
|
|
84
|
+
or `matrix`
|
|
85
|
+
|
|
86
|
+
#### `scaffoldDependencyInstallationStep`
|
|
87
|
+
|
|
88
|
+
Scaffolder to define the details for a step to install dependencies in a GitHub
|
|
89
|
+
workflow
|
|
90
|
+
|
|
91
|
+
#### `scaffoldVerificationStep`
|
|
92
|
+
|
|
93
|
+
Scaffolder to define the details for a step to execute verification
|
|
94
|
+
|
|
53
95
|
## Contributing
|
|
54
96
|
|
|
55
97
|
<!--contribution-badges start -->
|
|
@@ -114,3 +156,5 @@ $ npm test
|
|
|
114
156
|
[runkit-link]: https://npm.runkit.com/@form8ion/github-workflows-core
|
|
115
157
|
|
|
116
158
|
[runkit-badge]: https://badge.runkitcdn.com/@form8ion/github-workflows-core.svg
|
|
159
|
+
|
|
160
|
+
[node-badge]: https://img.shields.io/node/v/@form8ion/github-workflows-core?logo=node.js
|
package/example.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// #### Import
|
|
2
2
|
// remark-usage-ignore-next
|
|
3
3
|
import stubbedFs from 'mock-fs';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
scaffoldCheckoutStep,
|
|
6
|
+
scaffoldNodeSetupStep,
|
|
7
|
+
scaffoldDependencyInstallationStep,
|
|
8
|
+
scaffoldVerificationStep
|
|
9
|
+
} from './lib/index.js';
|
|
5
10
|
|
|
6
11
|
// remark-usage-ignore-next
|
|
7
12
|
stubbedFs();
|
|
@@ -9,5 +14,11 @@ stubbedFs();
|
|
|
9
14
|
// #### Execute
|
|
10
15
|
|
|
11
16
|
(async () => {
|
|
12
|
-
|
|
17
|
+
scaffoldCheckoutStep();
|
|
18
|
+
|
|
19
|
+
scaffoldNodeSetupStep({versionDeterminedBy: 'nvmrc'});
|
|
20
|
+
|
|
21
|
+
scaffoldDependencyInstallationStep();
|
|
22
|
+
|
|
23
|
+
scaffoldVerificationStep();
|
|
13
24
|
})();
|
package/lib/index.js
CHANGED
|
@@ -2,9 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function setupNode({versionDeterminedBy}) {
|
|
6
|
+
return {
|
|
7
|
+
name: 'Setup node',
|
|
8
|
+
uses: 'actions/setup-node@v3',
|
|
9
|
+
with: {
|
|
10
|
+
...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},
|
|
11
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
12
|
+
...'matrix' === versionDeterminedBy && {'node-version': '${{ matrix.node }}'},
|
|
13
|
+
cache: 'npm'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
7
16
|
}
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
function executeVerification() {
|
|
19
|
+
return {run: 'npm test'};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function installDependencies() {
|
|
23
|
+
return {run: 'npm clean-install'};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function checkout() {
|
|
27
|
+
return {uses: 'actions/checkout@v3'};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.scaffoldCheckoutStep = checkout;
|
|
31
|
+
exports.scaffoldDependencyInstallationStep = installDependencies;
|
|
32
|
+
exports.scaffoldNodeSetupStep = setupNode;
|
|
33
|
+
exports.scaffoldVerificationStep = executeVerification;
|
|
10
34
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/
|
|
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@v3',\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 {run: 'npm clean-install'};\n}\n\nexport function checkout() {\n return {uses: 'actions/checkout@v3'};\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,SAAS,CAAC,CAAC,mBAAmB,CAAC,EAAE;AACjD,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,IAAI,EAAE,uBAAuB;AACjC,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,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;AACpC,CAAC;AACD;AACO,SAAS,QAAQ,GAAG;AAC3B,EAAE,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AACvC;;;;;;;"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function setupNode({versionDeterminedBy}) {
|
|
2
|
+
return {
|
|
3
|
+
name: 'Setup node',
|
|
4
|
+
uses: 'actions/setup-node@v3',
|
|
5
|
+
with: {
|
|
6
|
+
...'nvmrc' === versionDeterminedBy && {'node-version-file': '.nvmrc'},
|
|
7
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
8
|
+
...'matrix' === versionDeterminedBy && {'node-version': '${{ matrix.node }}'},
|
|
9
|
+
cache: 'npm'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
3
12
|
}
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
function executeVerification() {
|
|
15
|
+
return {run: 'npm test'};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function installDependencies() {
|
|
19
|
+
return {run: 'npm clean-install'};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function checkout() {
|
|
23
|
+
return {uses: 'actions/checkout@v3'};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { checkout as scaffoldCheckoutStep, installDependencies as scaffoldDependencyInstallationStep, setupNode as scaffoldNodeSetupStep, executeVerification as scaffoldVerificationStep };
|
|
6
27
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/
|
|
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@v3',\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 {run: 'npm clean-install'};\n}\n\nexport function checkout() {\n return {uses: 'actions/checkout@v3'};\n}\n"],"names":[],"mappings":"AAAO,SAAS,SAAS,CAAC,CAAC,mBAAmB,CAAC,EAAE;AACjD,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,IAAI,EAAE,uBAAuB;AACjC,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,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;AACpC,CAAC;AACD;AACO,SAAS,QAAQ,GAAG;AAC3B,EAAE,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AACvC;;;;"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
"description": "core functionality for form8ion plugins that manage github workflows",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "commonjs",
|
|
6
|
-
"version": "1.0.0
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^14.15 || >=16"
|
|
9
|
+
},
|
|
7
10
|
"files": [
|
|
8
11
|
"example.js",
|
|
9
12
|
"lib/"
|
|
@@ -49,7 +52,8 @@
|
|
|
49
52
|
"pregenerate:md": "run-s build",
|
|
50
53
|
"lint:sensitive": "ban",
|
|
51
54
|
"prepare": "husky install",
|
|
52
|
-
"lint:peer": "npm ls >/dev/null"
|
|
55
|
+
"lint:peer": "npm ls >/dev/null",
|
|
56
|
+
"lint:engines": "ls-engines"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@babel/register": "7.17.7",
|
|
@@ -71,6 +75,7 @@
|
|
|
71
75
|
"gherkin-lint": "4.2.2",
|
|
72
76
|
"husky": "8.0.1",
|
|
73
77
|
"lockfile-lint": "4.7.4",
|
|
78
|
+
"ls-engines": "0.6.6",
|
|
74
79
|
"mocha": "10.0.0",
|
|
75
80
|
"mock-fs": "5.1.2",
|
|
76
81
|
"npm-run-all": "4.1.5",
|