From f818db3425ca8ed9113bd06e9a2b14463984f331 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 19 Aug 2020 00:12:56 +0300 Subject: [PATCH] ci: add new tag condition to publish.ts --- npm/ng-packs/scripts/publish.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/npm/ng-packs/scripts/publish.ts b/npm/ng-packs/scripts/publish.ts index 1514d229fc..e76af16601 100644 --- a/npm/ng-packs/scripts/publish.ts +++ b/npm/ng-packs/scripts/publish.ts @@ -8,7 +8,9 @@ program '-v, --nextVersion ', 'next semantic version. Available versions: ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease", "or type a custom version"]', ) - .option('-p, --preview', 'publish with preview tag'); + .option('-p, --preview', 'publishes with preview tag') + .option('-r, --rc', 'publishes with next tag') + .option('-g, --skipGit', 'skips git push'); program.parse(process.argv); @@ -55,14 +57,13 @@ const publish = async () => { await fse.rename('../lerna.publish.json', '../lerna.json'); + let tag: string; + if (program.preview) tag = 'preview'; + if (program.rc) tag = 'next'; + await execa( 'yarn', - [ - 'lerna', - 'exec', - '--', - `"npm publish --registry ${registry}${program.preview ? ' --tag preview' : ''}"`, - ], + ['lerna', 'exec', '--', `"npm publish --registry ${registry}${tag ? ` --tag ${tag}` : ''}"`], { stdout: 'inherit', cwd: '../', @@ -71,7 +72,7 @@ const publish = async () => { await fse.rename('../lerna.json', '../lerna.publish.json'); - if (!program.preview) { + if (!program.preview && !program.skipGit) { await execa('git', ['add', '../packages/*', '../package.json', '../lerna.version.json'], { stdout: 'inherit', });