Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getPublishCommandInStr({
isYarn,
tag,
monorepo,
publishCommand,
dir,
}) {
if (monorepo) {
const { packagesToPublish } = monorepo;
const packageList = expandPackageList(packagesToPublish, dir);
return packageList
.map(
packageDir =>
`- ${packageDir} -> ${getPublishCommand({
isYarn,
publishCommand,
tag,
dir: packageDir,
})}`
)
.join('\n');
} else {
return getPublishCommand({ isYarn, publishCommand, tag, dir });
}
}
runStep({ title: 'Publishing.' }, () => {
const { publishCommand, monorepo } = config;
if (monorepo) {
const { packagesToPublish } = monorepo;
const packageList = expandPackageList(packagesToPublish, dir);
packageList.forEach(packageDir => {
const command = getPublishCommand({
isYarn,
publishCommand,
tag,
dir: packageDir,
});
print(`Running the following at ${info(packageDir)}`);
run({ command, dir: packageDir, dryRun });
});
} else {
const command = getPublishCommand({ isYarn, publishCommand, tag, dir });
run({ command, dir, dryRun });
}
});
async () => {
const {
versionUpdated,
monorepo: { mainVersionFile, packagesToBump },
} = config;
const packageList = expandPackageList(packagesToBump, dir);
if (dryRun) {
print(`Your configuration: ${JSON.stringify(packagesToBump)}`);
print(`Main version file: ${mainVersionFile}`);
print(`Actual packages to bump:`);
packageList.forEach(packageDir =>
print(`-> ${info(`${packageDir}/package.json`)}`)
);
if (versionUpdated) {
print(`-> execute ${info('versionUpdated()')} callback.`);
}
return;
}
updateVersion({ nextVersion, dir, fileName: mainVersionFile });
packageList.forEach(packageDir => {
print(`-> ${info(`${packageDir}/package.json`)}`);