Implement module registry for better seperation

Abierto
#440 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
eslint, typescript

Línea de trabajo

Start by reading the module setup in src/lib/modules/types.ts and src/lib/modules/index.ts, then trace the existing navigation and request handling through nav-items.ts, +layout.svelte, NavigationProgress, +layout.server.ts, and hooks.server.ts. Check how storage and Trino configuration and handleStorageConnection are currently loaded. Done means enabled modules alone initialize and handle their routes, disabled module routes return 404, and the specified unit and E2E cases pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Goal: Every module can be switched on and off independently with a feature flag

  1. Module contract. Add src/lib/modules/types.ts defining a CockpitModule: id, routePrefix, enabled, navigation entry, page title, optional init() and optional server handle. The registry lives in src/lib/modules/index.ts and is a static list.
  2. Move storage and Trino onto it.
    • The sidebar (nav-items.ts), page titles (+layout.svelte), NavigationProgress and +layout.server.ts all read from the registry.
    • hooks.server.ts returns 404 for routes of disabled modules and only runs a module's handle on its own routes. handleStorageConnection moves into the storage module.
    • init runs init() only for enabled modules.
  3. Validate config only for enabled modules. The storage and Trino configs are no longer imported unconditionally. They're parsed in their module's init(), so an invalid variable stops the server only when that module is enabled.
  4. New STACKABLE_COCKPIT_TRINO_ENABLED flag
  5. Boundaries. An ESLint rule (import/no-restricted-paths) stops modules importing each other.

Tests

  • Unit tests for the registry and hook logic.
  • E2E: with a module disabled, pages and API return 404, it's missing from the sidebar, and the server starts even with invalid config for it. With it enabled, the existing flows still work.

Result: a new module becomes one module.ts entry plus its own folders. The central files only change for shared concerns.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
0
Merge medio
3 d 12 h
PR fusionados (30 d)
31

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stackabletech/cockpit

Todos los issues de stackabletech/cockpit

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.