mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-21 11:59:53 +00:00
handle legacy plugins in plugin loader
This commit is contained in:
parent
4569126322
commit
cb06a8e493
@ -125,14 +125,20 @@ export async function findPlugins (): Promise<PluginInfo[]> {
|
|||||||
|
|
||||||
console.log(`Found ${name} in ${pluginDir}`)
|
console.log(`Found ${name} in ${pluginDir}`)
|
||||||
|
|
||||||
if (foundPlugins.some(x => x.name === name)) {
|
const existing = foundPlugins.find(x => x.name === name)
|
||||||
console.info(`Plugin ${packageName} already exists, overriding`)
|
if (existing) {
|
||||||
foundPlugins = foundPlugins.filter(x => x.name !== name)
|
if (existing.isLegacy) {
|
||||||
|
console.info(`Plugin ${packageName} already exists, overriding`)
|
||||||
|
foundPlugins = foundPlugins.filter(x => x.name !== name)
|
||||||
|
} else {
|
||||||
|
console.info(`Plugin ${packageName} already exists, skipping`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const info = JSON.parse(await fs.readFile(infoPath, { encoding: 'utf-8' }))
|
const info = JSON.parse(await fs.readFile(infoPath, { encoding: 'utf-8' }))
|
||||||
if (!info.keywords || !(info.keywords.includes('terminus-plugin') || info.keywords.includes('terminus-builtin-plugin') || !info.keywords.includes('tabby-plugin') || info.keywords.includes('tabby-builtin-plugin'))) {
|
if (!info.keywords || !(info.keywords.includes('terminus-plugin') || info.keywords.includes('terminus-builtin-plugin') || info.keywords.includes('tabby-plugin') || info.keywords.includes('tabby-builtin-plugin'))) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let author = info.author
|
let author = info.author
|
||||||
@ -141,6 +147,7 @@ export async function findPlugins (): Promise<PluginInfo[]> {
|
|||||||
name: name,
|
name: name,
|
||||||
packageName: packageName,
|
packageName: packageName,
|
||||||
isBuiltin: pluginDir === builtinPluginsPath,
|
isBuiltin: pluginDir === builtinPluginsPath,
|
||||||
|
isLegacy: info.keywords.includes('terminus-plugin') || info.keywords.includes('terminus-builtin-plugin'),
|
||||||
version: info.version,
|
version: info.version,
|
||||||
description: info.description,
|
description: info.description,
|
||||||
author,
|
author,
|
||||||
|
@ -5,6 +5,7 @@ export interface PluginInfo {
|
|||||||
description: string
|
description: string
|
||||||
packageName: string
|
packageName: string
|
||||||
isBuiltin: boolean
|
isBuiltin: boolean
|
||||||
|
isLegacy: boolean
|
||||||
version: string
|
version: string
|
||||||
author: string
|
author: string
|
||||||
homepage?: string
|
homepage?: string
|
||||||
|
@ -22,7 +22,8 @@ export class PluginManagerService {
|
|||||||
@Inject(BOOTSTRAP_DATA) bootstrapData: BootstrapData,
|
@Inject(BOOTSTRAP_DATA) bootstrapData: BootstrapData,
|
||||||
) {
|
) {
|
||||||
this.logger = log.create('pluginManager')
|
this.logger = log.create('pluginManager')
|
||||||
this.installedPlugins = bootstrapData.installedPlugins
|
this.installedPlugins = [...bootstrapData.installedPlugins]
|
||||||
|
this.installedPlugins.sort((a, b) => a.name.localeCompare(b.name))
|
||||||
this.userPluginsPath = bootstrapData.userPluginsPath
|
this.userPluginsPath = bootstrapData.userPluginsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user