refactor(desktop): remove unused plugin classification query

This commit is contained in:
07akioni
2026-09-10 14:07:51 +08:00
parent d55b2b3dad
commit 82293ff45d
2 changed files with 6 additions and 7 deletions
-5
View File
@@ -238,11 +238,6 @@ export class DesktopProjectManager {
return pluginRecords(this.paths.profile)
}
/** @returns Whether the profile enables any third-party bundle, without loading plugin files. */
hasEnabledPlugins(): boolean {
return existsSync(this.paths.profile) && profilePluginNames(this.paths.profile).length > 0
}
/**
* Reinitialize the profile, deleting configuration and third-party packages without a backup.
* @param hooks - Stop the Host before resetting files; restart after preparation succeeds.
+6 -2
View File
@@ -92,9 +92,13 @@ describe('desktop external plugin profile', () => {
const patch = join(manager.paths.profile, 'node_modules/plugin/bundle.yml')
unlinkSync(patch)
await manager.mutate({ type: 'plugins-disable-all' }, hooks({ afterChange: async () => {
expect(manager.hasEnabledPlugins()).toBe(false)
expect((JSON.parse(readFileSync(join(manager.paths.profile, 'package.json'), 'utf8')) as {
dsh: { profile: { bundles: string[] } }
}).dsh.profile.bundles).not.toContain('plugin')
} }))
expect(manager.hasEnabledPlugins()).toBe(false)
expect((JSON.parse(readFileSync(join(manager.paths.profile, 'package.json'), 'utf8')) as {
dsh: { profile: { bundles: string[] } }
}).dsh.profile.bundles).not.toContain('plugin')
expect(existsSync(join(manager.paths.profile, 'node_modules/plugin/package.json'))).toBe(true)
expect(calls(root)).toHaveLength(2)
await expect(manager.applyRelease()).resolves.toBe(false)