调整自动构建脚本

This commit is contained in:
aixianling
2022-04-20 11:05:38 +08:00
parent 94f6d25ee9
commit 38361ee0a1

View File

@@ -87,17 +87,20 @@ const init = () => {
const generateMain = project => { const generateMain = project => {
const getApps = new Promise(resolve => { const getApps = new Promise(resolve => {
const appLib = path.join(__dirname, project.toString(), 'apps.import.json') const appLib = path.join(__dirname, project.toString(), 'apps.import.json')
fsExtra.readJson(appLib, (err, data) => { fsExtra.readJson(appLib, (err, data) => {
chalkTag.info(project + '加载业务应用配置...') chalkTag.info(project + '加载业务应用配置...')
let apps = [] let apps = []
if (data) { if (data) {
fsExtra.emptyDirSync(`project/${project}/apps`) fsExtra.emptyDirSync(`project/${project}/apps`)
findApp('src/mods', file => { Promise.all([
apps.push(file) findApp(`src/project/${project}`, f => apps.push(f)),
}).then(() => { findApp('src/mods', file => apps.push(file))
]).then(() => {
Promise.all(Object.keys(data).map(e => { Promise.all(Object.keys(data).map(e => {
let app = [...new Set(apps)].find(s => s.indexOf(e) > -1) let app = [...new Set(apps)].find(s => s.indexOf(e) > -1)
if (app) { if (app) {
log('应用#%s#加载中...', e)
return copyFiles(`project/${project}/apps/${e}`, app) return copyFiles(`project/${project}/apps/${e}`, app)
} }
})).then(() => { })).then(() => {
@@ -105,6 +108,7 @@ const generateMain = project => {
resolve() resolve()
}) })
}) })
} else { } else {
chalkTag.done(project + '业务应用无打包') chalkTag.done(project + '业务应用无打包')
resolve() resolve()