@@ -24,7 +24,14 @@ import url from 'url';
24
24
import yargs from 'yargs' ;
25
25
import { hideBin } from 'yargs/helpers' ;
26
26
import i18n from './i18next.config' ;
27
- import { PluginManager } from './plugin-management' ;
27
+ import {
28
+ addToPath ,
29
+ ArtifactHubHeadlampPkg ,
30
+ defaultPluginsDir ,
31
+ getMatchingExtraFiles ,
32
+ getPluginBinDirectories ,
33
+ PluginManager ,
34
+ } from './plugin-management' ;
28
35
import { handleRunCommand } from './runCmd' ;
29
36
import windowSize from './windowSize' ;
30
37
@@ -189,7 +196,6 @@ class PluginManagerEventListeners {
189
196
ipcMain . on ( 'plugin-manager' , async ( event , data ) => {
190
197
const eventData = JSON . parse ( data ) as Action ;
191
198
const { identifier, action } = eventData ;
192
-
193
199
const updateCache = ( progress : ProgressResp ) => {
194
200
const percentage = this . convertProgressToPercentage ( progress ) ;
195
201
this . cache [ identifier ] . progress = progress ;
@@ -248,7 +254,7 @@ class PluginManagerEventListeners {
248
254
controller,
249
255
} ;
250
256
251
- let pluginInfo ;
257
+ let pluginInfo : ArtifactHubHeadlampPkg | undefined = undefined ;
252
258
try {
253
259
pluginInfo = await PluginManager . fetchPluginInfo ( URL , { signal : controller . signal } ) ;
254
260
} catch ( error ) {
@@ -260,14 +266,20 @@ class PluginManagerEventListeners {
260
266
return { type : 'error' , message : 'Failed to fetch plugin info' } ;
261
267
}
262
268
269
+ const { matchingExtraFiles } = getMatchingExtraFiles (
270
+ pluginInfo ?. extraFiles ? pluginInfo ?. extraFiles : { }
271
+ ) ;
272
+ const extraUrls = matchingExtraFiles . map ( file => file . url ) ;
273
+ const allUrls = [ pluginInfo . archiveURL , ...extraUrls ] . join ( ', ' ) ;
274
+
263
275
const dialogOptions : MessageBoxOptions = {
264
276
type : 'question' ,
265
277
buttons : [ i18n . t ( 'Yes' ) , i18n . t ( 'No' ) ] ,
266
278
defaultId : 1 ,
267
279
title : i18n . t ( 'Plugin Installation' ) ,
268
280
message : i18n . t ( 'Do you want to install the plugin "{{ pluginName }}"?' , { pluginName } ) ,
269
281
detail : i18n . t ( 'You are about to install a plugin from: {{ url }}\nDo you want to proceed?' , {
270
- url : pluginInfo . archiveURL ,
282
+ url : allUrls ,
271
283
} ) ,
272
284
} ;
273
285
@@ -529,7 +541,6 @@ async function getShellEnv(): Promise<NodeJS.ProcessEnv> {
529
541
} ;
530
542
531
543
const envVars = isEnvNull ? processLines ( '\0' ) : processLines ( '\n' ) ;
532
-
533
544
const mergedEnv = { ...process . env , ...envVars } ;
534
545
return mergedEnv ;
535
546
} catch ( error ) {
@@ -1324,6 +1335,19 @@ function startElecron() {
1324
1335
attachServerEventHandlers ( serverProcess ) ;
1325
1336
}
1326
1337
1338
+ // Also add bundled plugin bin directories to PATH
1339
+ const bundledPlugins = path . join ( process . resourcesPath , '.plugins' ) ;
1340
+ const bundledPluginBinDirs = getPluginBinDirectories ( bundledPlugins ) ;
1341
+ if ( bundledPluginBinDirs . length > 0 ) {
1342
+ addToPath ( bundledPluginBinDirs , 'bundled plugin' ) ;
1343
+ }
1344
+
1345
+ // Add the installed plugins as well
1346
+ const userPluginBinDirs = getPluginBinDirectories ( defaultPluginsDir ( ) ) ;
1347
+ if ( userPluginBinDirs . length > 0 ) {
1348
+ addToPath ( userPluginBinDirs , 'userPluginBinDirs plugin' ) ;
1349
+ }
1350
+
1327
1351
// Finally load the frontend
1328
1352
mainWindow . loadURL ( startUrl ) ;
1329
1353
}
0 commit comments