mirror of
https://github.com/zhou-yusen/Moving-Note.git
synced 2026-07-22 07:45:22 +00:00
- 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
62 lines
1.4 KiB
JavaScript
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();
|
|
}
|