You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/build/index.js

25 lines
599 B
JavaScript

const fs = require('fs');
const root = require('./root');
5 years ago
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);
});
}