@nx/nuxt 20.2.2 → 20.3.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/package.json +6 -6
- package/src/generators/application/application.js +42 -13
- package/src/generators/application/lib/add-e2e.js +43 -14
- package/src/generators/application/lib/normalize-options.js +2 -0
- package/src/generators/application/schema.d.ts +3 -0
- package/src/generators/application/schema.json +10 -7
- package/src/generators/init/init.js +0 -2
- package/src/utils/create-ts-config.d.ts +1 -0
- package/src/utils/create-ts-config.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/nuxt",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.3.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.
|
|
35
|
-
"@nx/js": "20.
|
|
36
|
-
"@nx/eslint": "20.
|
|
37
|
-
"@nx/vue": "20.
|
|
38
|
-
"@nx/vite": "20.
|
|
34
|
+
"@nx/devkit": "20.3.0-beta.1",
|
|
35
|
+
"@nx/js": "20.3.0-beta.1",
|
|
36
|
+
"@nx/eslint": "20.3.0-beta.1",
|
|
37
|
+
"@nx/vue": "20.3.0-beta.1",
|
|
38
|
+
"@nx/vite": "20.3.0-beta.1",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -6,7 +6,6 @@ const init_1 = require("../init/init");
|
|
|
6
6
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
7
7
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
8
8
|
const js_1 = require("@nx/js");
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
9
|
const update_gitignore_1 = require("../../utils/update-gitignore");
|
|
11
10
|
const eslint_1 = require("@nx/eslint");
|
|
12
11
|
const add_e2e_1 = require("./lib/add-e2e");
|
|
@@ -17,27 +16,45 @@ const ensure_dependencies_1 = require("./lib/ensure-dependencies");
|
|
|
17
16
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
18
17
|
const node_child_process_1 = require("node:child_process");
|
|
19
18
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
19
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
20
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
20
21
|
async function applicationGenerator(tree, schema) {
|
|
21
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'nuxt', 'application');
|
|
22
22
|
const tasks = [];
|
|
23
|
-
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
24
|
-
const projectOffsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
25
|
-
const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
26
|
-
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
27
|
-
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
28
23
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
29
24
|
...schema,
|
|
30
25
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
31
26
|
skipFormat: true,
|
|
27
|
+
addTsPlugin: schema.useTsSolution,
|
|
32
28
|
});
|
|
33
29
|
tasks.push(jsInitTask);
|
|
30
|
+
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
31
|
+
const projectOffsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
32
|
+
const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
33
|
+
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
34
|
+
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
34
35
|
tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
if (options.isUsingTsSolutionConfig) {
|
|
37
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
38
|
+
name: (0, get_import_path_1.getImportPath)(tree, options.name),
|
|
39
|
+
version: '0.0.1',
|
|
40
|
+
private: true,
|
|
41
|
+
nx: {
|
|
42
|
+
name: options.name,
|
|
43
|
+
projectType: 'application',
|
|
44
|
+
sourceRoot: `${options.appProjectRoot}/src`,
|
|
45
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
51
|
+
root: options.appProjectRoot,
|
|
52
|
+
projectType: 'application',
|
|
53
|
+
sourceRoot: `${options.appProjectRoot}/src`,
|
|
54
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
55
|
+
targets: {},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
41
58
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base'), options.appProjectRoot, {
|
|
42
59
|
...options,
|
|
43
60
|
offsetFromRoot: projectOffsetFromRoot,
|
|
@@ -66,6 +83,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
66
83
|
projectRoot: options.appProjectRoot,
|
|
67
84
|
rootProject: options.rootProject,
|
|
68
85
|
unitTestRunner: options.unitTestRunner,
|
|
86
|
+
isUsingTsSolutionConfig: options.isUsingTsSolutionConfig,
|
|
69
87
|
}, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot));
|
|
70
88
|
(0, update_gitignore_1.updateGitIgnore)(tree);
|
|
71
89
|
tasks.push(await (0, add_linting_1.addLinting)(tree, {
|
|
@@ -103,6 +121,17 @@ async function applicationGenerator(tree, schema) {
|
|
|
103
121
|
console.error(`Failed to run \`nuxi prepare\` in "${options.appProjectRoot}". Please run the command manually.`);
|
|
104
122
|
}
|
|
105
123
|
});
|
|
124
|
+
if (options.isUsingTsSolutionConfig) {
|
|
125
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
126
|
+
jsx: 'preserve',
|
|
127
|
+
jsxImportSource: 'vue',
|
|
128
|
+
module: 'esnext',
|
|
129
|
+
moduleResolution: 'bundler',
|
|
130
|
+
resolveJsonModule: true,
|
|
131
|
+
}, options.linter === 'eslint'
|
|
132
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
133
|
+
: undefined);
|
|
134
|
+
}
|
|
106
135
|
tasks.push(() => {
|
|
107
136
|
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
108
137
|
});
|
|
@@ -10,14 +10,28 @@ 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
projectType: 'application',
|
|
20
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
21
|
+
implicitDependencies: [options.projectName],
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
27
|
+
projectType: 'application',
|
|
28
|
+
root: options.e2eProjectRoot,
|
|
29
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
30
|
+
targets: {},
|
|
31
|
+
tags: [],
|
|
32
|
+
implicitDependencies: [options.projectName],
|
|
33
|
+
});
|
|
34
|
+
}
|
|
21
35
|
const e2eTask = await configurationGenerator(host, {
|
|
22
36
|
...options,
|
|
23
37
|
project: options.e2eProjectName,
|
|
@@ -44,12 +58,27 @@ async function addE2e(host, options) {
|
|
|
44
58
|
}
|
|
45
59
|
else if (options.e2eTestRunner === 'playwright') {
|
|
46
60
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
if (options.isUsingTsSolutionConfig) {
|
|
62
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
63
|
+
name: options.e2eProjectName,
|
|
64
|
+
version: '0.0.1',
|
|
65
|
+
private: true,
|
|
66
|
+
nx: {
|
|
67
|
+
projectType: 'application',
|
|
68
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
69
|
+
implicitDependencies: [options.projectName],
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
75
|
+
projectType: 'application',
|
|
76
|
+
root: options.e2eProjectRoot,
|
|
77
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
78
|
+
targets: {},
|
|
79
|
+
implicitDependencies: [options.projectName],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
53
82
|
const e2eTask = await configurationGenerator(host, {
|
|
54
83
|
project: options.e2eProjectName,
|
|
55
84
|
skipFormat: true,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
7
|
async function normalizeOptions(host, options) {
|
|
7
8
|
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
8
9
|
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -26,6 +27,7 @@ async function normalizeOptions(host, options) {
|
|
|
26
27
|
e2eProjectRoot,
|
|
27
28
|
parsedTags,
|
|
28
29
|
style: options.style ?? 'none',
|
|
30
|
+
isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
29
31
|
};
|
|
30
32
|
normalized.unitTestRunner ??= 'vitest';
|
|
31
33
|
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
|
@@ -4,6 +4,7 @@ export interface Schema {
|
|
|
4
4
|
directory: string;
|
|
5
5
|
name?: string;
|
|
6
6
|
linter?: Linter | LinterType;
|
|
7
|
+
formatter?: 'none' | 'prettier';
|
|
7
8
|
skipFormat?: boolean;
|
|
8
9
|
unitTestRunner?: 'vitest' | 'none';
|
|
9
10
|
e2eTestRunner?: 'cypress' | 'playwright' | 'none';
|
|
@@ -14,6 +15,7 @@ export interface Schema {
|
|
|
14
15
|
setParserOptionsProject?: boolean;
|
|
15
16
|
style?: 'css' | 'scss' | 'less' | 'none';
|
|
16
17
|
nxCloudToken?: string;
|
|
18
|
+
useTsSolution?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface NormalizedSchema extends Schema {
|
|
@@ -22,4 +24,5 @@ export interface NormalizedSchema extends Schema {
|
|
|
22
24
|
e2eProjectName: string;
|
|
23
25
|
e2eProjectRoot: string;
|
|
24
26
|
parsedTags: string[];
|
|
27
|
+
isUsingTsSolutionConfig: boolean;
|
|
25
28
|
}
|
|
@@ -22,24 +22,27 @@
|
|
|
22
22
|
"pattern": "^[a-zA-Z][^:]*$",
|
|
23
23
|
"x-priority": "important"
|
|
24
24
|
},
|
|
25
|
-
"linter": {
|
|
26
|
-
"description": "The tool to use for running lint checks.",
|
|
27
|
-
"type": "string",
|
|
28
|
-
"enum": ["eslint"],
|
|
29
|
-
"default": "eslint"
|
|
30
|
-
},
|
|
31
25
|
"skipFormat": {
|
|
32
26
|
"description": "Skip formatting files.",
|
|
33
27
|
"type": "boolean",
|
|
34
28
|
"default": false,
|
|
35
29
|
"x-priority": "internal"
|
|
36
30
|
},
|
|
31
|
+
"linter": {
|
|
32
|
+
"description": "The tool to use for running lint checks.",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["eslint", "none"],
|
|
35
|
+
"default": "none",
|
|
36
|
+
"x-prompt": "Which linter would you like to use?",
|
|
37
|
+
"x-priority": "important"
|
|
38
|
+
},
|
|
37
39
|
"unitTestRunner": {
|
|
38
40
|
"type": "string",
|
|
39
41
|
"enum": ["vitest", "none"],
|
|
40
42
|
"description": "Test runner to use for unit tests.",
|
|
41
43
|
"x-prompt": "Which unit test runner would you like to use?",
|
|
42
|
-
"default": "none"
|
|
44
|
+
"default": "none",
|
|
45
|
+
"x-priority": "important"
|
|
43
46
|
},
|
|
44
47
|
"e2eTestRunner": {
|
|
45
48
|
"type": "string",
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.nuxtInitGenerator = nuxtInitGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
6
|
const plugin_1 = require("../../plugins/plugin");
|
|
8
7
|
const utils_1 = require("./lib/utils");
|
|
9
8
|
async function nuxtInitGenerator(host, schema) {
|
|
10
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'nuxt', 'init');
|
|
11
9
|
await (0, add_plugin_1.addPluginV1)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/nuxt/plugin', plugin_1.createNodes, {
|
|
12
10
|
buildTargetName: ['build', 'nuxt:build', 'nuxt-build'],
|
|
13
11
|
serveTargetName: ['serve', 'nuxt:serve', 'nuxt-serve'],
|
|
@@ -6,9 +6,8 @@ const shared = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
|
6
6
|
function createTsConfig(host, options, relativePathToRootTsConfig) {
|
|
7
7
|
createAppTsConfig(host, options);
|
|
8
8
|
const json = {
|
|
9
|
-
compilerOptions: {},
|
|
10
9
|
files: [],
|
|
11
|
-
include: ['.nuxt/nuxt.d.ts'],
|
|
10
|
+
include: options.isUsingTsSolutionConfig ? undefined : ['.nuxt/nuxt.d.ts'],
|
|
12
11
|
references: [
|
|
13
12
|
{
|
|
14
13
|
path: './tsconfig.app.json',
|