@nx/nuxt 18.0.3 → 18.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nuxt",
3
- "version": "18.0.3",
3
+ "version": "18.0.5",
4
4
  "private": false,
5
5
  "description": "The Nuxt plugin for Nx contains executors and generators for managing Nuxt applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -30,10 +30,11 @@
30
30
  "dependencies": {
31
31
  "tslib": "^2.3.0",
32
32
  "@nuxt/kit": "^3.10.0",
33
- "@nx/devkit": "18.0.3",
34
- "@nx/js": "18.0.3",
35
- "@nx/eslint": "18.0.3",
36
- "@nx/vue": "18.0.3"
33
+ "@nx/devkit": "18.0.5",
34
+ "@nx/js": "18.0.5",
35
+ "@nx/eslint": "18.0.5",
36
+ "@nx/vue": "18.0.5",
37
+ "@nx/vite": "18.0.5"
37
38
  },
38
39
  "peerDependencies": {},
39
40
  "publishConfig": {
@@ -44,8 +44,6 @@ async function applicationGenerator(tree, schema) {
44
44
  tmpl: '',
45
45
  style: options.style,
46
46
  projectRoot: options.appProjectRoot,
47
- buildDirectory: (0, devkit_1.joinPathFragments)(`dist/${options.appProjectRoot}/.nuxt`),
48
- nitroOutputDir: (0, devkit_1.joinPathFragments)(`dist/${options.appProjectRoot}/.output`),
49
47
  hasVitest: options.unitTestRunner === 'vitest',
50
48
  });
