silverbullet/build_plugs.ts

35 lines
925 B
TypeScript
Raw Permalink Normal View History

import { path } from "./lib/deps_server.ts";
import * as esbuild from "esbuild";
import { compileManifests } from "./cmd/compile.ts";
import { builtinPlugNames } from "./plugs/builtin_plugs.ts";
2024-07-30 23:24:17 +08:00
import { parseArgs } from "@std/cli/parse-args";
2023-01-23 01:53:14 +08:00
if (import.meta.main) {
2024-07-30 23:24:17 +08:00
const args = parseArgs(Deno.args, {
2023-01-23 01:53:14 +08:00
boolean: ["debug", "watch", "reload", "info"],
alias: { w: "watch" },
});
const manifests = builtinPlugNames.map((name) =>
`./plugs/${name}/${name}.plug.yaml`
);
2023-01-23 01:53:14 +08:00
const targetDir = path.join("dist_plug_bundle", "_plug");
Deno.mkdirSync(targetDir, { recursive: true });
Deno.mkdirSync("dist", { recursive: true });
2023-01-23 01:53:14 +08:00
// Build the other plugs
await compileManifests(
2023-01-23 01:53:14 +08:00
manifests,
targetDir,
2023-01-23 01:53:14 +08:00
args.watch,
{
debug: args.debug,
reload: args.reload,
info: args.info,
2024-07-30 20:04:43 +08:00
configPath: new URL("deno.json", import.meta.url).pathname,
2023-01-23 01:53:14 +08:00
},
);
esbuild.stop();
}