diff --git a/package.json b/package.json index c199435d4..fbe01bb93 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "clean": "rimraf bundle; lerna exec --stream -- rimraf lib umd", "release:normal": "yarn bootstrap; yarn clean; node scripts/release.js", "release": "yarn release:normal --versionArgs=\"--force-publish=*\" ", - "release:alpha": "yarn release:normal --publishArgs=\"--dist-tag alpha\" ", + "release:alpha": "yarn release --publishArgs=\"--dist-tag alpha\" ", + "release:rc": "yarn release --publishArgs=\"--dist-tag next --preid rc\" ", "sb:start": "SB_INTERNAL=true start-storybook --modern -p 9111 --ci", "sb:build": "build-storybook -c .storybook -o .sb-static --modern", "sb:build:prod": "SB_OPTIMIZE=true yarn sb:build", diff --git a/scripts/release.js b/scripts/release.js index 32e2d5980..b17ee00ee 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -33,6 +33,10 @@ const shellCommand = (command) => { const run = (command) => !dry ? shellCommand(command) : getSuccessResult(); +const getIsPre = (argsStr) => argsStr.includes("dist-tag"); + +const IS_PRE = getIsPre(publishArgs) || getIsPre(versionArgs); + const log = (color, msg) => console.log(color(`${msg} ${dry ? "\t--dry-run--" : ""}`)); @@ -171,6 +175,7 @@ const TASKS = [ name: tag, body: versionLog, draft: false, + prerelease: IS_PRE, }); const success = createRes?.status === 201; @@ -259,13 +264,14 @@ const TASKS = [ * can work with the packages' bumped version */ const release = async () => { - log(chalk.white, `Running release flow with ${TASKS.length} tasks`); + const preRelease = IS_PRE ? "PRE-" : ""; - const results = await asyncReduce(TASKS, [], runTask); + log(chalk.white, `Running ${preRelease}release flow with ${TASKS.length} tasks`); + const results = await asyncReduce(TASKS, [], runTask); const lastCode = getLastCode(results); - log(chalk.white, `Finished release flow with code: ${lastCode}`); + log(chalk.white, `Finished ${preRelease}release flow with code: ${lastCode}`); return process.exit(lastCode); };