Release RuneStone 0.1.7 with plugin documents and shared menus
This commit is contained in:
+15
-19
@@ -1,23 +1,19 @@
|
||||
import { build } from "vite";
|
||||
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||
import { copyFile, mkdir } from "node:fs/promises";
|
||||
import { mkdir, cp, access } from "node:fs/promises";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { packagePlugin } from "./packagePlugin.mjs";
|
||||
|
||||
const root = fileURLToPath(new URL("../", import.meta.url));
|
||||
for (const name of ["terminal", "table-formulas"]) {
|
||||
const source = new URL(`../plugins/${name}/`, import.meta.url);
|
||||
const output = new URL(`../plugin-packages/${name}/`, import.meta.url);
|
||||
await build({
|
||||
configFile: false,
|
||||
root,
|
||||
plugins: [svelte({ configFile: false, compilerOptions: { dev: false } })],
|
||||
resolve: { alias: { $lib: fileURLToPath(new URL("../src/lib/", import.meta.url)) }, conditions: ["browser"] },
|
||||
build: {
|
||||
outDir: fileURLToPath(output), emptyOutDir: true,
|
||||
lib: { entry: fileURLToPath(new URL("index.ts", source)), formats: ["es"], fileName: () => "main.js", cssFileName: "style" },
|
||||
rolldownOptions: { output: { codeSplitting: false } },
|
||||
},
|
||||
});
|
||||
await mkdir(output, { recursive: true });
|
||||
await copyFile(new URL("plugin.json", source), new URL("plugin.json", output));
|
||||
const formulasRoot = resolve(process.env.RUNESTONE_TABLE_FORMULAS_ROOT || resolve(root, "../RuneStone_TableFormulas"));
|
||||
const formulasBuild = resolve(formulasRoot, "scripts/build.mjs");
|
||||
try {
|
||||
await access(formulasBuild);
|
||||
} catch {
|
||||
throw new Error("Clone RuneStone_TableFormulas beside RuneStone, or set RUNESTONE_TABLE_FORMULAS_ROOT. Install its dependencies before building plugins.");
|
||||
}
|
||||
execFileSync(process.execPath, [formulasBuild], { cwd: formulasRoot, stdio: "inherit" });
|
||||
const formulasOutput = resolve(root, "plugin-packages/table-formulas");
|
||||
await mkdir(formulasOutput, { recursive: true });
|
||||
await cp(resolve(formulasRoot, "dist/plugin"), formulasOutput, { recursive: true });
|
||||
console.log(await packagePlugin(formulasOutput, resolve(root, "plugin-packages")));
|
||||
|
||||
Reference in New Issue
Block a user