Browse Source

ci: improve the gulp&update script

resolves #4577
related https://github.com/volosoft/volo/issues/2738
pull/4758/head
mehmet-erim 6 years ago
parent
commit
f2683f6f12
  1. 24
      npm/abp-package-update-script.js
  2. 20
      npm/ng-packs/package.json
  3. 2
      npm/ng-packs/packages/core/package.json
  4. 4
      npm/package.json
  5. 2
      npm/packs/core/package.json
  6. 10
      npm/publish.ps1
  7. 26
      npm/run-gulp-script.js
  8. 50
      npm/update-gulp.js

24
npm/abp-package-update-script.js

@ -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));
});
});

20
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",

2
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",

4
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": {

2
npm/packs/core/package.json

@ -5,7 +5,7 @@
"access": "public"
},
"dependencies": {
"@abp/utils": "~2.9.0"
"@abp/utils": "~3.0.3"
},
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431"
}

10
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) {

26
npm/run-gulp-script.js

@ -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', ''));
});
});

50
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();
});
Loading…
Cancel
Save