UNPKG

@nx/nuxt

Version:

The Nuxt plugin for Nx contains executors and generators for managing Nuxt applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Vitest, Playwright, Cypress, and Storybook. - Generators for applications, l

72 lines (71 loc) 2.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createTsConfig = createTsConfig; const devkit_1 = require("@nx/devkit"); const shared = require("@nx/js/src/utils/typescript/create-ts-config"); function createTsConfig(host, options, relativePathToRootTsConfig) { createAppTsConfig(host, options); const json = { files: [], include: options.isUsingTsSolutionConfig ? undefined : ['.nuxt/nuxt.d.ts'], references: [ { path: './tsconfig.app.json', }, ], }; if (options.unitTestRunner !== 'none') { json.references.push({ path: './tsconfig.spec.json', }); } // inline tsconfig.base.json into the project if (options.rootProject) { json.compileOnSave = false; json.compilerOptions = { ...shared.tsConfigBaseOptions, ...json.compilerOptions, }; json.exclude = ['node_modules', 'tmp']; } else { json.extends = './.nuxt/tsconfig.json'; } (0, devkit_1.writeJson)(host, `${options.projectRoot}/tsconfig.json`, json); } function createAppTsConfig(host, options) { const sourceDir = options.useAppDir ? 'app' : 'src'; // Build include array const include = ['.nuxt/nuxt.d.ts', `${sourceDir}/**/*`]; if (options.useAppDir) { include.push('server/**/*'); } // Build exclude array with test patterns // Order: extension-grouped (ts, tsx, js, jsx) with test/spec interleaved const testExcludes = ['ts', 'tsx', 'js', 'jsx'].flatMap((ext) => ['test', 'spec'].map((type) => `${sourceDir}/**/*.${type}.${ext}`)); if (options.useAppDir) { testExcludes.push(...['ts', 'tsx', 'js', 'jsx'].flatMap((ext) => ['test', 'spec'].map((type) => `server/**/*.${type}.${ext}`))); } const exclude = [ 'out-tsc', 'dist', 'vite.config.ts', 'vite.config.mts', 'vitest.config.ts', 'vitest.config.mts', ...testExcludes, 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs', ]; const json = { extends: './tsconfig.json', compilerOptions: { composite: true, rootDir: sourceDir, }, include, exclude, }; (0, devkit_1.writeJson)(host, `${options.projectRoot}/tsconfig.app.json`, json); }