Skip to content

Commit

Permalink
Added cli test step
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnixon committed Jul 23, 2021
1 parent f573b6e commit b543da2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]
node-version: [15.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --ignore-scripts
Expand All @@ -33,7 +33,7 @@ jobs:
- run: npm run lint
- run: npm run type-coverage
- name: validate cli can be invoked
run: ./interactive-cli-seed/interactive-cli-seed/dist/seed-project help
run: dist/seed-project help
# FIXME enable these once you've written your first test
# - run: npm run test
# - run: npm run codecov
Expand Down
18 changes: 7 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import del from 'rollup-plugin-delete';
import cleanup from 'rollup-plugin-cleanup';

const cliConfig = require('./config/cliConfig.json');
const typeScriptFileMatch = new RegExp(/^[A-z0-9/-]+\.ts$/);

/**
* Deep searches for files within a directory
Expand Down Expand Up @@ -39,7 +40,9 @@ const deepDirectorySearch = (fileExtension, localDirectory) => {
],
[]
)
.filter((value) => value.endsWith('.ts'));
.filter((value) => {
return typeScriptFileMatch.test(value);
});
};

/**
Expand All @@ -61,7 +64,7 @@ const plugins = [
const scriptConfiguration = (filePath) => ({
input: filePath,
output: {
file: `dist${filePath.replace('src', '').replace('.ts', '.js')}`,
file: `dist${filePath.replace('src', '').replace(/\.ts$/, '.js')}`,
format: 'cjs',
exports: 'auto',
},
Expand All @@ -78,16 +81,9 @@ export default [
},
plugins: [
...plugins,
((rollupPlugin) => ({
...rollupPlugin,
// Moving to a later lifecycle hook as generateBundle has not written
// the file disk yet. Removing execution from generateBundle hook and
// moved it to the writeBundle hook.
writeBundle: rollupPlugin.generateBundle,
generateBundle: undefined,
}))(execute(`chmod +x dist/${cliConfig.name}`)),
execute(`chmod +x dist/${cliConfig.name}`),
!process.env.ROLLUP_WATCH ? del({ targets: 'dist/**/*' }) : undefined,
],
},
...deepDirectorySearch('ts', 'src/scripts/').map(scriptConfiguration),
];
];

0 comments on commit b543da2

Please sign in to comment.