Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions;
// If --conventional-commits and --conventional-graduate are both set, ignore --force-publish
const useConventionalGraduate = conventionalCommits && conventionalGraduate;
const forced = getPackagesForOption(useConventionalGraduate ? conventionalGraduate : forcePublish);
const packages =
filteredPackages.length === packageGraph.size
? packageGraph
: new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)]));
let committish = commandOptions.since;
if (hasTags(execOpts)) {
// describe the last annotated tag in the current branch
const { sha, refCount, lastTagName } = describeRef.sync(execOpts, commandOptions.includeMergedTags);
// TODO: warn about dirty tree?
if (refCount === "0" && forced.size === 0 && !committish) {
// no commits since previous release
log.notice("", "Current HEAD is already released, skipping change detection.");
return [];
}
if (commandOptions.canary) {
// if it's a merge commit, it will return all the commits that were part of the merge
// ex: If `ab7533e` had 2 commits, ab7533e^..ab7533e would contain 2 commits + the merge commit
committish = `${sha}^..${sha}`;
} else if (!committish) {
// if no tags found, this will be undefined and we'll use the initial commit
committish = lastTagName;