From 0d85e2e302fd4ed245981389757a8ac05d743d22 Mon Sep 17 00:00:00 2001 From: corsacca Date: Wed, 29 Apr 2026 15:20:22 +0100 Subject: [PATCH] layers in .layers --- .gitignore | 3 +++ nuxt.config.ts | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b82b0f99..2c5d21bf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ .cache dist +# Extended layers (downloaded by c12/giget) +.layers + # Node dependencies node_modules diff --git a/nuxt.config.ts b/nuxt.config.ts index ba23945e..69740752 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,11 +1,38 @@ // https://nuxt.com/docs/api/configuration/nuxt-config +import { existsSync, readdirSync, rmSync } from 'node:fs' +import { join } from 'node:path' import { generateI18nLocales } from './config/languages' +const LAYERS_DIR = '.layers' + +// Strip layer-level tsconfig.json files. Layers extracted from full Nuxt +// projects often ship a tsconfig.json that references ./.nuxt/tsconfig.*.json +// (only generated when the layer is opened as its own project). When the layer +// lives under node_modules, Vite's tsconfig walker skips it. When it lives at +// .layers/, Vite picks it up and crashes on the missing references. +function stripLayerTsconfigs() { + if (!existsSync(LAYERS_DIR)) return + for (const name of readdirSync(LAYERS_DIR)) { + const tsconfig = join(LAYERS_DIR, name, 'tsconfig.json') + if (existsSync(tsconfig)) rmSync(tsconfig) + } +} + +stripLayerTsconfigs() + export default defineNuxtConfig({ extends: [ - process.env.OAUTH_LAYER_PATH, - process.env.MCP_LAYER_PATH - ].filter(Boolean) as string[], + process.env.OAUTH_LAYER_PATH || ['github:corsacca/nuxt-blueprints/layers/oauth#master', { + giget: { dir: `${LAYERS_DIR}/oauth`, forceClean: true } + }], + process.env.MCP_LAYER_PATH || ['github:corsacca/nuxt-blueprints/layers/mcp#master', { + giget: { dir: `${LAYERS_DIR}/mcp`, forceClean: true } + }] + ], + + hooks: { + 'modules:before': stripLayerTsconfigs + }, modules: [ './modules/migrations',