@form8ion/github-workflows-core 5.3.0 → 5.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 +4 -1
- package/example.js +4 -1
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +9 -1
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,8 @@ import {
|
|
|
56
56
|
scaffoldVerificationStep,
|
|
57
57
|
loadWorkflowFile,
|
|
58
58
|
writeWorkflowFile,
|
|
59
|
-
workflowFileExists
|
|
59
|
+
workflowFileExists,
|
|
60
|
+
renameWorkflowFile
|
|
60
61
|
} from '@form8ion/github-workflows-core';
|
|
61
62
|
```
|
|
62
63
|
|
|
@@ -79,6 +80,8 @@ const projectRoot = process.cwd();
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
|
|
83
|
+
|
|
84
|
+
await renameWorkflowFile({projectRoot, oldName: 'existing-workflow-name', newName: 'new-workflow-name'});
|
|
82
85
|
})();
|
|
83
86
|
```
|
|
84
87
|
|
package/example.js
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
scaffoldVerificationStep,
|
|
9
9
|
loadWorkflowFile,
|
|
10
10
|
writeWorkflowFile,
|
|
11
|
-
workflowFileExists
|
|
11
|
+
workflowFileExists,
|
|
12
|
+
renameWorkflowFile
|
|
12
13
|
} from './lib/index.js';
|
|
13
14
|
|
|
14
15
|
// remark-usage-ignore-next 4
|
|
@@ -35,4 +36,6 @@ const projectRoot = process.cwd();
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
|
|
39
|
+
|
|
40
|
+
await renameWorkflowFile({projectRoot, oldName: 'existing-workflow-name', newName: 'new-workflow-name'});
|
|
38
41
|
})();
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@form8ion/core');
|
|
4
|
+
var node_fs = require('node:fs');
|
|
4
5
|
|
|
5
6
|
function setupNode({versionDeterminedBy}) {
|
|
6
7
|
return {
|
|
@@ -42,7 +43,15 @@ function writer ({projectRoot, name, config}) {
|
|
|
42
43
|
return core.writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: core.fileTypes.YAML});
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
function renamer ({projectRoot, oldName, newName}) {
|
|
47
|
+
return node_fs.promises.rename(
|
|
48
|
+
`${projectRoot}/.github/workflows/${oldName}.yml`,
|
|
49
|
+
`${projectRoot}/.github/workflows/${newName}.yml`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
exports.loadWorkflowFile = loader;
|
|
54
|
+
exports.renameWorkflowFile = renamer;
|
|
46
55
|
exports.scaffoldCheckoutStep = checkout;
|
|
47
56
|
exports.scaffoldDependencyInstallationStep = installDependencies;
|
|
48
57
|
exports.scaffoldNodeSetupStep = setupNode;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/steps/scaffolders.js","../src/workflow-file/existence-checker.js","../src/workflow-file/loader.js","../src/workflow-file/writer.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 {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return fileExists(`${projectRoot}/.github/workflows/${name}.yml`);\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":["fileExists","loadConfigFile","fileTypes","writeConfigFile"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/steps/scaffolders.js","../src/workflow-file/existence-checker.js","../src/workflow-file/loader.js","../src/workflow-file/writer.js","../src/workflow-file/renamer.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 {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return fileExists(`${projectRoot}/.github/workflows/${name}.yml`);\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","import {promises as fs} from 'node:fs';\n\nexport default function ({projectRoot, oldName, newName}) {\n return fs.rename(\n `${projectRoot}/.github/workflows/${oldName}.yml`,\n `${projectRoot}/.github/workflows/${newName}.yml`\n );\n}\n"],"names":["fileExists","loadConfigFile","fileTypes","writeConfigFile","fs"],"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,yBAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE;AAC9C,EAAE,OAAOA,eAAU,CAAC,CAAC,EAAE,WAAW,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE;;ACFe,eAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE;AAC9C,EAAE,OAAOC,mBAAc,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAEC,cAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAClG;;ACFe,eAAQ,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;;ACFe,gBAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;AAC1D,EAAE,OAAOE,gBAAE,CAAC,MAAM;AAClB,IAAI,CAAC,EAAE,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,IAAI,CAAC;AACrD,IAAI,CAAC,EAAE,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,IAAI,CAAC;AACrD,GAAG,CAAC;AACJ;;;;;;;;;;;"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fileExists, loadConfigFile, fileTypes, writeConfigFile } from '@form8ion/core';
|
|
2
|
+
import { promises } from 'node:fs';
|
|
2
3
|
|
|
3
4
|
function setupNode({versionDeterminedBy}) {
|
|
4
5
|
return {
|
|
@@ -40,5 +41,12 @@ function writer ({projectRoot, name, config}) {
|
|
|
40
41
|
return writeConfigFile({path: `${projectRoot}/.github/workflows`, name, config, format: fileTypes.YAML});
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
function renamer ({projectRoot, oldName, newName}) {
|
|
45
|
+
return promises.rename(
|
|
46
|
+
`${projectRoot}/.github/workflows/${oldName}.yml`,
|
|
47
|
+
`${projectRoot}/.github/workflows/${newName}.yml`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { loader as loadWorkflowFile, renamer as renameWorkflowFile, checkout as scaffoldCheckoutStep, installDependencies as scaffoldDependencyInstallationStep, setupNode as scaffoldNodeSetupStep, executeVerification as scaffoldVerificationStep, existenceChecker as workflowFileExists, writer as writeWorkflowFile };
|
|
44
52
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/steps/scaffolders.js","../src/workflow-file/existence-checker.js","../src/workflow-file/loader.js","../src/workflow-file/writer.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 {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return fileExists(`${projectRoot}/.github/workflows/${name}.yml`);\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":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/steps/scaffolders.js","../src/workflow-file/existence-checker.js","../src/workflow-file/loader.js","../src/workflow-file/writer.js","../src/workflow-file/renamer.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 {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot, name}) {\n return fileExists(`${projectRoot}/.github/workflows/${name}.yml`);\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","import {promises as fs} from 'node:fs';\n\nexport default function ({projectRoot, oldName, newName}) {\n return fs.rename(\n `${projectRoot}/.github/workflows/${oldName}.yml`,\n `${projectRoot}/.github/workflows/${newName}.yml`\n );\n}\n"],"names":["fs"],"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,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