mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化结构
This commit is contained in:
1 parent
75ebc1a746
commit
2554cf660a
34 files changed
+401
-150
No files matched your search
+22
-7
@@ -1,9 +1,24 @@
|
||||
const fs = require('fs');
|
||||
const root = require('./root');
|
||||
try {
|
||||
fs.rmdirSync(root('.build'));
|
||||
} catch (e) { }
|
||||
fs.mkdirSync(root('.build'));
|
||||
require('./locales')();
|
||||
require('./buildModule')();
|
||||
require('./webpack')();
|
||||
|
||||
async function build(type) {
|
||||
if (!['development', 'production'].includes(type)) throw new Error('Unknown type: ' + type);
|
||||
try {
|
||||
fs.rmdirSync(root('.build'));
|
||||
} catch (e) { }
|
||||
fs.mkdirSync(root('.build'));
|
||||
await Promise.all([
|
||||
require('./locales')(type),
|
||||
require('./buildModule')(type),
|
||||
require('./buildTemplate')(type),
|
||||
require('./webpack')(type),
|
||||
]);
|
||||
}
|
||||
|
||||
module.exports = build;
|
||||
|
||||
if (!module.parent) {
|
||||
build('development').catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user