mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
17 lines
419 B
JavaScript
17 lines
419 B
JavaScript
const fs = require("fs");
|
|
const compiler = require("./wcc");
|
|
|
|
const args = process.argv.slice(1);
|
|
const [type, p] = args;
|
|
const optionsData = fs.readFileSync(p).toString();
|
|
const options = JSON.parse(optionsData);
|
|
|
|
(async () => {
|
|
const result = await compiler[type](options);
|
|
if (typeof result === "string") {
|
|
process.stdout.write(result);
|
|
} else {
|
|
process.stdout.write(JSON.stringify(result));
|
|
}
|
|
})();
|