Browse Source

ci: improve update-gulp script to update packages with latest rc version

pull/5134/head
mehmet-erim 6 years ago
parent
commit
44f1e220f9
  1. 12
      npm/publish.ps1
  2. 11
      npm/update-gulp.js

12
npm/publish.ps1

@ -7,18 +7,20 @@ npm install
$NextVersion = $(node publish-utils.js --nextVersion)
$RootFolder = (Get-Item -Path "./" -Verbose).FullName
if(-Not $Version) {
if (-Not $Version) {
$Version = $NextVersion;
}
$NgPacksPublishCommand = "npm run publish-packages -- --nextVersion $Version --skipGit"
$PacksPublishCommand = "npm run lerna -- exec 'npm publish --registry https://registry.npmjs.org'"
$UpdateGulpCommand = "npm run update-gulp"
$IsRc = $(node publish-utils.js --rc) -eq "true";
if($IsRc) {
if ($IsRc) {
$NgPacksPublishCommand += " --rc"
$PacksPublishCommand = $PacksPublishCommand.Substring(0,$PacksPublishCommand.Length-1) + " --tag next'"
$UpdateGulpCommand += " --rc"
$PacksPublishCommand = $PacksPublishCommand.Substring(0, $PacksPublishCommand.Length - 1) + " --tag next'"
}
$commands = (
@ -29,13 +31,13 @@ $commands = (
"npm run lerna -- version $Version --yes --no-commit-hooks --skip-git --force-publish",
"npm run replace-with-tilde",
$PacksPublishCommand,
"npm run update-gulp"
$UpdateGulpCommand
)
foreach ($command in $commands) {
Write-Host $command
Invoke-Expression $command
if($LASTEXITCODE -ne '0' -And $command -notlike '*cd *'){
if ($LASTEXITCODE -ne '0' -And $command -notlike '*cd *') {
Write-Host ("Process failed! " + $command)
Set-Location $RootFolder
exit $LASTEXITCODE

11
npm/update-gulp.js

@ -3,6 +3,11 @@ var path = require('path');
const childProcess = require('child_process');
const execa = require('execa');
const fse = require('fs-extra');
const { program } = require('commander');
program.version('0.0.1');
program.option('-r, --rc', 'whether version is rc');
program.parse(process.argv);
const gulp = (folderPath) => {
if (
@ -23,7 +28,11 @@ const gulp = (folderPath) => {
const updatePackages = (pkgJsonPath) => {
try {
const result = childProcess
.execSync(`ncu "/^@abp.*$/" --packageFile ${pkgJsonPath} -u`)
.execSync(
`ncu "/^@abp.*$/" --packageFile ${pkgJsonPath} -u${
program.rc ? ' --greatest' : ''
}`
)
.toString();
console.log('\x1b[0m', result);
} catch (error) {

Loading…
Cancel
Save