@@ -11,8 +11,6 @@ if you want to view the source, please visit the github repository of this plugi
1111` ;
1212
1313const prod = process . argv [ 2 ] === "production" ;
14- const devVaultPath =
15- "/home/lonoxx/Nextcloud/Obsidian/.obsidian/plugins/github-issues/" ;
1614
1715// Function to copy files to dist folder
1816function copyToDist ( files ) {
@@ -33,33 +31,6 @@ function copyToDist(files) {
3331 } ) ;
3432}
3533
36- // Function to copy files from dist to dev vault
37- function copyToDevVault ( ) {
38- if ( ! fs . existsSync ( devVaultPath ) ) {
39- fs . mkdirSync ( devVaultPath , { recursive : true } ) ;
40- }
41-
42- const distFiles = [
43- "dist/main.js" ,
44- "manifest.json" ,
45- "styles.css" ,
46- "versions.json" ,
47- ] ;
48-
49- distFiles . forEach ( ( file ) => {
50- if ( fs . existsSync ( file ) ) {
51- const fileName = path . basename ( file ) ;
52- const destPath = path . join ( devVaultPath , fileName ) ;
53- fs . copyFileSync ( file , destPath ) ;
54- console . log ( `Copied ${ file } to ${ destPath } ` ) ;
55- } else {
56- console . warn (
57- `Warning: ${ file } not found, skipping copy to dev vault` ,
58- ) ;
59- }
60- } ) ;
61- }
62-
6334const context = await esbuild . context ( {
6435 banner : {
6536 js : banner ,
@@ -89,36 +60,11 @@ const context = await esbuild.context({
8960 treeShaking : true ,
9061 outfile : "dist/main.js" ,
9162 minify : prod ,
92- plugins : prod
93- ? [ ]
94- : [
95- {
96- name : "copy-to-dev-vault" ,
97- setup ( build ) {
98- build . onEnd ( ( result ) => {
99- if ( result . errors . length === 0 ) {
100- console . log ( "Copying to dev vault..." ) ;
101- const mainJsPath = path . join (
102- devVaultPath ,
103- "main.js" ,
104- ) ;
105- if ( fs . existsSync ( "dist/main.js" ) ) {
106- fs . copyFileSync ( "dist/main.js" , mainJsPath ) ;
107- console . log (
108- `Copied dist/main.js → ${ mainJsPath } ` ,
109- ) ;
110- }
111- }
112- } ) ;
113- } ,
114- } ,
115- ] ,
11663} ) ;
11764
11865if ( prod ) {
11966 await context . rebuild ( ) ;
12067 copyToDist ( [ "versions.json" , "manifest.json" , "styles.css" ] ) ;
121- copyToDevVault ( ) ;
12268 process . exit ( 0 ) ;
12369} else {
12470 await context . watch ( ) ;
0 commit comments