Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let scope = '*'
if (Array.isArray(answers.scope)) {
scope = answers.scope.join(',')
}
const message = buildCommit({
...rest,
body: issues + body + testplan,
scope
}, { breaklineChar: '|' })
const cwd = process.cwd()
commitAnalyzer.analyzeCommits({}, { cwd, commits: [{ hash: '', message }], logger: console })
.then((type) => {
/* eslint-disable no-console */
console.info(chalk.green(`\n${getCommitTypeMessage(type)}\n`))
console.info('\n\nCommit message:')
console.info(chalk.blue(`\n\n${message}\n`))
/* eslint-enable no-console */
commit(message)
})
.catch((error) => {
console.error(error)
})
})
.catch((error) => {
if (typeof pluginConfig.isRelevant === "function") {
relevantCommits = commits.filter(commit =>
pluginConfig.isRelevant(params.packages, commit)
);
}
if (!relevantCommits.length) {
logger.log(`No relevant commits were found!`);
return finish();
}
// Store lastRelease for later use
params["lastRelease"] = lastRelease;
params["commits"] = relevantCommits;
const type = await analyzeCommits(
pluginConfig.commitAnalyzer || {},
Object.assign({ logger, commits })
);
if (!type) {
logger.info(`No relevant commits indicate a release!`);
return finish();
}
let version;
if (lastRelease.version) {
version = semver.inc(lastRelease.version, type);
logger.info("The next release version is %s", version);
} else {
version = "1.0.0";
logger.info("There is no previous release, the next release version is %s", version);
}
const commits = await getCommits(lastRelease.gitHead, config.branch, logger);
let relevantCommits = commits;
if (typeof pluginConfig.isRelevant === "function") {
relevantCommits = commits.filter(commit => pluginConfig.isRelevant(pkg, commit));
}
if (!relevantCommits.length) {
logger.log(`No relevant commits were found for package %s`, pkg.name);
logger.log(`======== Finished processing package ========\n\n`);
continue;
}
const type = await analyzeCommits(
pluginConfig.commitAnalyzer || {},
Object.assign({ logger, commits: relevantCommits })
);
// Store relevant commits for later use
packages[i].commits = relevantCommits;
if (!type) {
logger.log(`No relevant commits indicate a release!`);
logger.log(`======== Finished processing package ========\n\n`);
continue;
}
relevantCommits.length &&
logger.log(
`Relevant commits:\n${"*".padStart(8)} ${relevantCommits
const commits = await getCommits(lastRelease.gitHead, config.branch, logger);
const relevantCommits = getRelevantCommits(commits, pkg);
// Store relevant commits for later use
packages[i].commits = relevantCommits;
// Store lastRelease for later use
packages[i]["lastRelease"] = lastRelease;
if (!relevantCommits.length) {
logger.log(`No relevant commits were found for package %s`, pkg.name);
logger.log(`======== Finished processing package ========\n\n`);
continue;
}
const type = await commitAnalyzer(
pluginConfig.analyzeCommits || {},
Object.assign({ logger, commits: relevantCommits })
);
relevantCommits.length &&
logger.log(
`Relevant commits:\n* ${relevantCommits.map(c => c.subject).join("\n* ")}`
);
let version;
if (lastRelease.version) {
version = semver.inc(lastRelease.version, type);
logger.log("The next release version is %s", version);
} else {
version = "1.0.0";
logger.log("There is no previous release, the next release version is %s", version);
}
packages[i]["nextRelease"] = {