123456789101112131415161718192021222324252627282930313233 |
- const util = require('util');
- const child_process = require('child_process');
- const exec = util.promisify(child_process.exec);
- const fs = require('fs-extra')
- const PATH = `./.laser-lib-path`
- const inInit = fs.existsSync(PATH)
- const initLocal = inInit && fs.readFileSync(PATH).toString()
- const buildPaths = [
- `build`,
- ...inInit ? [initLocal] : []
- ]
- const runBuild = async () => {
- console.log('正在进行打包')
- await exec(`yarn build-c`);
- console.log('打包已完成正在发布到git仓库')
- if (initLocal) {
- try {
- await exec(`
- cd ${initLocal}
- git pull
- git add -A
- git commit -m 'fix: 更新sdk'
- git push
- `)
- console.log('发布成功')
- } catch {
- console.error('自动发布失败,请手动上传')
- }
- }
- }
- runBuild()
|