@nx/nuxt 20.5.0 → 20.6.0-beta.1

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/generators.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "hidden": true
12
12
  },
13
13
  "application": {
14
- "factory": "./src/generators/application/application",
14
+ "factory": "./src/generators/application/application#applicationGeneratorInternal",
15
15
  "schema": "./src/generators/application/schema.json",
16
16
  "aliases": ["app"],
17
17
  "description": "Create a Nuxt application."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nuxt",
3
- "version": "20.5.0",
3
+ "version": "20.6.0-beta.1",
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, Playwright, 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": {
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "tslib": "^2.3.0",
33
33
  "@nuxt/kit": "^3.10.0",
34
- "@nx/devkit": "20.5.0",
35
- "@nx/js": "20.5.0",
36
- "@nx/eslint": "20.5.0",
37
- "@nx/vue": "20.5.0",
38
- "@nx/vite": "20.5.0",
34
+ "@nx/devkit": "20.6.0-beta.1",
35
+ "@nx/js": "20.6.0-beta.1",
36
+ "@nx/eslint": "20.6.0-beta.1",
37
+ "@nx/vue": "20.6.0-beta.1",
38
+ "@nx/vite": "20.6.0-beta.1",
39
39
  "@phenomnomnominal/tsquery": "~5.0.1"
40
40
  },
41
41
  "peerDependencies": {
@@ -1,4 +1,5 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
+ export declare function applicationGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
5
  export default applicationGenerator;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGenerator = applicationGenerator;
4
+ exports.applicationGeneratorInternal = applicationGeneratorInternal;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const init_1 = require("../init/init");
6
7
  const normalize_options_1 = require("./lib/normalize-options");
@@ -19,6 +20,12 @@ const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
19
20
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
20
21
  const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
21
22
  async function applicationGenerator(tree, schema) {
23
+ return await applicationGeneratorInternal(tree, {
24
+ useProjectJson: true,
25
+ ...schema,
26
+ });
27
+ }
28
+ async function applicationGeneratorInternal(tree, schema) {
22
29
  const tasks = [];
23
30
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
24
31
  ...schema,
@@ -34,12 +41,12 @@ async function applicationGenerator(tree, schema) {
34
41
  const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
35
42
  (await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
36
43
  tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
37
- if (options.isUsingTsSolutionConfig) {
38
- const packageJson = {
39
- name: options.importPath,
40
- version: '0.0.1',
41
- private: true,
42
- };
44
+ const packageJson = {
45
+ name: options.importPath,
46
+ version: '0.0.1',
47
+ private: true,
48
+ };
49
+ if (!options.useProjectJson) {
43
50
  if (options.projectName !== options.importPath) {
44
51
  packageJson.nx = { name: options.projectName };
45
52
  }
@@ -47,7 +54,6 @@ async function applicationGenerator(tree, schema) {
47
54
  packageJson.nx ??= {};
48
55
  packageJson.nx.tags = options.parsedTags;
49
56
  }
50
- (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
51
57
  }
52
58
  else {
53
59
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
@@ -58,6 +64,9 @@ async function applicationGenerator(tree, schema) {
58
64
  targets: {},
59
65
  });
60
66
  }
67
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
68
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
69
+ }
61
70
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base'), options.appProjectRoot, {
62
71
  ...options,
63
72
  offsetFromRoot: projectOffsetFromRoot,
@@ -92,7 +101,7 @@ async function applicationGenerator(tree, schema) {
92
101
  // If we are using the new TS solution
93
102
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
94
103
  if (options.isUsingTsSolutionConfig) {
95
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
104
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
96
105
  }
97
106
  tasks.push(await (0, add_linting_1.addLinting)(tree, {
98
107
  projectName: options.projectName,
@@ -10,15 +10,15 @@ async function addE2e(host, options) {
10
10
  const e2eWebServerInfo = await getNuxtE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `nuxt.config.${options.js ? 'js' : 'ts'}`));
11
11
  if (options.e2eTestRunner === 'cypress') {
12
12
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
13
- if (options.isUsingTsSolutionConfig) {
14
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
15
- name: options.e2eProjectName,
16
- version: '0.0.1',
17
- private: true,
18
- nx: {
19
- implicitDependencies: [options.projectName],
20
- },
21
- });
13
+ const packageJson = {
14
+ name: options.e2eProjectName,
15
+ version: '0.0.1',
16
+ private: true,
17
+ };
18
+ if (!options.useProjectJson) {
19
+ packageJson.nx = {
20
+ implicitDependencies: [options.projectName],
21
+ };
22
22
  }
23
23
  else {
24
24
  (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
@@ -30,6 +30,9 @@ async function addE2e(host, options) {
30
30
  implicitDependencies: [options.projectName],
31
31
  });
32
32
  }
33
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
34
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
35
+ }
33
36
  const e2eTask = await configurationGenerator(host, {
34
37
  ...options,
35
38
  project: options.e2eProjectName,
@@ -56,15 +59,15 @@ async function addE2e(host, options) {
56
59
  }
57
60
  else if (options.e2eTestRunner === 'playwright') {
58
61
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
59
- if (options.isUsingTsSolutionConfig) {
60
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
61
- name: options.e2eProjectName,
62
- version: '0.0.1',
63
- private: true,
64
- nx: {
65
- implicitDependencies: [options.projectName],
66
- },
67
- });
62
+ const packageJson = {
63
+ name: options.e2eProjectName,
64
+ version: '0.0.1',
65
+ private: true,
66
+ };
67
+ if (!options.useProjectJson) {
68
+ packageJson.nx = {
69
+ implicitDependencies: [options.projectName],
70
+ };
68
71
  }
69
72
  else {
70
73
  (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
@@ -75,6 +78,9 @@ async function addE2e(host, options) {
75
78
  implicitDependencies: [options.projectName],
76
79
  });
77
80
  }
81
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
82
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
83
+ }
78
84
  const e2eTask = await configurationGenerator(host, {
79
85
  project: options.e2eProjectName,
80
86
  skipFormat: true,
@@ -30,6 +30,7 @@ async function normalizeOptions(host, options) {
30
30
  parsedTags,
31
31
  style: options.style ?? 'none',
32
32
  isUsingTsSolutionConfig,
33
+ useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
33
34
  };
34
35
  normalized.unitTestRunner ??= 'vitest';
35
36
  normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
@@ -16,6 +16,7 @@ export interface Schema {
16
16
  style?: 'css' | 'scss' | 'less' | 'none';
17
17
  nxCloudToken?: string;
18
18
  useTsSolution?: boolean;
19
+ useProjectJson?: boolean;
19
20
  }
20
21
 
21
22
  export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
@@ -106,6 +106,10 @@
106
106
  "type": "boolean",
107
107
  "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
108
108
  "default": false
109
+ },
110
+ "useProjectJson": {
111
+ "type": "boolean",
112
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
109
113
  }
110
114
  },
111
115
  "required": ["directory"],