@@ -13,7 +13,6 @@ export default class Serve extends Base {
1313 private runner ?: ZoteroRunner ;
1414
1515 private _zoteroBinPath ?: string ;
16- private _profilePath ?: string ;
1716
1817 constructor ( ctx : Context ) {
1918 super ( ctx ) ;
@@ -27,23 +26,33 @@ export default class Serve extends Base {
2726 process . on ( "SIGINT" , this . exit ) ;
2827
2928 this . runner = new ZoteroRunner ( {
30- binaryPath : this . zoteroBinPath ,
31- profilePath : this . profilePath ,
32- dataDir : this . dataDir ,
33- plugins : [ {
34- id : this . ctx . id ,
35- sourceDir : join ( this . ctx . dist , "addon" ) ,
36- } ] ,
37- asProxy : this . ctx . server . asProxy ,
38- devtools : this . ctx . server . devtools ,
39- binaryArgs : this . ctx . server . startArgs ,
29+ binary : {
30+ path : this . zoteroBinPath ,
31+ devtools : this . ctx . server . devtools ,
32+ args : this . ctx . server . startArgs ,
33+ } ,
34+ profile : {
35+ path : this . profilePath ,
36+ dataDir : this . dataDir ,
37+ // keepChanges: this.ctx.server.keepProfileChanges,
38+ createIfMissing : this . ctx . server . createProfileIfMissing ,
39+ } ,
40+ plugins : {
41+ list : [ {
42+ id : this . ctx . id ,
43+ sourceDir : join ( this . ctx . dist , "addon" ) ,
44+ } ] ,
45+ asProxy : this . ctx . server . asProxy ,
46+ } ,
4047 } ) ;
4148
4249 await this . ctx . hooks . callHook ( "serve:init" , this . ctx ) ;
4350
4451 // prebuild
45- await this . builder . run ( ) ;
46- await this . ctx . hooks . callHook ( "serve:prebuild" , this . ctx ) ;
52+ if ( this . ctx . server . prebuild ) {
53+ await this . builder . run ( ) ;
54+ await this . ctx . hooks . callHook ( "serve:prebuild" , this . ctx ) ;
55+ }
4756
4857 // start Zotero
4958 await this . runner . run ( ) ;
@@ -133,17 +142,10 @@ export default class Serve extends Base {
133142 }
134143
135144 get profilePath ( ) {
136- if ( this . _profilePath )
137- return this . _profilePath ;
138-
139- this . _profilePath = process . env . ZOTERO_PLUGIN_PROFILE_PATH ;
140- if ( ! this . _profilePath || ! existsSync ( this . _profilePath ) )
141- throw new Error ( "The Zotero profile not found." ) ;
142-
143- return this . _profilePath ;
145+ return process . env . ZOTERO_PLUGIN_PROFILE_PATH ;
144146 }
145147
146148 get dataDir ( ) {
147- return process . env . ZOTERO_PLUGIN_DATA_DIR ?? "" ;
149+ return process . env . ZOTERO_PLUGIN_DATA_DIR ;
148150 }
149151}
0 commit comments