Skip to content

Commit

Permalink
feat: move task everywhere all at once
Browse files Browse the repository at this point in the history
  • Loading branch information
FuriouZz committed Jan 10, 2024
1 parent b740a19 commit 1711395
Show file tree
Hide file tree
Showing 31 changed files with 993 additions and 582 deletions.
76 changes: 44 additions & 32 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import fs from "fs";

const banner =
`/*
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");
const prod = process.argv[2] === "production";

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["src/main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
banner: {
js: banner,
},
entryPoints: ["src/main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
metafile: true,
plugins: [
{
name: "rename",
setup(build) {
build.onEnd((result) => {
fs.renameSync("main.css", "styles.css");
});
},
},
],
});

if (prod) {
await context.rebuild();
process.exit(0);
await context.rebuild();
process.exit(0);
} else {
await context.watch();
await context.watch();
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"files": [
"main.js",
"manifest.json",
"styles.css"
"styles.css",
"main.css"
],
"keywords": [],
"author": "",
Expand All @@ -21,7 +22,7 @@
"@typescript-eslint/eslint-plugin": "6.13.2",
"@typescript-eslint/parser": "6.13.2",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"esbuild": "0.19.11",
"eslint": "^8.55.0",
"obsidian": "latest",
"tslib": "2.4.0",
Expand All @@ -31,6 +32,7 @@
"@codemirror/language": "^6.9.3",
"@codemirror/state": "^6.3.3",
"@codemirror/view": "^6.22.1",
"@popperjs/core": "^2.11.8",
"@preact/signals": "^1.1.3",
"obsidian-calendar-ui": "^0.3.12",
"obsidian-daily-notes-interface": "^0.9.4",
Expand Down
Loading

0 comments on commit 1711395

Please sign in to comment.