Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createClient(type) {
switch (type) {
case "gitlab":
return createGitLabClient();
case "github":
return createGitHubClient();
/* istanbul ignore next: guarded by yargs.choices() */
default:
throw new ValidationError("ERELEASE", "Invalid release client type");
}
}
function createRelease(type, { tags, releaseNotes }, { gitRemote, execOpts }) {
const repo = parseGitRepo(gitRemote, execOpts);
const client = createClient(type);
return Promise.all(
releaseNotes.map(({ notes, name }) => {
const tag = name === "fixed" ? tags[0] : tags.find(t => t.startsWith(`${name}@`));
/* istanbul ignore if */
if (!tag) {
return Promise.resolve();
}
const prereleaseParts = semver.prerelease(tag.replace(`${name}@`, "")) || [];
return client.repos.createRelease({
owner: repo.owner,
repo: repo.name,