Cleanup and progress

This commit is contained in:
Zef Hemel
2022-03-21 15:21:34 +01:00
parent 7e591c6f44
commit a916088215
31 changed files with 707 additions and 143 deletions
+9 -4
View File
@@ -6,9 +6,9 @@ import path from "path";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import {Manifest} from "../types";
import { Manifest } from "../types";
async function compile(filePath : string, functionName : string, debug: boolean) {
async function compile(filePath: string, functionName: string, debug: boolean) {
let outFile = "out.js";
let inFile = filePath;
@@ -47,7 +47,9 @@ export default ${functionName};`
async function bundle(manifestPath: string, sourceMaps: boolean) {
const rootPath = path.dirname(manifestPath);
const manifest = JSON.parse((await readFile(manifestPath)).toString()) as Manifest<any>;
const manifest = JSON.parse(
(await readFile(manifestPath)).toString()
) as Manifest<any>;
for (let [name, def] of Object.entries(manifest.functions)) {
let jsFunctionName = "default",
@@ -69,7 +71,10 @@ async function run() {
.parse();
let generatedManifest = await bundle(args._[0] as string, !!args.debug);
await writeFile(args._[1] as string, JSON.stringify(generatedManifest, null, 2));
await writeFile(
args._[1] as string,
JSON.stringify(generatedManifest, null, 2)
);
}
run().catch((e) => {