Compare commits

...
3 Commits
3 changed files with 23 additions and 3 deletions
+20 -1
View File
@@ -3,11 +3,15 @@
// Bad news: We have to write plain ES5 in this file
// Good news: It's the only file of the entire project
/* eslint-disable no-var */
/* eslint-disable no-var, promise/prefer-await-to-then, prefer-destructuring */
var semver = require('semver');
var execa = require('execa');
var findVersions = require('find-versions');
var pkg = require('../package.json');
var MIN_GIT_VERSION = '2.0.0';
if (!semver.satisfies(process.version, pkg.engines.node)) {
console.error(
`[semantic-release]: node version ${pkg.engines.node} is required. Found ${process.version}.
@@ -17,6 +21,21 @@ See https://github.com/semantic-release/semantic-release/blob/caribou/docs/suppo
process.exit(1);
}
execa
.stdout('git', ['--version'])
.then(stdout => {
var gitVersion = findVersions(stdout)[0];
if (semver.lt(gitVersion, MIN_GIT_VERSION)) {
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
process.exit(1);
}
})
.catch(err => {
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. No git binary found.`);
console.error(err);
process.exit(1);
});
// Node 8+ from this point on
require('../cli')().catch(() => {
process.exitCode = 1;
+1 -1
View File
@@ -69,7 +69,7 @@ async function gitHead() {
*/
async function repoUrl() {
try {
return await execa.stdout('git', ['remote', 'get-url', 'origin']);
return await execa.stdout('git', ['config', '--get', 'remote.origin.url']);
} catch (err) {
debug(err);
}
+2 -1
View File
@@ -30,6 +30,7 @@
"debug": "^3.1.0",
"env-ci": "^2.0.0",
"execa": "^0.10.0",
"find-versions": "^2.0.0",
"get-stream": "^3.0.0",
"git-log-parser": "^1.2.0",
"git-url-parse": "^9.0.0",
@@ -37,7 +38,7 @@
"hosted-git-info": "^2.6.0",
"lodash": "^4.17.4",
"marked": "^0.4.0",
"marked-terminal": "^2.0.0",
"marked-terminal": "^3.0.0",
"p-locate": "^2.0.0",
"p-reduce": "^1.0.0",
"read-pkg-up": "^3.0.0",