|
|
|
@ -1,27 +1,27 @@ |
|
|
|
const glob = require('glob'); |
|
|
|
var path = require('path'); |
|
|
|
const childProcess = require('child_process'); |
|
|
|
const execa = require('execa'); |
|
|
|
const fse = require('fs-extra'); |
|
|
|
const { program } = require('commander'); |
|
|
|
const glob = require("glob"); |
|
|
|
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.version("0.0.1"); |
|
|
|
program.option("-pr, --prerelase", "whether version is prerelase"); |
|
|
|
program.parse(process.argv); |
|
|
|
|
|
|
|
const gulp = (folderPath) => { |
|
|
|
if ( |
|
|
|
!fse.existsSync(folderPath + 'gulpfile.js') || |
|
|
|
!glob.sync(folderPath + '*.csproj').length |
|
|
|
!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' }); |
|
|
|
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); |
|
|
|
console.log("\x1b[31m", "Error: " + error.message); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
@ -30,30 +30,30 @@ const updatePackages = (pkgJsonPath) => { |
|
|
|
const result = childProcess |
|
|
|
.execSync( |
|
|
|
`ncu "/^@abp.*$/" --packageFile ${pkgJsonPath} -u${ |
|
|
|
program.rc ? ' --target greatest' : '' |
|
|
|
program.prerelase ? " --target greatest" : "" |
|
|
|
}` |
|
|
|
) |
|
|
|
.toString(); |
|
|
|
console.log('\x1b[0m', result); |
|
|
|
console.log("\x1b[0m", result); |
|
|
|
} catch (error) { |
|
|
|
console.log('\x1b[31m', 'Error: ' + error.message); |
|
|
|
console.log("\x1b[31m", "Error: " + error.message); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
console.time(); |
|
|
|
glob('../**/package.json', {}, (er, files) => { |
|
|
|
glob("../**/package.json", {}, (er, files) => { |
|
|
|
files = files.filter( |
|
|
|
(f) => |
|
|
|
f && |
|
|
|
!f.includes('node_modules') && |
|
|
|
!f.includes('wwwroot') && |
|
|
|
!f.includes('bin') && |
|
|
|
!f.includes('obj') |
|
|
|
!f.includes("node_modules") && |
|
|
|
!f.includes("wwwroot") && |
|
|
|
!f.includes("bin") && |
|
|
|
!f.includes("obj") |
|
|
|
); |
|
|
|
|
|
|
|
files.forEach((file) => { |
|
|
|
updatePackages(file); |
|
|
|
gulp(file.replace('package.json', '')); |
|
|
|
gulp(file.replace("package.json", "")); |
|
|
|
}); |
|
|
|
console.timeEnd(); |
|
|
|
}); |
|
|
|
|