diff --git a/packages/nuxt/src/executors/build/build.impl.ts b/packages/nuxt/src/executors/build/build.impl.ts index 5c4ac2d4ed327e..9d2739766149e4 100644 --- a/packages/nuxt/src/executors/build/build.impl.ts +++ b/packages/nuxt/src/executors/build/build.impl.ts @@ -25,7 +25,7 @@ export async function* nuxtBuildExecutor( extends: joinPathFragments( context.root, projectRoot, - 'tsconfig.json' + 'tsconfig.app.json' ), }, }, diff --git a/packages/nuxt/src/executors/serve/schema.d.ts b/packages/nuxt/src/executors/serve/schema.d.ts index 7a79cb22c02150..a27c068fc55a63 100644 --- a/packages/nuxt/src/executors/serve/schema.d.ts +++ b/packages/nuxt/src/executors/serve/schema.d.ts @@ -1,5 +1,4 @@ export interface NuxtServeExecutorOptions { - outputPath: string; debug?: boolean; dev?: boolean; ssr?: boolean; diff --git a/packages/nuxt/src/executors/serve/schema.json b/packages/nuxt/src/executors/serve/schema.json index 428469ffc14c45..bbc525f62805ff 100644 --- a/packages/nuxt/src/executors/serve/schema.json +++ b/packages/nuxt/src/executors/serve/schema.json @@ -33,12 +33,6 @@ "type": "string", "description": "Host to listen on.", "default": "localhost" - }, - "outputPath": { - "type": "string", - "description": "The output path of the generated files.", - "x-completion-type": "directory", - "x-priority": "important" } }, "definitions": {}, diff --git a/packages/nuxt/src/executors/serve/serve.impl.ts b/packages/nuxt/src/executors/serve/serve.impl.ts index 91a312bbc78c71..c03acc403ea4a0 100644 --- a/packages/nuxt/src/executors/serve/serve.impl.ts +++ b/packages/nuxt/src/executors/serve/serve.impl.ts @@ -19,11 +19,6 @@ export async function* nuxtServeExecutor( await runCommand('dev', [projectRoot], { overrides: { workspaceDir: context.root, - buildDir: joinPathFragments( - context.root, - options.outputPath, - '.nuxt' - ), devServer: { host: options.host, port: options.port, @@ -34,7 +29,7 @@ export async function* nuxtServeExecutor( extends: joinPathFragments( context.root, projectRoot, - 'tsconfig.json' + 'tsconfig.app.json' ), }, }, diff --git a/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap index 56d0dea3aa8b2b..18d1abfd7a6b96 100644 --- a/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap @@ -50,13 +50,14 @@ exports[`app generated files content - as-provided should configure tsconfig and "targets": { "serve": { "executor": "@nx/nuxt:serve", + "outputs": ["{options.outputFile}"], "options": { - "outputPath": "dist/my-app", "port": 4200 } }, "build": { "executor": "@nx/nuxt:build", + "outputs": ["{options.outputFile}"], "options": { "outputPath": "dist/my-app" } @@ -87,6 +88,9 @@ exports[`app generated files content - as-provided should configure tsconfig and "files": [], "include": [], "references": [ + { + "path": "./tsconfig.app.json" + }, { "path": "./tsconfig.spec.json" } @@ -115,6 +119,7 @@ exports[`app generated files content - as-provided should create all new files i "my-app/src/public/favicon.ico", "my-app/src/server/api/greet.ts", "my-app/src/server/tsconfig.json", + "my-app/tsconfig.app.json", "my-app/tsconfig.json", ".gitignore", ".eslintrc.json", diff --git a/packages/nuxt/src/generators/application/application.ts b/packages/nuxt/src/generators/application/application.ts index 874caad0eaef7b..a086f36d0786cf 100644 --- a/packages/nuxt/src/generators/application/application.ts +++ b/packages/nuxt/src/generators/application/application.ts @@ -67,7 +67,7 @@ export async function applicationGenerator(tree: Tree, schema: Schema) { getRelativePathToRootTsConfig(tree, options.appProjectRoot) ); - addServeTarget(tree, options.name, outputPath); + addServeTarget(tree, options.name); addBuildTarget(tree, options.name, outputPath); updateGitIgnore(tree); diff --git a/packages/nuxt/src/generators/application/lib/add-targets.ts b/packages/nuxt/src/generators/application/lib/add-targets.ts index 8d1bd227d5e89e..8d25540c2e2bc0 100644 --- a/packages/nuxt/src/generators/application/lib/add-targets.ts +++ b/packages/nuxt/src/generators/application/lib/add-targets.ts @@ -4,16 +4,12 @@ import { updateProjectConfiguration, } from '@nx/devkit'; -export function addServeTarget( - tree: Tree, - projectName: string, - outputPath: string -) { +export function addServeTarget(tree: Tree, projectName: string) { const projectConfig = readProjectConfiguration(tree, projectName); projectConfig.targets['serve'] = { executor: '@nx/nuxt:serve', + outputs: ['{options.outputFile}'], options: { - outputPath: outputPath, port: 4200, }, }; @@ -28,6 +24,7 @@ export function addBuildTarget( const projectConfig = readProjectConfiguration(tree, projectName); projectConfig.targets['build'] = { executor: '@nx/nuxt:build', + outputs: ['{options.outputFile}'], options: { outputPath: outputPath, }, diff --git a/packages/nuxt/src/generators/init/init.ts b/packages/nuxt/src/generators/init/init.ts index 081500907eaf78..f833028c6e7de6 100644 --- a/packages/nuxt/src/generators/init/init.ts +++ b/packages/nuxt/src/generators/init/init.ts @@ -16,14 +16,11 @@ import { sassVersion, vueRouterVersion, vueVersion, + vueTscVersion, } from '@nx/vue'; import { InitSchema } from './schema'; function updateDependencies(host: Tree, schema: InitSchema) { - let dependencies: { [key: string]: string } = { - vue: vueVersion, - }; - let devDependencies: { [key: string]: string } = { '@nx/nuxt': nxVersion, '@nuxt/devtools': nuxtDevtoolsVersion, @@ -31,6 +28,7 @@ function updateDependencies(host: Tree, schema: InitSchema) { h3: h3Version, vue: vueVersion, 'vue-router': vueRouterVersion, + 'vue-tsc': vueTscVersion, }; if (schema.style === 'scss') { diff --git a/packages/nuxt/src/utils/create-ts-config.ts b/packages/nuxt/src/utils/create-ts-config.ts index 8fb2f5c46428da..c8f7d8f8751233 100644 --- a/packages/nuxt/src/utils/create-ts-config.ts +++ b/packages/nuxt/src/utils/create-ts-config.ts @@ -11,11 +11,16 @@ export function createTsConfig( }, relativePathToRootTsConfig: string ) { + createAppTsConfig(host, options); const json = { compilerOptions: {}, files: [], include: [], - references: [], + references: [ + { + path: './tsconfig.app.json', + }, + ], } as any; if (options.unitTestRunner !== 'none') { @@ -38,3 +43,13 @@ export function createTsConfig( writeJson(host, `${options.projectRoot}/tsconfig.json`, json); } + +function createAppTsConfig(host: Tree, options: { projectRoot: string }) { + const json = { + extends: './tsconfig.json', + compilerOptions: {}, + exclude: [], + }; + + writeJson(host, `${options.projectRoot}/tsconfig.app.json`, json); +} diff --git a/packages/nuxt/src/utils/versions.ts b/packages/nuxt/src/utils/versions.ts index 8f2d4cef89599b..149e1741eaef06 100644 --- a/packages/nuxt/src/utils/versions.ts +++ b/packages/nuxt/src/utils/versions.ts @@ -2,9 +2,15 @@ export const nxVersion = require('../../package.json').version; // nuxt deps export const h3Version = '^1.8.2'; -export const nuxtVersion = '3.6.5'; -export const nuxtKitVersion = '3.6.5'; -export const nuxtDevtoolsVersion = '^0.8.0'; +export const nuxtVersion = '^3.8.0'; +export const nuxtDevtoolsVersion = '1.0.0-beta.0'; // linting deps export const nuxtEslintConfigVersion = '0.2.0'; + +// TODO(katerina): nuxi version in package.json +/** + * Latest nuxi has a bug + * + * Nuxi version we use must be 3.6.5 until bug is fixed. + */