From f2683f6f12115291a0bda67fee685c99daba7d8b Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 14 Jul 2020 13:21:52 +0300 Subject: [PATCH] ci: improve the gulp&update script resolves #4577 related https://github.com/volosoft/volo/issues/2738 --- npm/abp-package-update-script.js | 24 ------------ npm/ng-packs/package.json | 20 +++++----- npm/ng-packs/packages/core/package.json | 2 +- npm/package.json | 4 +- npm/packs/core/package.json | 2 +- npm/publish.ps1 | 10 ++--- npm/run-gulp-script.js | 26 ------------- npm/update-gulp.js | 50 +++++++++++++++++++++++++ 8 files changed, 67 insertions(+), 71 deletions(-) delete mode 100644 npm/abp-package-update-script.js delete mode 100644 npm/run-gulp-script.js create mode 100644 npm/update-gulp.js diff --git a/npm/abp-package-update-script.js b/npm/abp-package-update-script.js deleted file mode 100644 index 7e06ea01d0..0000000000 --- a/npm/abp-package-update-script.js +++ /dev/null @@ -1,24 +0,0 @@ -const glob = require('glob'); -var path = require('path'); -const childProcess = require('child_process'); - -const check = pkgJsonPath => { - try { - return childProcess.execSync(`ncu "/^@abp.*$/" --packageFile ${pkgJsonPath} -u`).toString(); - } catch (error) { - console.log('exec error: ' + error.message); - process.exit(error.status); - } -}; - -const folder = process.argv[2] || '.'; - -glob(folder + '/**/package.json', {}, (er, files) => { - files.forEach(file => { - if (file.includes('node_modules')) { - return; - } - - console.log(check(file)); - }); -}); diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 6ea5faeeae..a89ca2cbdc 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -23,16 +23,16 @@ "postinstall": "npm run compile:ivy" }, "devDependencies": { - "@abp/ng.account": "~2.9.0", - "@abp/ng.core": "~2.9.0", - "@abp/ng.feature-management": "~2.9.0", - "@abp/ng.identity": "~2.9.0", - "@abp/ng.permission-management": "~2.9.0", - "@abp/ng.setting-management": "~2.9.0", - "@abp/ng.tenant-management": "~2.9.0", - "@abp/ng.theme.basic": "~2.9.0", - "@abp/ng.theme.shared": "~2.9.0", - "@abp/utils": "^3.0.0-alpha.1", + "@abp/ng.account": "~3.0.3", + "@abp/ng.core": "~3.0.3", + "@abp/ng.feature-management": "~3.0.3", + "@abp/ng.identity": "~3.0.3", + "@abp/ng.permission-management": "~3.0.3", + "@abp/ng.setting-management": "~3.0.3", + "@abp/ng.tenant-management": "~3.0.3", + "@abp/ng.theme.basic": "~3.0.3", + "@abp/ng.theme.shared": "~3.0.3", + "@abp/utils": "^3.0.3", "@angular-builders/jest": "^9.0.1", "@angular-devkit/build-angular": "~0.1000.0", "@angular-devkit/build-ng-packagr": "~0.1000.0", diff --git a/npm/ng-packs/packages/core/package.json b/npm/ng-packs/packages/core/package.json index f039923e09..bd725dafd1 100644 --- a/npm/ng-packs/packages/core/package.json +++ b/npm/ng-packs/packages/core/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/utils": "^2.9.0", + "@abp/utils": "^3.0.3", "@angular/localize": "~9.1.11", "@ngxs/router-plugin": "^3.6.2", "@ngxs/storage-plugin": "^3.6.2", diff --git a/npm/package.json b/npm/package.json index 70496aba97..3baede1175 100644 --- a/npm/package.json +++ b/npm/package.json @@ -2,10 +2,8 @@ "version": "2.3.0", "scripts": { "lerna": "lerna", - "gulp:app": "node run-gulp-script.js ../templates/app/aspnet-core", - "gulp:module": "node run-gulp-script.js ../templates/module/aspnet-core", "ncu": "ncu", - "update:templates": "node abp-package-update-script.js ../templates", + "update-gulp": "node update-gulp.js", "replace-with-tilde": "node replace-with-tilde.js" }, "devDependencies": { diff --git a/npm/packs/core/package.json b/npm/packs/core/package.json index ebf850f06d..f7cb7c6500 100644 --- a/npm/packs/core/package.json +++ b/npm/packs/core/package.json @@ -5,7 +5,7 @@ "access": "public" }, "dependencies": { - "@abp/utils": "~2.9.0" + "@abp/utils": "~3.0.3" }, "gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431" } diff --git a/npm/publish.ps1 b/npm/publish.ps1 index aaed04e6d4..d507d00c4d 100644 --- a/npm/publish.ps1 +++ b/npm/publish.ps1 @@ -16,12 +16,10 @@ $commands = ( "npm install", "npm run publish-packages -- --nextVersion $Version", "cd ../../", - "yarn lerna version $Version --yes --no-commit-hooks --skip-git --force-publish", - "yarn replace-with-tilde", - "yarn lerna exec 'npm publish --registry https://registry.npmjs.org'", - "yarn update:templates", - "yarn gulp:app", - "yarn gulp:module" + "npm run lerna -- version $Version --yes --no-commit-hooks --skip-git --force-publish", + "npm run replace-with-tilde", + "npm run lerna -- exec 'npm publish --registry https://registry.npmjs.org'", + "npm run update-gulp" ) foreach ($command in $commands) { diff --git a/npm/run-gulp-script.js b/npm/run-gulp-script.js deleted file mode 100644 index f46eb2b190..0000000000 --- a/npm/run-gulp-script.js +++ /dev/null @@ -1,26 +0,0 @@ -const glob = require('glob'); -const execa = require('execa'); - -const gulp = gulpfilePath => { - try { - console.log('Running the yarn command... Cwd: ' + gulpfilePath); - execa.sync(`yarn`, ['install'], { cwd: gulpfilePath }); - console.log('Running the gulp command...'); - execa.sync(`yarn`, ['gulp'], { cwd: gulpfilePath, stdio: 'inherit' }); - } catch (error) { - console.log('exec error: ' + error.message); - process.exit(error.status); - } -}; - -const folder = process.argv[2] || '.'; - -glob(folder + '/**/gulpfile.js', {}, (er, files) => { - files.forEach(file => { - if (file.includes('node_modules') || file.includes('wwwroot')) { - return; - } - - gulp(file.replace('/gulpfile.js', '')); - }); -}); diff --git a/npm/update-gulp.js b/npm/update-gulp.js new file mode 100644 index 0000000000..698ec85efe --- /dev/null +++ b/npm/update-gulp.js @@ -0,0 +1,50 @@ +const glob = require('glob'); +var path = require('path'); +const childProcess = require('child_process'); +const execa = require('execa'); +const fse = require('fs-extra'); + +const gulp = (folderPath) => { + if ( + !fse.existsSync(folderPath + 'gulpfile.js') || + !glob.sync(folderPath + '*.csproj').length + ) { + return; + } + + try { + execa.sync(`yarn`, ['install'], { cwd: folderPath, stdio: 'inherit' }); + execa.sync(`yarn`, ['gulp'], { cwd: folderPath, stdio: 'inherit' }); + } catch (error) { + console.log('\x1b[31m', 'Error: ' + error.message); + } +}; + +const updatePackages = (pkgJsonPath) => { + try { + const result = childProcess + .execSync(`ncu "/^@abp.*$/" --packageFile ${pkgJsonPath} -u`) + .toString(); + console.log('\x1b[0m', result); + } catch (error) { + console.log('\x1b[31m', 'Error: ' + error.message); + } +}; + +console.time(); +glob('../**/package.json', {}, (er, files) => { + files = files.filter( + (f) => + f && + !f.includes('node_modules') && + !f.includes('wwwroot') && + !f.includes('bin') && + !f.includes('obj') + ); + + files.forEach((file) => { + updatePackages(file); + gulp(file.replace('package.json', '')); + }); + console.timeEnd(); +});