obsidian-semantic

Log | Files | Refs | README

commit 02ac033b15fd158638ecc650cdbd0cea6b94d77a
parent e013825c21d83103d296ed3bb27d4fad6e040a3c
Author: Phillip <bronzel.phillip@gmail.com>
Date:   Mon, 25 Oct 2021 17:45:15 +0200

Use ESBuild API instead of passing command line arguments (#16)


Diffstat:
Aesbuild.config.mjs | 27+++++++++++++++++++++++++++
Mpackage.json | 36++++++++++++++++++------------------
2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/esbuild.config.mjs b/esbuild.config.mjs @@ -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)); diff --git a/package.json b/package.json @@ -1,20 +1,20 @@ { - "name": "obsidian-sample-plugin", - "version": "0.12.0", - "description": "This is a sample plugin for Obsidian (https://obsidian.md)", - "main": "main.js", - "scripts": { - "dev": "esbuild main.ts --bundle --external:obsidian --outdir=. --target=es2016 --format=cjs --sourcemap=inline --watch", - "build": "esbuild main.ts --bundle --external:obsidian --outdir=. --target=es2016 --format=cjs" - }, - "keywords": [], - "author": "", - "license": "MIT", - "devDependencies": { - "@types/node": "^16.11.1", - "esbuild": "0.13.8", - "obsidian": "^0.12.17", - "tslib": "2.3.1", - "typescript": "4.4.4" - } + "name": "obsidian-sample-plugin", + "version": "0.12.0", + "description": "This is a sample plugin for Obsidian (https://obsidian.md)", + "main": "main.js", + "scripts": { + "dev": "node esbuild.config.mjs", + "build": "node esbuild.config.mjs production" + }, + "keywords": [], + "author": "", + "license": "MIT", + "devDependencies": { + "@types/node": "^16.11.1", + "esbuild": "0.13.8", + "obsidian": "^0.12.17", + "tslib": "2.3.1", + "typescript": "4.4.4" + } }