Youen Toupin
3121342337
- using a <div> container instead of an <iframe> (simplifies the build system, avoids the quirks iframes) - Bulma CSS is encapsulated in the #simulator ID to avoid polluting the rest of the page, as well as increasing the chances to override the page CSS
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
let child_process = require('child_process');
|
|
let fs = require('fs');
|
|
|
|
let toolsDir = __dirname;
|
|
let srcDir = toolsDir + "/../src";
|
|
let intermediateDir = toolsDir + "/../.intermediate";
|
|
let nodeModulesDir = toolsDir + "/../node_modules";
|
|
|
|
if (!fs.existsSync(intermediateDir)){
|
|
fs.mkdirSync(intermediateDir);
|
|
}
|
|
|
|
if (!fs.existsSync(intermediateDir+'/app')){
|
|
fs.mkdirSync(intermediateDir+'/app');
|
|
}
|
|
|
|
let commands = [
|
|
() => child_process.fork(nodeModulesDir + '/node-sass/bin/node-sass', ['simulator.scss', '../.intermediate/simulator.css'], {'cwd': srcDir}),
|
|
() => child_process.fork(toolsDir + '/purify.js', {'cwd': srcDir}),
|
|
() => child_process.fork(toolsDir + '/embed.js'),
|
|
() => child_process.fork(nodeModulesDir + '/typescript/lib/tsc.js', {'cwd': srcDir})
|
|
];
|
|
|
|
let commandIdx = 0;
|
|
|
|
function executeCommand(commandIdx) {
|
|
console.log("Executing: " + commands[commandIdx].toString().replace(/\(\) => child_process\.fork/g, '').replace(/\(|\)$/g, ''));
|
|
let process = commands[commandIdx]();
|
|
process.on('close', (exitCode) => {
|
|
if(exitCode != 0) throw "Command " + commands[commandIdx] + " failed with code " + exitCode;
|
|
commandIdx += 1;
|
|
if(commandIdx == commands.length)
|
|
{
|
|
console.log("Done.");
|
|
return;
|
|
}
|
|
executeCommand(commandIdx);
|
|
});
|
|
}
|
|
|
|
executeCommand(commandIdx);
|