From bfaccee3141e60883c7a660eaf531bbcd6deb080 Mon Sep 17 00:00:00 2001 From: Mehmet Erim Date: Tue, 26 Oct 2021 16:32:47 +0300 Subject: [PATCH] split publish.ps1 into two ps1 scripts --- npm/publish-mvc.ps1 | 47 +++++++++++++++++++++++++++++ npm/{publish.ps1 => publish-ng.ps1} | 5 --- 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 npm/publish-mvc.ps1 rename npm/{publish.ps1 => publish-ng.ps1} (80%) diff --git a/npm/publish-mvc.ps1 b/npm/publish-mvc.ps1 new file mode 100644 index 0000000000..0a27c2fde2 --- /dev/null +++ b/npm/publish-mvc.ps1 @@ -0,0 +1,47 @@ +param( + [string]$Version, + [string]$Registry +) + +yarn install + +$NextVersion = $(node publish-utils.js --nextVersion) +$RootFolder = (Get-Item -Path "./" -Verbose).FullName + +if (-Not $Version) { + $Version = $NextVersion; +} + +if (-Not $Registry) { + $Registry = "https://registry.npmjs.org"; +} + +$PacksPublishCommand = "npm run lerna -- exec 'npm publish --registry $Registry'" + +$IsPrerelase = $(node publish-utils.js --prerelase --customVersion $Version) -eq "true"; + +if ($IsPrerelase) { + $PacksPublishCommand = $PacksPublishCommand.Substring(0, $PacksPublishCommand.Length - 1) + " --tag next'" +} + +$commands = ( + "npm run lerna -- version $Version --yes --no-commit-hooks --skip-git --force-publish", + "npm run replace-with-tilde", + $PacksPublishCommand +) + +foreach ($command in $commands) { + $timer = [System.Diagnostics.Stopwatch]::StartNew() + Write-Host $command + Invoke-Expression $command + if ($LASTEXITCODE -ne '0' -And $command -notlike '*cd *') { + Write-Host ("Process failed! " + $command) + Set-Location $RootFolder + exit $LASTEXITCODE + } + $timer.Stop() + $total = $timer.Elapsed + Write-Output "-------------------------" + Write-Output "$command command took $total (Hours:Minutes:Seconds.Milliseconds)" + Write-Output "-------------------------" +} \ No newline at end of file diff --git a/npm/publish.ps1 b/npm/publish-ng.ps1 similarity index 80% rename from npm/publish.ps1 rename to npm/publish-ng.ps1 index e563fc1fef..0989ed9111 100644 --- a/npm/publish.ps1 +++ b/npm/publish-ng.ps1 @@ -17,7 +17,6 @@ if (-Not $Registry) { } $NgPacksPublishCommand = "npm run publish-packages -- --nextVersion $Version --skipGit --registry $Registry" -$PacksPublishCommand = "npm run lerna -- exec 'npm publish --registry $Registry'" $UpdateGulpCommand = "npm run update-gulp" $UpdateNgPacksCommand = "yarn update --registry $Registry" @@ -25,14 +24,10 @@ $IsPrerelase = $(node publish-utils.js --prerelase --customVersion $Version) -eq if ($IsPrerelase) { $UpdateGulpCommand += " -- --prerelase" - $PacksPublishCommand = $PacksPublishCommand.Substring(0, $PacksPublishCommand.Length - 1) + " --tag next'" $UpdateNgPacksCommand += " --prerelase" } $commands = ( - "npm run lerna -- version $Version --yes --no-commit-hooks --skip-git --force-publish", - "npm run replace-with-tilde", - $PacksPublishCommand, $UpdateNgPacksCommand, "cd ng-packs\scripts", "yarn install",