1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var semver = require('semver');
|
9 | var execa = require('execa');
|
10 | var findVersions = require('find-versions');
|
11 | var pkg = require('../package.json');
|
12 |
|
13 | var MIN_GIT_VERSION = '2.7.1';
|
14 |
|
15 | if (!semver.satisfies(process.version, pkg.engines.node)) {
|
16 | console.error(
|
17 | `[semantic-release]: node version ${pkg.engines.node} is required. Found ${process.version}.
|
18 |
|
19 | See https://github.com/semantic-release/semantic-release/blob/master/docs/support/node-version.md for more details and solutions.`
|
20 | );
|
21 | process.exit(1);
|
22 | }
|
23 |
|
24 | execa('git', ['--version'])
|
25 | .then(({stdout}) => {
|
26 | var gitVersion = findVersions(stdout)[0];
|
27 | if (semver.lt(gitVersion, MIN_GIT_VERSION)) {
|
28 | console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
29 | process.exit(1);
|
30 | }
|
31 | })
|
32 | .catch((error) => {
|
33 | console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. No git binary found.`);
|
34 | console.error(error);
|
35 | process.exit(1);
|
36 | });
|
37 |
|
38 |
|
39 | require('../cli')()
|
40 | .then((exitCode) => {
|
41 | process.exitCode = exitCode;
|
42 | })
|
43 | .catch(() => {
|
44 | process.exitCode = 1;
|
45 | });
|