Skip to content

Commit

Permalink
feat: update lerna +yarn workspace to pnpm issue TencentBlueKing#8125
Browse files Browse the repository at this point in the history
  • Loading branch information
lockiechen committed Sep 11, 2024
1 parent b987319 commit c9f28a9
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/frontend/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const argv = yargs.alias({
}).default({
dist: 'frontend',
env: 'master',
lsVersion: 'dev',
lsVersion: 'dev'
}).describe({
dist: 'build output dist directory',
env: 'environment [dev, test, master, external]',
Expand All @@ -28,6 +28,7 @@ const argv = yargs.alias({
base: 'base file path'
}).argv
const { dist, env, lsVersion, scope, head = 'HEAD', base = 'master' } = argv
console.log(env, head, base)
const svgSpriteConfig = {
mode: {
symbol: true
Expand Down Expand Up @@ -86,14 +87,9 @@ task('copy', () => src(['common-lib/**'], { base: '.' }).pipe(dest(`${dist}/`)))
task('build', series(cb => {
const spinner = new Ora('building bk-ci frontend project').start()
const scopeStr = getScopeStr(scope)
const envConfMap = {
dist,
// version: type,
lsVersion
}

const cmd = scopeStr ? `run-many -t public:master ${scopeStr}`: `affected -t public:master`
console.log('gulp cmd: ', cmd, cmd.split(' '));
const cmd = scopeStr ? `run-many -t public:master ${scopeStr}` : 'affected -t public:master'
console.log('gulp cmd: ', cmd, cmd.split(' '))
const { spawn } = require('node:child_process')
const spawnCmd = spawn('pnpm', [
'exec',
Expand All @@ -110,15 +106,14 @@ task('build', series(cb => {
})

spawnCmd.on('close', (code) => {
console.log(`child process exited with code ${code}`);
console.log(`child process exited with code ${code}`)
if (code) {
spinner.fail('Failed building bk-ci frontend project')
process.exit(1)
return;
}
spinner.succeed('Finished building bk-ci frontend project')
cb()
});
})
}, (cb) => {
try {
const fileContent = `window.SERVICE_ASSETS = ${fs.readFileSync(`${dist}/assets_bundle.json`, 'utf8')}`
Expand All @@ -134,7 +129,6 @@ task('build', series(cb => {
}
cb()
}, (cb) => {

['console', 'pipeline'].map(prefix => {
const dir = path.join(dist, prefix)
const spriteNameGlob = `${prefix === 'console' ? 'devops' : 'pipeline'}_sprite-*.js`
Expand All @@ -155,7 +149,7 @@ task('build', series(cb => {
removeComments: true,
minifyJS: true
}))
.pipe(dest(dir))
.pipe(dest(dir))
})
cb()
}))
Expand Down

0 comments on commit c9f28a9

Please sign in to comment.