Просмотр исходного кода

refactor(desktop): remove unused plugin classification query

07akioni 3 дней назад
Родитель
Сommit
82293ff45d
2 измененных файлов с 6 добавлено и 7 удалено
  1. 0 5
      apps/desktop/src/project-manager.ts
  2. 6 2
      apps/desktop/tests/project-manager.spec.ts

+ 0 - 5
apps/desktop/src/project-manager.ts

@@ -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
apps/desktop/tests/project-manager.spec.ts

@@ -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)