Skip to content

Commit ce644a5

Browse files
committed
fix: Significant improvements to the publish feature for code blocks.
1 parent e4aa52f commit ce644a5

File tree

6 files changed

+173
-587
lines changed

6 files changed

+173
-587
lines changed

esbuild.publish.mjs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import esbuild from "esbuild";
2+
import process from "process";
3+
import builtins from "builtin-modules";
4+
import { config } from "dotenv";
5+
import { sassPlugin } from "esbuild-sass-plugin";
6+
7+
config();
8+
9+
const banner = `/*
10+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
11+
if you want to view the source, please visit the github repository of this plugin
12+
*/
13+
`;
14+
15+
const prod = process.argv[2] === "production";
16+
17+
const dir = prod ? "./" : process.env.OUTDIR;
18+
19+
esbuild
20+
.build({
21+
banner: {
22+
js: banner
23+
},
24+
entryPoints: ["src/publish/publish.admonition.ts"],
25+
bundle: true,
26+
external: ["obsidian", "electron"],
27+
format: "cjs",
28+
watch: !prod,
29+
minify: prod,
30+
target: "es2020",
31+
logLevel: "info",
32+
sourcemap: !prod ? "inline" : false,
33+
treeShaking: true,
34+
outfile: "./publish/publish.admonition.txt",
35+
define: {
36+
ADMONITION_ICON_MAP: "ADMONITION_ICON_MAP"
37+
},
38+
tsconfig: "./src/publish/tsconfig.json",
39+
plugins: [sassPlugin()]
40+
})
41+
.catch(() => process.exit(1));

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "node ./esbuild.config.mjs",
88
"build": "node ./esbuild.config.mjs production",
9+
"publish": "node ./esbuild.publish.mjs production",
910
"release": "standard-version"
1011
},
1112
"standard-version": {

publish/publish.admonition.css

Lines changed: 1 addition & 263 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)