- Use async/await instead of callbacks - Use execa to run command line - Use AVA for tests - Add several assertions in the unit tests - Add documentation (comments) in the tests - Run tests with a real git repo instead of mocking child_process and add test helpers to create repos, commits and checkout - Simplify test directory structure - Simplify code readability (mostly with async/await) - Use eslint for for linting, prettier for formatting
27 lines
747 B
JavaScript
Executable File
27 lines
747 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// Bad news: We have to write plain ES5 in this file
|
|
// Good news: It's the only file of the entire project
|
|
|
|
var semver = require('semver');
|
|
|
|
if (semver.lt(process.version, '8.0.0')) {
|
|
console.error(
|
|
`semantic-release: node version >= 8 is required. Found ${process.version}.
|
|
|
|
If there is another job running on node version >= 8, it will be picked as
|
|
the build leader and you can safely ignore this message.
|
|
|
|
If you don't have node 8 in your build matrix you can use "npx" to restore
|
|
compatibility with minimal overhead:
|
|
|
|
$ npx -p node@8 npm run semantic-release
|
|
|
|
npx is bundled with npm >= 5.4, or available via npm. More info: npm.im/npx`
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
// node 8+ from this point on
|
|
require('../src')();
|