Search results open the record they found; plugin scaffolder emits a prunable frontend
This commit is contained in:
@@ -1,35 +1,49 @@
|
||||
/**
|
||||
* ${Name} plugin routes.
|
||||
*
|
||||
* Auto-discovered by the router via import.meta.glob, so no registration
|
||||
* edit is needed. Every route carries meta.plugin '${name}' so the ADR-009
|
||||
* guard redirects to the dashboard when the ${name} backend plugin is
|
||||
* disabled. Form routes add requiresAuth so anonymous users cannot reach
|
||||
* create or edit.
|
||||
* This file lives in the plugin, not in the core frontend tree.
|
||||
* scripts/stage-frontend.mjs copies plugins/${name}/frontend/ into
|
||||
* frontend/src/.plugins-staged/${name}/ and aggregates this default export
|
||||
* into routes.gen.js, which the router spreads in - so no registration edit
|
||||
* is needed, and pruning the plugin for a lean build removes its frontend
|
||||
* with it (ADR-013).
|
||||
*
|
||||
* Every route carries meta.plugin '${name}' so the ADR-009 guard redirects to
|
||||
* the dashboard when the ${name} backend plugin is disabled. Form routes add
|
||||
* requiresAuth so anonymous users cannot reach create or edit.
|
||||
*
|
||||
* View imports are relative (./views/...) because they travel with this file.
|
||||
* Anything from the CORE tree uses the @ alias (@/api, @/components/...),
|
||||
* which resolves the same before and after staging.
|
||||
*/
|
||||
export default [
|
||||
{
|
||||
path: '${name}',
|
||||
name: '${name}',
|
||||
component: () => import('../../views/${name}/${Name}List.vue'),
|
||||
component: () => import('./views/${Name}List.vue'),
|
||||
meta: { plugin: '${name}' }
|
||||
},
|
||||
{
|
||||
path: '${name}/new',
|
||||
name: '${name}-new',
|
||||
component: () => import('../../views/${name}/${Name}Form.vue'),
|
||||
component: () => import('./views/${Name}Form.vue'),
|
||||
meta: { requiresAuth: true, plugin: '${name}' }
|
||||
},
|
||||
{
|
||||
path: '${name}/:id',
|
||||
name: '${name}-detail',
|
||||
component: () => import('../../views/${name}/${Name}Detail.vue'),
|
||||
component: () => import('./views/${Name}Detail.vue'),
|
||||
meta: { plugin: '${name}' }
|
||||
},
|
||||
{
|
||||
path: '${name}/:id/edit',
|
||||
name: '${name}-edit',
|
||||
component: () => import('../../views/${name}/${Name}Form.vue'),
|
||||
component: () => import('./views/${Name}Form.vue'),
|
||||
meta: { requiresAuth: true, plugin: '${name}' }
|
||||
}
|
||||
]
|
||||
|
||||
// Full-screen routes that render OUTSIDE AppLayout (kiosk, print pages).
|
||||
// Declared even when empty so routes.gen.js can read `.toplevel` off the
|
||||
// module without Rollup warning about a missing export.
|
||||
export const toplevel = []
|
||||
|
||||
Reference in New Issue
Block a user