From ccc87991c7ecf50b362d2398140d080af95fafda Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 4 Mar 2020 18:29:40 +0300 Subject: [PATCH] chore: update preview-publish.ps1 --- npm/ng-packs/scripts/publish.ts | 20 +++++++++++--------- npm/preview-publish.ps1 | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/npm/ng-packs/scripts/publish.ts b/npm/ng-packs/scripts/publish.ts index 3a8197522f..5570602813 100644 --- a/npm/ng-packs/scripts/publish.ts +++ b/npm/ng-packs/scripts/publish.ts @@ -19,6 +19,8 @@ const publish = async () => { process.exit(1); } + const registry = program.preview ? 'http://localhost:4873' : 'https://registry.npmjs.org'; + try { await execa('yarn', ['install-new-dependencies'], { stdout: 'inherit' }); @@ -44,9 +46,7 @@ const publish = async () => { 'lerna', 'exec', '--', - `"npm publish --registry https://registry.npmjs.org${ - program.preview ? ' --tag preview' : '' - }"`, + `"npm publish --registry ${registry}${program.preview ? ' --tag preview' : ''}"`, ], { stdout: 'inherit', @@ -56,12 +56,14 @@ const publish = async () => { await fse.rename('../lerna.json', '../lerna.publish.json'); - await execa('git', ['add', '../packages/*', '../package.json', '../lerna.version.json'], { - stdout: 'inherit', - }); - await execa('git', ['commit', '-m', 'Upgrade ng package versions', '--no-verify'], { - stdout: 'inherit', - }); + if (!program.preview) { + await execa('git', ['add', '../packages/*', '../package.json', '../lerna.version.json'], { + stdout: 'inherit', + }); + await execa('git', ['commit', '-m', 'Upgrade ng package versions', '--no-verify'], { + stdout: 'inherit', + }); + } } catch (error) { console.error(error.stderr); process.exit(1); diff --git a/npm/preview-publish.ps1 b/npm/preview-publish.ps1 index d448378750..5ca3336c85 100644 --- a/npm/preview-publish.ps1 +++ b/npm/preview-publish.ps1 @@ -4,7 +4,7 @@ param( npm install -$NextVersion = $(node get-version.js) + '-preview' + (Get-Date).tostring(“yyyyMMdd”) + '-1' +$NextVersion = $(node get-version.js) + '-preview' + (Get-Date).tostring(“yyyyMMdd”) $rootFolder = (Get-Item -Path "./" -Verbose).FullName if(-Not $Version) { @@ -16,7 +16,7 @@ $commands = ( "npm install", "npm run publish-packages -- --nextVersion $Version --preview", "cd ../../", - "yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish --dist-tag preview" + "yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish --dist-tag preview --registry http://localhost:4873" ) foreach ($command in $commands) {