@nx/vue 20.5.0-rc.3 → 20.5.0
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 +11 -8
- package/src/generators/application/lib/add-e2e.js +39 -15
- package/src/generators/application/lib/normalize-options.js +6 -7
- package/src/generators/application/schema.d.ts +2 -1
- package/src/generators/library/lib/normalize-options.js +7 -8
- package/src/generators/library/library.js +11 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "20.5.0
|
|
3
|
+
"version": "20.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Vue plugin for Nx contains executors and generators for managing Vue 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
|
"minimatch": "9.0.3",
|
|
33
33
|
"tslib": "^2.3.0",
|
|
34
|
-
"@nx/devkit": "20.5.0
|
|
35
|
-
"@nx/js": "20.5.0
|
|
36
|
-
"@nx/eslint": "20.5.0
|
|
37
|
-
"@nx/vite": "20.5.0
|
|
38
|
-
"@nx/web": "20.5.0
|
|
34
|
+
"@nx/devkit": "20.5.0",
|
|
35
|
+
"@nx/js": "20.5.0",
|
|
36
|
+
"@nx/eslint": "20.5.0",
|
|
37
|
+
"@nx/vite": "20.5.0",
|
|
38
|
+
"@nx/web": "20.5.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -43,16 +43,19 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
43
43
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
44
44
|
nxJson.useInferencePlugins !== false;
|
|
45
45
|
if (options.isUsingTsSolutionConfig) {
|
|
46
|
-
|
|
47
|
-
name: options.
|
|
46
|
+
const packageJson = {
|
|
47
|
+
name: options.importPath,
|
|
48
48
|
version: '0.0.1',
|
|
49
49
|
private: true,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
};
|
|
51
|
+
if (options.projectName !== options.importPath) {
|
|
52
|
+
packageJson.nx = { name: options.projectName };
|
|
53
|
+
}
|
|
54
|
+
if (options.parsedTags?.length) {
|
|
55
|
+
packageJson.nx ??= {};
|
|
56
|
+
packageJson.nx.tags = options.parsedTags;
|
|
57
|
+
}
|
|
58
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
56
59
|
}
|
|
57
60
|
else {
|
|
58
61
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
@@ -34,14 +34,26 @@ async function addE2e(tree, options) {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (options.isUsingTsSolutionConfig) {
|
|
38
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
39
|
+
name: options.e2eProjectName,
|
|
40
|
+
version: '0.0.1',
|
|
41
|
+
private: true,
|
|
42
|
+
nx: {
|
|
43
|
+
implicitDependencies: [options.projectName],
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
49
|
+
projectType: 'application',
|
|
50
|
+
root: options.e2eProjectRoot,
|
|
51
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
52
|
+
targets: {},
|
|
53
|
+
tags: [],
|
|
54
|
+
implicitDependencies: [options.projectName],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
45
57
|
const e2eTask = await configurationGenerator(tree, {
|
|
46
58
|
...options,
|
|
47
59
|
project: options.e2eProjectName,
|
|
@@ -77,13 +89,25 @@ async function addE2e(tree, options) {
|
|
|
77
89
|
}
|
|
78
90
|
case 'playwright': {
|
|
79
91
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
if (options.isUsingTsSolutionConfig) {
|
|
93
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
94
|
+
name: options.e2eProjectName,
|
|
95
|
+
version: '0.0.1',
|
|
96
|
+
private: true,
|
|
97
|
+
nx: {
|
|
98
|
+
implicitDependencies: [options.projectName],
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
104
|
+
projectType: 'application',
|
|
105
|
+
root: options.e2eProjectRoot,
|
|
106
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
107
|
+
targets: {},
|
|
108
|
+
implicitDependencies: [options.projectName],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
87
111
|
const e2eTask = await configurationGenerator(tree, {
|
|
88
112
|
...options,
|
|
89
113
|
project: options.e2eProjectName,
|
|
@@ -3,28 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
5
5
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
6
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
9
|
-
const { projectName
|
|
7
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
8
|
+
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
9
|
name: options.name,
|
|
11
10
|
projectType: 'application',
|
|
12
11
|
directory: options.directory,
|
|
13
12
|
rootProject: options.rootProject,
|
|
14
13
|
});
|
|
15
14
|
options.rootProject = appProjectRoot === '.';
|
|
15
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
16
|
+
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
16
17
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
17
18
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
18
19
|
const parsedTags = options.tags
|
|
19
20
|
? options.tags.split(',').map((s) => s.trim())
|
|
20
21
|
: [];
|
|
21
|
-
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
22
22
|
const normalized = {
|
|
23
23
|
...options,
|
|
24
|
-
projectName:
|
|
25
|
-
? (0, get_import_path_1.getImportPath)(host, appProjectName)
|
|
26
|
-
: appProjectName,
|
|
24
|
+
projectName: appProjectName,
|
|
27
25
|
appProjectRoot,
|
|
26
|
+
importPath,
|
|
28
27
|
e2eProjectName,
|
|
29
28
|
e2eProjectRoot,
|
|
30
29
|
parsedTags,
|
|
@@ -23,9 +23,10 @@ export interface Schema {
|
|
|
23
23
|
useTsSolution?: boolean;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export interface NormalizedSchema extends Schema {
|
|
26
|
+
export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
27
27
|
projectName: string;
|
|
28
28
|
appProjectRoot: string;
|
|
29
|
+
importPath: string;
|
|
29
30
|
e2eProjectName: string;
|
|
30
31
|
e2eProjectRoot: string;
|
|
31
32
|
parsedTags: string[];
|
|
@@ -4,9 +4,8 @@ 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
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
8
7
|
async function normalizeOptions(host, options) {
|
|
9
|
-
await (0, project_name_and_root_utils_1.
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
|
10
9
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
11
10
|
name: options.name,
|
|
12
11
|
projectType: 'library',
|
|
@@ -31,9 +30,7 @@ async function normalizeOptions(host, options) {
|
|
|
31
30
|
const normalized = {
|
|
32
31
|
addPlugin,
|
|
33
32
|
...options,
|
|
34
|
-
projectName: isUsingTsSolutionConfig
|
|
35
|
-
? importPath ?? (0, get_import_path_1.getImportPath)(host, projectName)
|
|
36
|
-
: projectName,
|
|
33
|
+
projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
37
34
|
bundler,
|
|
38
35
|
fileName,
|
|
39
36
|
routePath: `/${projectNames.projectFileName}`,
|
|
@@ -49,12 +46,14 @@ async function normalizeOptions(host, options) {
|
|
|
49
46
|
normalized.inSourceTests === normalized.minimal || normalized.inSourceTests;
|
|
50
47
|
if (options.appProject) {
|
|
51
48
|
const appProjectConfig = (0, devkit_1.getProjects)(host).get(options.appProject);
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const appProjectType = (0, ts_solution_setup_1.getProjectType)(host, appProjectConfig.root, appProjectConfig.projectType);
|
|
50
|
+
if (appProjectType !== 'application') {
|
|
51
|
+
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
|
54
52
|
}
|
|
53
|
+
const appSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(host, appProjectConfig.sourceRoot, appProjectConfig.root);
|
|
55
54
|
try {
|
|
56
55
|
normalized.appMain = appProjectConfig.targets.build.options.main;
|
|
57
|
-
normalized.appSourceRoot = (0, devkit_1.normalizePath)(
|
|
56
|
+
normalized.appSourceRoot = (0, devkit_1.normalizePath)(appSourceRoot);
|
|
58
57
|
}
|
|
59
58
|
catch (e) {
|
|
60
59
|
throw new Error(`Could not locate project main for ${options.appProject}`);
|
|
@@ -35,17 +35,20 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
35
35
|
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
36
36
|
}
|
|
37
37
|
if (options.isUsingTsSolutionConfig) {
|
|
38
|
-
|
|
39
|
-
name: options.
|
|
38
|
+
const packageJson = {
|
|
39
|
+
name: options.importPath,
|
|
40
40
|
version: '0.0.1',
|
|
41
41
|
...(0, determine_entry_fields_1.determineEntryFields)(options),
|
|
42
42
|
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
};
|
|
44
|
+
if (options.projectName !== options.importPath) {
|
|
45
|
+
packageJson.nx = { name: options.projectName };
|
|
46
|
+
}
|
|
47
|
+
if (options.parsedTags?.length) {
|
|
48
|
+
packageJson.nx ??= {};
|
|
49
|
+
packageJson.nx.tags = options.parsedTags;
|
|
50
|
+
}
|
|
51
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
54
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|