diff --git a/esbuild.config.mjs b/esbuild.config.mjs index b13282b..e155562 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,6 +1,11 @@ import esbuild from "esbuild"; import process from "process"; import builtins from "builtin-modules"; +import dotenv from "dotenv"; +dotenv.config(); +import fs from "fs"; +import path from "path"; + const banner = `/* @@ -45,4 +50,12 @@ if (prod) { process.exit(0); } else { await context.watch(); -} \ No newline at end of file + // copy the built plugin to the obsidian plugins folder + if (!fs.existsSync(path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view"))) { + fs.mkdirSync(path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view")); + } + fs.copyFileSync("./main.js", path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view/main.js")); + fs.copyFileSync("./manifest.json", path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view/manifest.json")); + fs.copyFileSync("./styles.css", path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view/styles.css")); +} + diff --git a/package-lock.json b/package-lock.json index 7c28976..9ba5037 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "obsidian-sample-plugin", + "name": "smart-connections-graph-view", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "obsidian-sample-plugin", + "name": "smart-connections-graph-view", "version": "1.0.0", "license": "MIT", "dependencies": { @@ -18,6 +18,7 @@ "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", + "dotenv": "^16.4.5", "esbuild": "0.17.3", "obsidian": "latest", "tslib": "2.4.0", @@ -1668,6 +1669,18 @@ "node": ">=6.0.0" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/esbuild": { "version": "0.17.3", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.3.tgz", diff --git a/package.json b/package.json index 2111291..e4ed9a4 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,12 @@ "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", "version": "node version-bump.mjs && git add manifest.json versions.json" }, - "keywords": ["Obsidian", "Smart Connections", "Graph", "View"], + "keywords": [ + "Obsidian", + "Smart Connections", + "Graph", + "View" + ], "author": "Evan Moscoso", "license": "MIT", "devDependencies": { @@ -17,6 +22,7 @@ "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", + "dotenv": "^16.4.5", "esbuild": "0.17.3", "obsidian": "latest", "tslib": "2.4.0",