调整自动构建脚本

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