Cleanup and progress
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user