mirror of
https://github.com/runofthemillgeek/swarnam-obsidian.git
synced 2024-11-16 07:20:16 +00:00
Use ESBuild API instead of passing command line arguments (#16)
This commit is contained in:
parent
e013825c21
commit
02ac033b15
27
esbuild.config.mjs
Normal file
27
esbuild.config.mjs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import esbuild from "esbuild";
|
||||||
|
import process from "process";
|
||||||
|
|
||||||
|
const banner =
|
||||||
|
`/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source visit the plugins github repository
|
||||||
|
*/
|
||||||
|
`;
|
||||||
|
|
||||||
|
const prod = (process.argv[2] === 'production');
|
||||||
|
|
||||||
|
esbuild.build({
|
||||||
|
banner: {
|
||||||
|
js: banner,
|
||||||
|
},
|
||||||
|
entryPoints: ['main.ts'],
|
||||||
|
bundle: true,
|
||||||
|
external: ['obsidian'],
|
||||||
|
format: 'cjs',
|
||||||
|
watch: !prod,
|
||||||
|
target: 'es2016',
|
||||||
|
logLevel: "info",
|
||||||
|
sourcemap: prod ? false : 'inline',
|
||||||
|
treeShaking: true,
|
||||||
|
outfile: 'main.js',
|
||||||
|
}).catch(() => process.exit(1));
|
36
package.json
36
package.json
@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-sample-plugin",
|
"name": "obsidian-sample-plugin",
|
||||||
"version": "0.12.0",
|
"version": "0.12.0",
|
||||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "esbuild main.ts --bundle --external:obsidian --outdir=. --target=es2016 --format=cjs --sourcemap=inline --watch",
|
"dev": "node esbuild.config.mjs",
|
||||||
"build": "esbuild main.ts --bundle --external:obsidian --outdir=. --target=es2016 --format=cjs"
|
"build": "node esbuild.config.mjs production"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.1",
|
"@types/node": "^16.11.1",
|
||||||
"esbuild": "0.13.8",
|
"esbuild": "0.13.8",
|
||||||
"obsidian": "^0.12.17",
|
"obsidian": "^0.12.17",
|
||||||
"tslib": "2.3.1",
|
"tslib": "2.3.1",
|
||||||
"typescript": "4.4.4"
|
"typescript": "4.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user