51
49
  if (options.style === 'none') {
@@ -5,7 +5,6 @@ import { defineNuxtConfig } from 'nuxt/config';
5
5
  export default defineNuxtConfig({
6
6
  workspaceDir: '<%= offsetFromRoot %>',
7
7
  srcDir: 'src',
8
- buildDir: '<%= offsetFromRoot %><%= buildDirectory %>',
9
8
  devtools: { enabled: true },
10
9
  devServer: {
11
10
  host: 'localhost',
@@ -18,7 +17,7 @@ export default defineNuxtConfig({
18
17
  },
19
18
  },
20
19
  imports: {
21
- autoImport: false,
20
+ autoImport: true,
22
21
  },
23
22
  <% if (style !== 'none') { %>
24
23
  css: ['~/assets/css/styles.<%= style %>'],
@@ -28,9 +27,4 @@ export default defineNuxtConfig({
28
27
  nxViteTsPaths()
29
28
  ],
30
29
  },
31
- nitro: {
32
- output: {
33
- dir: '<%= offsetFromRoot %><%= nitroOutputDir %>',
34
- },
35
- },
36
30
  });
@@ -323,13 +323,13 @@ defineProps<{
323
323
  You can activate distributed tasks executions and caching by
324
324
  running:
325
325
  </p>
326
- <pre>nx connect-to-nx-cloud</pre>
326
+ <pre>nx connect</pre>
327
327
  <a
328
328
  href="https://nx.app/?utm_source=nx-project"
329
329
  target="_blank"
330
330
  rel="noreferrer"
331
331
  >
332
- {' '} What is Nx Cloud?{' '}
332
+ What is Nx Cloud?
333
333
  </a>
334
334
  </div>
335
335
  <a
@@ -7,6 +7,7 @@ function updateDependencies(host, schema) {
7
7
  return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
8
8
  '@nx/nuxt': versions_1.nxVersion,
9
9
  nuxt: versions_1.nuxtVersion,
10
+ '@nx/vite': versions_1.nxVersion,
10
11
  }, undefined, schema.keepExistingVersions);
11
12
  }
12
13
  exports.updateDependencies = updateDependencies;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const executor_utils_1 = require("../../utils/executor-utils");
5
+ const path_1 = require("path");
6
+ async function default_1(tree) {
7
+ const projects = (0, devkit_1.getProjects)(tree);
8
+ for (const project of projects.values()) {
9
+ const nuxtConfigPath = findNuxtConfig(tree, project.root);
10
+ if (!nuxtConfigPath) {
11
+ continue;
12
+ }
13
+ const nuxtConfig = await getInfoFromNuxtConfig(nuxtConfigPath, project.root);
14
+ const buildDir = nuxtConfig.buildDir ?? '.nuxt';
15
+ const tsConfigPath = (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.json');
16
+ if (tree.exists(tsConfigPath)) {
17
+ (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
18
+ if (!json.include) {
19
+ json.include = [];
20
+ }
21
+ if (!json.include.includes(buildDir + '/nuxt.d.ts')) {
22
+ json.include.push(buildDir + '/nuxt.d.ts');
23
+ }
24
+ return json;
25
+ });
26
+ }
27
+ }
28
+ await (0, devkit_1.formatFiles)(tree);
29
+ }
30
+ exports.default = default_1;
31
+ function findNuxtConfig(tree, projectRoot) {
32
+ const allowsExt = ['js', 'mjs', 'ts', 'cjs', 'mts', 'cts'];
33
+ for (const ext of allowsExt) {
34
+ if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, `nuxt.config.${ext}`))) {
35
+ return (0, devkit_1.joinPathFragments)(projectRoot, `nuxt.config.${ext}`);
36
+ }
37
+ }
38
+ }
39
+ async function getInfoFromNuxtConfig(configFilePath, projectRoot) {
40
+ const { loadNuxtConfig } = await (0, executor_utils_1.loadNuxtKitDynamicImport)();
41
+ const config = await loadNuxtConfig({
42
+ cwd: (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot),
43
+ configFile: (0, path_1.basename)(configFilePath),
44
+ });
45
+ return {
46
+ buildDir: config?.buildDir,
47
+ };
48
+ }
@@ -99,12 +99,11 @@ async function getInfoFromNuxtConfig(configFilePath, context, projectRoot) {
99
99
  function getOutputs(nuxtConfig, projectRoot) {
100
100
  let nuxtBuildDir = nuxtConfig?.buildDir;
101
101
  if (nuxtConfig?.buildDir && (0, path_1.basename)(nuxtConfig?.buildDir) === '.nuxt') {
102
- // buildDir will most probably be `../dist/my-app/.nuxt`
103
- // we want the "general" outputPath to be `../dist/my-app`
102
+ // if buildDir exists, it will be `something/something/.nuxt`
103
+ // we want the "general" outputPath to be `something/something`
104
104
  nuxtBuildDir = nuxtConfig.buildDir.replace((0, path_1.basename)(nuxtConfig.buildDir), '');
105
105
  }
106
- const buildOutputPath = normalizeOutputPath(nuxtBuildDir, projectRoot) ??
107
- '{workspaceRoot}/dist/{projectRoot}';
106
+ const buildOutputPath = normalizeOutputPath(nuxtBuildDir, projectRoot);
108
107
  return {
109
108
  buildOutputs: [buildOutputPath],
110
109
  };
@@ -112,10 +111,10 @@ function getOutputs(nuxtConfig, projectRoot) {
112
111
  function normalizeOutputPath(outputPath, projectRoot) {
113
112
  if (!outputPath) {
114
113
  if (projectRoot === '.') {
115
- return `{projectRoot}/dist`;
114
+ return `{projectRoot}`;
116
115
  }
117
116
  else {
118
- return `{workspaceRoot}/dist/{projectRoot}`;
117
+ return `{workspaceRoot}/{projectRoot}`;
119
118
  }
120
119
  }
121
120
  else {
@@ -4,8 +4,8 @@ exports.addLinting = void 0;
4
4
  const eslint_1 = require("@nx/eslint");
5
5
  const path_1 = require("nx/src/utils/path");
6
6
  const devkit_1 = require("@nx/devkit");
7
- const lint_1 = require("./lint");
8
7
  const vue_1 = require("@nx/vue");
8
+ const versions_1 = require("./versions");
9
9
  async function addLinting(host, options) {
10
10
  const tasks = [];
11
11
  if (options.linter === 'eslint') {
@@ -19,10 +19,22 @@ async function addLinting(host, options) {
19
19
  addPlugin: true,
20
20
  });
21
21
  tasks.push(lintTask);
22
- (0, devkit_1.updateJson)(host, (0, path_1.joinPathFragments)(options.projectRoot, '.eslintrc.json'), lint_1.extendNuxtEslintJson);
23
22
  (0, vue_1.editEslintConfigFiles)(host, options.projectRoot, options.rootProject);
24
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, {
25
- ...lint_1.extraEslintDependencies.devDependencies,
23
+ (0, devkit_1.updateJson)(host, (0, path_1.joinPathFragments)(options.projectRoot, '.eslintrc.json'), (json) => {
24
+ const { extends: pluginExtends, ignorePatterns: pluginIgnorePatters, ...config } = json;
25
+ return {
26
+ extends: ['@nuxt/eslint-config', ...(pluginExtends || [])],
27
+ ignorePatterns: [
28
+ ...(pluginIgnorePatters || []),
29
+ '.nuxt/**',
30
+ '.output/**',
31
+ 'node_modules',
32
+ ],
33
+ ...config,
34
+ };
35
+ });
36
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
37
+ '@nuxt/eslint-config': versions_1.nuxtEslintConfigVersion,
26
38
  });
27
39
  tasks.push(installTask);
28
40
  }
@@ -8,7 +8,7 @@ function createTsConfig(host, options, relativePathToRootTsConfig) {
8
8
  const json = {
9
9
  compilerOptions: {},
10
10
  files: [],
11
- include: [],
11
+ include: ['.nuxt/nuxt.d.ts'],
12
12
  references: [
13
13
  {
14
14
  path: './tsconfig.app.json',
@@ -1,7 +0,0 @@
1
- export declare const extraEslintDependencies: {
2
- dependencies: {};
3
- devDependencies: {
4
- '@nuxt/eslint-config': string;
5
- };
6
- };
7
- export declare const extendNuxtEslintJson: (json: any) => any;
package/src/utils/lint.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extendNuxtEslintJson = exports.extraEslintDependencies = void 0;
4
- const versions_1 = require("./versions");
5
- exports.extraEslintDependencies = {
6
- dependencies: {},
7
- devDependencies: {
8
- '@nuxt/eslint-config': versions_1.nuxtEslintConfigVersion,
9
- },
10
- };
11
- const extendNuxtEslintJson = (json) => {
12
- const { extends: pluginExtends, ...config } = json;
13
- return {
14
- extends: ['@nuxt/eslint-config', ...(pluginExtends || [])],
15
- ignorePatterns: ['.nuxt', 'node_modules', '.output'],
16
- ...config,
17
- };
18
- };
19
- exports.extendNuxtEslintJson = extendNuxtEslintJson;