From 23dc9fa379f497d06fa7693efff1dadb3bf687c3 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Sat, 18 Jul 2026 23:51:23 -0400 Subject: [PATCH] ADR-013 Phase 4: relocate 4 self-contained plugin frontends Relocate applications, geenforce, knowledgebase, and machines - each owns only its own views dir, so a clean move to plugins//frontend/ (views/ + routes.js, core imports rewritten to @/). geenforce's entryForm.js helper + its vitest spec move with it (ManifestEditor imports it as a sibling). Machinery fixes this batch surfaced: - routes.gen.js codegen uses namespace imports (import * as p_x). A route file without a `toplevel` export is undefined on the namespace instead of a strict- ESM missing-binding build error. - vitest gains a `pretest` stage so plugin-frontend specs (now under plugins//frontend/) run from their staged copy in src/.plugins-staged/. Verified live: GE-Enforce (the most complex, uses the entryForm sibling helper) renders fully from its staged frontend. Build + 58 vitest + naming green. --- frontend/package.json | 1 + frontend/vitest.config.js | 2 ++ .../applications/frontend/routes.js | 8 ++++---- .../frontend/views}/ApplicationDetail.vue | 4 ++-- .../frontend/views}/ApplicationForm.vue | 4 ++-- .../frontend/views}/ApplicationsList.vue | 4 ++-- .../geenforce/frontend/routes.js | 6 +++--- .../frontend/views}/EnforcementReports.vue | 2 +- .../geenforce/frontend/views}/GeEnforceLayout.vue | 0 .../geenforce/frontend/views}/ManifestEditor.vue | 2 +- .../geenforce/frontend/views}/entryForm.js | 0 .../geenforce/frontend/views}/entryForm.spec.js | 0 .../knowledgebase/frontend/routes.js | 8 ++++---- .../frontend/views}/KnowledgeBaseDetail.vue | 2 +- .../frontend/views}/KnowledgeBaseForm.vue | 4 ++-- .../frontend/views}/KnowledgeBaseList.vue | 4 ++-- .../machines/frontend/routes.js | 8 ++++---- .../machines/frontend/views}/MachineDetail.vue | 14 +++++++------- .../machines/frontend/views}/MachineForm.vue | 14 +++++++------- .../machines/frontend/views}/MachinesList.vue | 4 ++-- scripts/stage-frontend.mjs | 10 +++++----- 21 files changed, 52 insertions(+), 49 deletions(-) rename frontend/src/router/routes/applications.js => plugins/applications/frontend/routes.js (54%) rename {frontend/src/views/applications => plugins/applications/frontend/views}/ApplicationDetail.vue (95%) rename {frontend/src/views/applications => plugins/applications/frontend/views}/ApplicationForm.vue (98%) rename {frontend/src/views/applications => plugins/applications/frontend/views}/ApplicationsList.vue (98%) rename frontend/src/router/routes/geenforce.js => plugins/geenforce/frontend/routes.js (78%) rename {frontend/src/views/geenforce => plugins/geenforce/frontend/views}/EnforcementReports.vue (99%) rename {frontend/src/views/geenforce => plugins/geenforce/frontend/views}/GeEnforceLayout.vue (100%) rename {frontend/src/views/geenforce => plugins/geenforce/frontend/views}/ManifestEditor.vue (99%) rename {frontend/src/views/geenforce => plugins/geenforce/frontend/views}/entryForm.js (100%) rename {frontend/src/views/geenforce => plugins/geenforce/frontend/views}/entryForm.spec.js (100%) rename frontend/src/router/routes/knowledgebase.js => plugins/knowledgebase/frontend/routes.js (62%) rename {frontend/src/views/knowledgebase => plugins/knowledgebase/frontend/views}/KnowledgeBaseDetail.vue (94%) rename {frontend/src/views/knowledgebase => plugins/knowledgebase/frontend/views}/KnowledgeBaseForm.vue (97%) rename {frontend/src/views/knowledgebase => plugins/knowledgebase/frontend/views}/KnowledgeBaseList.vue (94%) rename frontend/src/router/routes/machines.js => plugins/machines/frontend/routes.js (62%) rename {frontend/src/views/machines => plugins/machines/frontend/views}/MachineDetail.vue (96%) rename {frontend/src/views/machines => plugins/machines/frontend/views}/MachineForm.vue (98%) rename {frontend/src/views/machines => plugins/machines/frontend/views}/MachinesList.vue (97%) diff --git a/frontend/package.json b/frontend/package.json index b6d303c..49b9aca 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,7 @@ "prebuild": "npm run stage", "build": "vite build", "preview": "vite preview", + "pretest": "npm run stage", "test": "vitest run", "test:watch": "vitest" }, diff --git a/frontend/vitest.config.js b/frontend/vitest.config.js index 0f2577e..f40201a 100644 --- a/frontend/vitest.config.js +++ b/frontend/vitest.config.js @@ -14,6 +14,8 @@ export default defineConfig({ test: { environment: 'jsdom', globals: true, + // Core specs plus plugin-frontend specs, which the pretest stage copies + // into src/.plugins-staged/ (under root, so this glob finds them). include: ['src/**/*.spec.js'], }, }) diff --git a/frontend/src/router/routes/applications.js b/plugins/applications/frontend/routes.js similarity index 54% rename from frontend/src/router/routes/applications.js rename to plugins/applications/frontend/routes.js index 754aacc..9c1ea75 100644 --- a/frontend/src/router/routes/applications.js +++ b/plugins/applications/frontend/routes.js @@ -5,23 +5,23 @@ export default [ { path: 'applications', name: 'applications', - component: () => import('../../views/applications/ApplicationsList.vue') + component: () => import('./views/ApplicationsList.vue') }, { path: 'applications/new', name: 'application-new', - component: () => import('../../views/applications/ApplicationForm.vue'), + component: () => import('./views/ApplicationForm.vue'), meta: { requiresAuth: true } }, { path: 'applications/:id', name: 'application-detail', - component: () => import('../../views/applications/ApplicationDetail.vue') + component: () => import('./views/ApplicationDetail.vue') }, { path: 'applications/:id/edit', name: 'application-edit', - component: () => import('../../views/applications/ApplicationForm.vue'), + component: () => import('./views/ApplicationForm.vue'), meta: { requiresAuth: true } } ] diff --git a/frontend/src/views/applications/ApplicationDetail.vue b/plugins/applications/frontend/views/ApplicationDetail.vue similarity index 95% rename from frontend/src/views/applications/ApplicationDetail.vue rename to plugins/applications/frontend/views/ApplicationDetail.vue index 1f93ab3..f2c6fae 100644 --- a/frontend/src/views/applications/ApplicationDetail.vue +++ b/plugins/applications/frontend/views/ApplicationDetail.vue @@ -156,8 +156,8 @@