From 38e9b909107b938a2fa1b6740441ee33cb3efeb1 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 1 Nov 2021 13:16:44 +0300 Subject: [PATCH] add a new option to validate-versions script --- npm/ng-packs/scripts/publish.ts | 4 ++-- npm/publish-mvc.ps1 | 2 +- npm/scripts/validate-versions.ts | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/scripts/publish.ts b/npm/ng-packs/scripts/publish.ts index 7adb6a2a59..e6f50d4726 100644 --- a/npm/ng-packs/scripts/publish.ts +++ b/npm/ng-packs/scripts/publish.ts @@ -41,14 +41,14 @@ program.parse(process.argv); program.nextVersion, '--path', '../ng-packs/packages', + '--excludedPackages', + '@abp/utils', ], { stdout: 'inherit', cwd: '../../scripts' }, ); if (program.preview) await replaceWithPreview(program.nextVersion); - return; - await execa('yarn', ['build', '--noInstall', '--skipNgcc'], { stdout: 'inherit' }); await execa('yarn', ['build:schematics'], { stdout: 'inherit' }); } catch (error) { diff --git a/npm/publish-mvc.ps1 b/npm/publish-mvc.ps1 index bba7b44bb7..eb8362f8ba 100644 --- a/npm/publish-mvc.ps1 +++ b/npm/publish-mvc.ps1 @@ -29,7 +29,7 @@ $commands = ( "yarn replace-with-tilde", "cd scripts", "yarn install", - "yarn validate-versions --compareVersion $Version --path ../packs", + "yarn validate-versions --compareVersion $Version --path ../packs --excludedPackages @abp/utils", "cd ..", $PacksPublishCommand ) diff --git a/npm/scripts/validate-versions.ts b/npm/scripts/validate-versions.ts index 435f480c71..98f636351a 100644 --- a/npm/scripts/validate-versions.ts +++ b/npm/scripts/validate-versions.ts @@ -3,6 +3,8 @@ import fse from 'fs-extra'; import * as path from 'path'; import { log } from './utils/log'; +let excludedPackages = []; + (async () => { initCommander(); await compare(); @@ -14,7 +16,14 @@ function initCommander() { 'version to compare' ); program.requiredOption('-p, --path ', 'NPM packages folder path'); + program.option( + '-ep, --excludedPackages ', + 'Packages that will not be checked. Can be passed with separeted comma (like @abp/utils,@abp/core)', + '' + ); program.parse(process.argv); + + excludedPackages = program.opts().excludedPackages.split(','); } async function compare() { @@ -30,7 +39,10 @@ async function compare() { pkgJson = await fse.readJSON(pkgJsonPath); } catch (error) {} - if (pkgJson.version !== compareVersion) { + if ( + !excludedPackages.includes(pkgJson.name) && + pkgJson.version !== compareVersion + ) { throwError(pkgJsonPath, pkgJson.name); } @@ -53,6 +65,7 @@ async function compareDependencies( const entry = entries[i]; if ( + !excludedPackages.includes(entry[0]) && entry[0].match(/@(abp|volo)/)?.length && entry[1] !== `~${compareVersion}` ) {