@nx/nuxt 23.1.0 → 23.1.2
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/dist/src/generators/application/application.js +9 -8
- package/dist/src/generators/application/lib/add-e2e.js +2 -1
- package/dist/src/generators/application/schema.d.ts +4 -0
- package/dist/src/generators/application/schema.json +8 -2
- package/dist/src/plugins/plugin.js +1 -2
- package/dist/src/utils/add-linting.d.ts +6 -2
- package/dist/src/utils/add-linting.js +27 -8
- package/dist/src/utils/version-utils.d.ts +1 -1
- package/package.json +18 -9
|
@@ -4,6 +4,7 @@ exports.applicationGenerator = applicationGenerator;
|
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
9
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
9
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
@@ -19,8 +20,7 @@ const assert_supported_nuxt_version_1 = require("../../utils/assert-supported-nu
|
|
|
19
20
|
const node_child_process_1 = require("node:child_process");
|
|
20
21
|
const node_fs_1 = require("node:fs");
|
|
21
22
|
const node_path_1 = require("node:path");
|
|
22
|
-
const
|
|
23
|
-
const internal_2 = require("@nx/js/internal");
|
|
23
|
+
const internal_3 = require("@nx/js/internal");
|
|
24
24
|
async function applicationGenerator(tree, schema) {
|
|
25
25
|
return await applicationGeneratorInternal(tree, {
|
|
26
26
|
useProjectJson: true,
|
|
@@ -30,7 +30,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
30
30
|
async function applicationGeneratorInternal(tree, schema) {
|
|
31
31
|
(0, assert_supported_nuxt_version_1.assertSupportedNuxtVersion)(tree);
|
|
32
32
|
const tasks = [];
|
|
33
|
-
const addTsPlugin = (0,
|
|
33
|
+
const addTsPlugin = (0, internal_3.shouldConfigureTsSolutionSetup)(tree, true, // nuxt always adds plugins
|
|
34
34
|
schema.useTsSolution);
|
|
35
35
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
36
36
|
...schema,
|
|
@@ -42,9 +42,9 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
42
42
|
tasks.push(jsInitTask);
|
|
43
43
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
44
44
|
const projectOffsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
45
|
-
const onBoardingStatus = await (0,
|
|
45
|
+
const onBoardingStatus = await (0, internal_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
46
46
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
47
|
-
(await (0,
|
|
47
|
+
(await (0, internal_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
48
48
|
tasks.push(await (0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
49
49
|
const packageJson = {
|
|
50
50
|
name: options.importPath,
|
|
@@ -115,7 +115,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
115
115
|
// If we are using the new TS solution
|
|
116
116
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
117
117
|
if (options.isUsingTsSolutionConfig) {
|
|
118
|
-
await (0,
|
|
118
|
+
await (0, internal_3.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
119
119
|
}
|
|
120
120
|
tasks.push(await (0, add_linting_1.addLinting)(tree, {
|
|
121
121
|
projectName: options.projectName,
|
|
@@ -123,6 +123,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
123
123
|
linter: options.linter ?? 'eslint',
|
|
124
124
|
unitTestRunner: options.unitTestRunner,
|
|
125
125
|
rootProject: options.rootProject,
|
|
126
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
126
127
|
}));
|
|
127
128
|
if (options.unitTestRunner === 'vitest') {
|
|
128
129
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
@@ -140,7 +141,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
140
141
|
if (options.js)
|
|
141
142
|
(0, devkit_1.toJS)(tree);
|
|
142
143
|
if (options.isUsingTsSolutionConfig) {
|
|
143
|
-
(0,
|
|
144
|
+
(0, internal_3.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
144
145
|
jsx: 'preserve',
|
|
145
146
|
jsxImportSource: 'vue',
|
|
146
147
|
module: 'esnext',
|
|
@@ -150,7 +151,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
150
151
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
151
152
|
: undefined);
|
|
152
153
|
}
|
|
153
|
-
(0,
|
|
154
|
+
(0, internal_3.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
154
155
|
if (!options.skipFormat)
|
|
155
156
|
await (0, devkit_1.formatFiles)(tree);
|
|
156
157
|
tasks.push(() => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const versions_1 = require("../../../utils/versions");
|
|
7
8
|
async function addE2e(host, options) {
|
|
@@ -80,7 +81,7 @@ async function addE2e(host, options) {
|
|
|
80
81
|
directory: 'src',
|
|
81
82
|
js: false,
|
|
82
83
|
linter: options.linter,
|
|
83
|
-
|
|
84
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
84
85
|
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
85
86
|
webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
86
87
|
addPlugin: true,
|
|
@@ -12,6 +12,10 @@ export interface Schema {
|
|
|
12
12
|
js?: boolean;
|
|
13
13
|
skipPackageJson?: boolean;
|
|
14
14
|
rootProject?: boolean;
|
|
15
|
+
enableTypedLinting?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
18
|
+
*/
|
|
15
19
|
setParserOptionsProject?: boolean;
|
|
16
20
|
style?: 'css' | 'scss' | 'none';
|
|
17
21
|
nxCloudToken?: string;
|
|
@@ -99,11 +99,17 @@
|
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
|
-
"
|
|
102
|
+
"enableTypedLinting": {
|
|
103
103
|
"type": "boolean",
|
|
104
|
-
"description": "Whether
|
|
104
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
105
105
|
"default": false
|
|
106
106
|
},
|
|
107
|
+
"setParserOptionsProject": {
|
|
108
|
+
"type": "boolean",
|
|
109
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
110
|
+
"default": false,
|
|
111
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
112
|
+
},
|
|
107
113
|
"useProjectJson": {
|
|
108
114
|
"type": "boolean",
|
|
109
115
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createNodesV2 = exports.createNodes = void 0;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
7
6
|
const js_1 = require("@nx/js");
|
|
8
7
|
const path_1 = require("path");
|
|
9
8
|
const fs_1 = require("fs");
|
|
10
9
|
const executor_utils_1 = require("../utils/executor-utils");
|
|
11
10
|
const internal_2 = require("@nx/js/internal");
|
|
12
|
-
const cachePath = (0, path_1.join)(
|
|
11
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, 'nuxt.hash');
|
|
13
12
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
14
13
|
exports.createNodes = [
|
|
15
14
|
'**/nuxt.config.{js,ts,mjs,mts,cjs,cts}',
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Tree } from 'nx/src/generators/tree';
|
|
2
1
|
import { Linter, LinterType } from '@nx/eslint';
|
|
3
|
-
import { GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
4
3
|
export declare function addLinting(host: Tree, options: {
|
|
5
4
|
linter: Linter | LinterType;
|
|
6
5
|
projectName: string;
|
|
7
6
|
projectRoot: string;
|
|
8
7
|
unitTestRunner?: 'vitest' | 'none';
|
|
9
8
|
rootProject?: boolean;
|
|
9
|
+
enableTypedLinting?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
12
|
+
*/
|
|
13
|
+
setParserOptionsProject?: boolean;
|
|
10
14
|
}): Promise<GeneratorCallback>;
|
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
4
|
const eslint_1 = require("@nx/eslint");
|
|
5
|
-
const path_1 = require("nx/src/utils/path");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const internal_1 = require("@nx/eslint/internal");
|
|
8
7
|
const versions_1 = require("./versions");
|
|
9
8
|
async function addLinting(host, options) {
|
|
10
9
|
const tasks = [];
|
|
11
10
|
if (options.linter === 'eslint') {
|
|
11
|
+
const enableTypedLinting = (0, internal_1.isTypedLintingEnabled)(options);
|
|
12
12
|
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
13
13
|
linter: options.linter,
|
|
14
14
|
project: options.projectName,
|
|
15
|
-
tsConfigPaths: [(0,
|
|
15
|
+
tsConfigPaths: [(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json')],
|
|
16
16
|
unitTestRunner: options.unitTestRunner,
|
|
17
17
|
skipFormat: true,
|
|
18
18
|
rootProject: options.rootProject,
|
|
19
|
+
enableTypedLinting,
|
|
19
20
|
addPlugin: true,
|
|
20
21
|
});
|
|
21
22
|
tasks.push(lintTask);
|
|
@@ -30,8 +31,11 @@ async function addLinting(host, options) {
|
|
|
30
31
|
};
|
|
31
32
|
if ((0, internal_1.isEslintConfigSupported)(host, options.projectRoot)) {
|
|
32
33
|
if (isFlatConfig) {
|
|
33
|
-
// For flat config: Generate eslint.config.mjs using createConfigForNuxt
|
|
34
|
-
|
|
34
|
+
// For flat config: Generate eslint.config.mjs using createConfigForNuxt.
|
|
35
|
+
// Pass `enableTypedLinting` so the projectService block is inlined into
|
|
36
|
+
// the template (the file's top-level export is a call expression chain,
|
|
37
|
+
// not an array literal, so post-hoc AST insertion doesn't work).
|
|
38
|
+
generateNuxtFlatEslintConfig(host, options.projectRoot, enableTypedLinting);
|
|
35
39
|
}
|
|
36
40
|
else {
|
|
37
41
|
// For legacy: Use extends with the old @nuxt/eslint-config
|
|
@@ -54,17 +58,32 @@ async function addLinting(host, options) {
|
|
|
54
58
|
* Generates a flat ESLint config for Nuxt using createConfigForNuxt from @nuxt/eslint-config/flat.
|
|
55
59
|
* This is the recommended approach for Nuxt v4+ and ESLint flat config.
|
|
56
60
|
*/
|
|
57
|
-
function generateNuxtFlatEslintConfig(tree, projectRoot) {
|
|
61
|
+
function generateNuxtFlatEslintConfig(tree, projectRoot, enableTypedLinting) {
|
|
58
62
|
const eslintFile = (0, internal_1.findEslintFile)(tree, projectRoot);
|
|
59
63
|
if (!eslintFile)
|
|
60
64
|
return;
|
|
61
|
-
const configPath = (0,
|
|
65
|
+
const configPath = (0, devkit_1.joinPathFragments)(projectRoot, eslintFile);
|
|
62
66
|
const isMjs = eslintFile.endsWith('.mjs');
|
|
63
67
|
const isCjs = eslintFile.endsWith('.cjs');
|
|
64
68
|
// Determine the relative path to root config
|
|
65
69
|
const depth = projectRoot.split('/').filter(Boolean).length;
|
|
66
70
|
const rootConfigRelativePath = depth > 0 ? '../'.repeat(depth) : './';
|
|
67
71
|
let configContent;
|
|
72
|
+
const typedLintingBlock = enableTypedLinting
|
|
73
|
+
? `
|
|
74
|
+
{
|
|
75
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
|
|
76
|
+
languageOptions: {
|
|
77
|
+
parserOptions: {
|
|
78
|
+
projectService: true,
|
|
79
|
+
// \`projectService\` conflicts with a \`parserOptions.project\` set by any config
|
|
80
|
+
// merged into this one. Remove this once you know none of them set it.
|
|
81
|
+
project: null,
|
|
82
|
+
tsconfigRootDir: ${isCjs ? '__dirname' : 'import.meta.dirname'},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},`
|
|
86
|
+
: '';
|
|
68
87
|
if (isCjs) {
|
|
69
88
|
// CJS flat config
|
|
70
89
|
configContent = `const { createConfigForNuxt } = require('@nuxt/eslint-config/flat');
|
|
@@ -76,7 +95,7 @@ module.exports = createConfigForNuxt({
|
|
|
76
95
|
typescript: true,
|
|
77
96
|
},
|
|
78
97
|
})${projectRoot !== '.' ? `\n .prepend(...baseConfig)` : ''}
|
|
79
|
-
.append(
|
|
98
|
+
.append(${typedLintingBlock}
|
|
80
99
|
{
|
|
81
100
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
|
|
82
101
|
rules: {
|
|
@@ -100,7 +119,7 @@ export default createConfigForNuxt({
|
|
|
100
119
|
typescript: true,
|
|
101
120
|
},
|
|
102
121
|
})${projectRoot !== '.' ? `\n .prepend(...baseConfig)` : ''}
|
|
103
|
-
.append(
|
|
122
|
+
.append(${typedLintingBlock}
|
|
104
123
|
{
|
|
105
124
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
|
|
106
125
|
rules: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/nuxt",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.2",
|
|
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": {
|
|
@@ -60,20 +60,23 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"tslib": "^2.3.0",
|
|
62
62
|
"semver": "^7.6.3",
|
|
63
|
-
"@nx/
|
|
64
|
-
"@nx/
|
|
65
|
-
"@nx/
|
|
66
|
-
"@nx/
|
|
67
|
-
"@nx/vite": "23.1.
|
|
68
|
-
"@nx/vitest": "23.1.
|
|
63
|
+
"@nx/eslint": "23.1.2",
|
|
64
|
+
"@nx/devkit": "23.1.2",
|
|
65
|
+
"@nx/vue": "23.1.2",
|
|
66
|
+
"@nx/js": "23.1.2",
|
|
67
|
+
"@nx/vite": "23.1.2",
|
|
68
|
+
"@nx/vitest": "23.1.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"
|
|
71
|
+
"nuxt": "^3.21.10",
|
|
72
|
+
"nx": "23.1.2"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"nuxt": ">=3.0.0 <5.0.0",
|
|
75
76
|
"@nuxt/schema": "^3.0.0 || ^4.0.0",
|
|
76
|
-
"@nuxt/kit": "^3.0.0 || ^4.0.0"
|
|
77
|
+
"@nuxt/kit": "^3.0.0 || ^4.0.0",
|
|
78
|
+
"@nx/cypress": "23.1.2",
|
|
79
|
+
"@nx/playwright": "23.1.2"
|
|
77
80
|
},
|
|
78
81
|
"peerDependenciesMeta": {
|
|
79
82
|
"nuxt": {
|
|
@@ -84,6 +87,12 @@
|
|
|
84
87
|
},
|
|
85
88
|
"@nuxt/kit": {
|
|
86
89
|
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"@nx/cypress": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@nx/playwright": {
|
|
95
|
+
"optional": true
|
|
87
96
|
}
|
|
88
97
|
},
|
|
89
98
|
"publishConfig": {
|