49278723b1
- Use Node filesystem APIs instead of shell commands for temp cleanup - Add absolute path helpers for cross-platform compatibility - Generate both main.js and dist/main.js artifacts - Improve error handling in document downloader - Track additional document metadata in sync tracker - Replace Unix-specific `find` with recursive directory traversal The build system now generates two output files (main.js and dist/main.js) for better compatibility with Obsidian's plugin loading. Path handling has been centralized in new utilities to ensure cross-platform behavior, replacing shell commands that had Windows compatibility issues.
25 lines
645 B
JavaScript
25 lines
645 B
JavaScript
import esbuild from "esbuild";
|
|
|
|
const isWatch = process.argv.includes("--watch");
|
|
|
|
const buildOptions = {
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
platform: "node",
|
|
format: "cjs",
|
|
minify: true,
|
|
external: ["obsidian", "child_process"],
|
|
};
|
|
|
|
const outputFiles = ["main.js", "dist/main.js"];
|
|
|
|
if (isWatch) {
|
|
const contexts = await Promise.all(
|
|
outputFiles.map((outfile) => esbuild.context({ ...buildOptions, outfile })),
|
|
);
|
|
await Promise.all(contexts.map((ctx) => ctx.watch()));
|
|
console.log("Watching for changes...");
|
|
} else {
|
|
await Promise.all(outputFiles.map((outfile) => esbuild.build({ ...buildOptions, outfile })));
|
|
}
|