core functionality for form8ion plugins that manage github workflows
$ npm install @form8ion/github-workflows-core --save-prod
import {
scaffoldCheckoutStep,
scaffoldNodeSetupStep,
scaffoldDependencyInstallationStep,
scaffoldVerificationStep,
loadWorkflowFile,
writeWorkflowFile,
workflowFileExists,
renameWorkflowFile
} from '@form8ion/github-workflows-core';
const projectRoot = process.cwd();
(async () => {
scaffoldCheckoutStep();
scaffoldNodeSetupStep({versionDeterminedBy: 'nvmrc'});
scaffoldDependencyInstallationStep();
scaffoldVerificationStep();
if (await workflowFileExists({projectRoot, name: 'existing-workflow-name'})) {
await loadWorkflowFile({projectRoot, name: 'existing-workflow-name'});
}
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
await renameWorkflowFile({projectRoot, oldName: 'existing-workflow-name', newName: 'new-workflow-name'});
})();
Scaffolder to define the details for a step to check out the project in a GitHub workflow
Scaffolder to define the details for a step to set up a node.js environment in a GitHub workflow
Takes a single options object as an argument, containing:
Source of node version for use in the configured step. Valid options are nvmrc
or matrix
Scaffolder to define the details for a step to install dependencies in a GitHub workflow
Scaffolder to define the details for a step to execute verification
$ nvm install
$ npm install
$ npm test