zhou-yusen_Moving-Note/esbuild.config.mjs
Yusen 3afcd068a7 Initial release: Moving Note v1.0.0
- Desktop sync via system Git (pull → commit → push)
- Mobile sync via GitHub API (pull + push)
- i18n support (English / Chinese)
- Auto-sync and sync-on-startup
- Custom commit message template
- Branch management with auto-stash
2026-06-13 18:33:21 +08:00

62 lines
1.4 KiB
JavaScript

import esbuild from "esbuild";
import process from "process";
import fs from "fs";
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
const prod = process.argv[2] === "production";
if (!fs.existsSync("output")) {
fs.mkdirSync("output");
}
const context = await esbuild.context({
banner: { js: banner },
entryPoints: ["main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"moment",
"child_process",
"fs",
"os",
"path",
"node:events",
"node:path",
"node:util",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
],
format: "cjs",
target: "es2018",
platform: "browser",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "output/main.js",
minify: prod,
});
if (prod) {
await context.rebuild();
fs.copyFileSync("manifest.json", "output/manifest.json");
fs.copyFileSync("styles.css", "output/styles.css");
console.log("Build complete! Output in ./output/");
process.exit(0);
} else {
await context.watch();
}