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

21 lines
686 B
JavaScript

/* eslint-disable no-await-in-loop */
const path = require('path');
const fs = require('fs-extra');
const argv = require('yargs-parser')(process.argv.slice(2));
const hack = require('./hack');
async function build(type) {
if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`);
fs.ensureDirSync(path.resolve(__dirname, '..', '.build'));
for (const task in hack) hack[task]();
console.log('Build::Main');
await require('./webpack')(type);
console.log('Build::Resources');
require('./resource')(type);
}
build(argv.development ? 'development' : 'production').catch((e) => {
console.error(e);
process.exit(1);
});