mirror of
https://github.com/mossy1022/Smart-Connections-Visualizer.git
synced 2026-07-22 10:20:27 +00:00
add hotreload
This commit is contained in:
parent
05398939be
commit
f31c00d378
1 changed files with 18 additions and 16 deletions
|
|
@ -16,24 +16,26 @@ if you want to view the source, please visit the github repository of this plugi
|
|||
|
||||
const prod = (process.argv[2] === "production");
|
||||
|
||||
// const copy_to_plugins = {
|
||||
// name: 'copy_to_plugins',
|
||||
// setup(build) {
|
||||
// build.onEnd(() => {
|
||||
// const plugin_path = path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view");
|
||||
const copy_to_plugins = {
|
||||
name: 'copy_to_plugins',
|
||||
setup(build) {
|
||||
build.onEnd(() => {
|
||||
const plugin_path = path.join(process.env.OBSIDIAN_PLUGINS_PATH, "smart-connections-graph-view");
|
||||
|
||||
// if (!fs.existsSync(plugin_path)) {
|
||||
// fs.mkdirSync(plugin_path);
|
||||
// }
|
||||
if (!fs.existsSync(plugin_path)) {
|
||||
fs.mkdirSync(plugin_path);
|
||||
}
|
||||
|
||||
// fs.copyFileSync("./main.js", path.join(plugin_path, "main.js"));
|
||||
// fs.copyFileSync("./manifest.json", path.join(plugin_path, "manifest.json"));
|
||||
// fs.copyFileSync("./styles.css", path.join(plugin_path, "styles.css"));
|
||||
fs.copyFileSync("./main.js", path.join(plugin_path, "main.js"));
|
||||
fs.copyFileSync("./manifest.json", path.join(plugin_path, "manifest.json"));
|
||||
fs.copyFileSync("./styles.css", path.join(plugin_path, "styles.css"));
|
||||
// add empty .hotreload file
|
||||
fs.writeFileSync(path.join(plugin_path, ".hotreload"), "");
|
||||
|
||||
// console.log("Plugin built and copied to obsidian plugins folder");
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
console.log("Plugin built and copied to obsidian plugins folder");
|
||||
});
|
||||
}
|
||||
};
|
||||
const context = await esbuild.context({
|
||||
banner: {
|
||||
js: banner,
|
||||
|
|
@ -63,7 +65,7 @@ const context = await esbuild.context({
|
|||
treeShaking: true,
|
||||
outfile: "main.js",
|
||||
plugins: [
|
||||
// copy_to_plugins
|
||||
copy_to_plugins
|
||||
]
|
||||
});
|
||||
if(!prod) await context.watch();
|
||||
|
|
|
|||
Loading…
Reference in a new issue