update build process (add to Obsidian plugins folder specified in .env)

This commit is contained in:
WFH Brian 2024-05-30 09:33:17 -04:00
parent 96470cf984
commit 6030257c99
3 changed files with 36 additions and 4 deletions

View file

@ -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();
}
// 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"));
}

17
package-lock.json generated
View file

@ -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",

View file

@ -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",