@nx/vue 20.0.0-beta.5 → 20.0.0-beta.7
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 +2 -0
- package/src/generators/application/lib/normalize-options.js +2 -3
- package/src/generators/application/schema.d.ts +2 -4
- package/src/generators/application/schema.json +8 -13
- package/src/generators/component/lib/utils.js +3 -4
- package/src/generators/component/schema.d.ts +3 -5
- package/src/generators/component/schema.json +13 -15
- package/src/generators/init/init.js +2 -0
- package/src/generators/library/lib/normalize-options.js +1 -1
- package/src/generators/library/library.js +4 -3
- package/src/generators/library/schema.d.ts +2 -5
- package/src/generators/library/schema.json +8 -14
- package/src/utils/test-utils.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "20.0.0-beta.
|
|
3
|
+
"version": "20.0.0-beta.7",
|
|
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.0.0-beta.
|
|
35
|
-
"@nx/js": "20.0.0-beta.
|
|
36
|
-
"@nx/eslint": "20.0.0-beta.
|
|
37
|
-
"@nx/vite": "20.0.0-beta.
|
|
38
|
-
"@nx/web": "20.0.0-beta.
|
|
34
|
+
"@nx/devkit": "20.0.0-beta.7",
|
|
35
|
+
"@nx/js": "20.0.0-beta.7",
|
|
36
|
+
"@nx/eslint": "20.0.0-beta.7",
|
|
37
|
+
"@nx/vite": "20.0.0-beta.7",
|
|
38
|
+
"@nx/web": "20.0.0-beta.7"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -5,6 +5,7 @@ exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
9
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
10
|
const init_1 = require("../init/init");
|
|
10
11
|
const add_linting_1 = require("../../utils/add-linting");
|
|
@@ -18,6 +19,7 @@ function applicationGenerator(tree, options) {
|
|
|
18
19
|
return applicationGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
19
20
|
}
|
|
20
21
|
async function applicationGeneratorInternal(tree, _options) {
|
|
22
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'vue', 'application');
|
|
21
23
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
22
24
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
23
25
|
options.addPlugin ??=
|
|
@@ -3,15 +3,14 @@ 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
|
async function normalizeOptions(host, options) {
|
|
6
|
-
|
|
6
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
7
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
7
8
|
name: options.name,
|
|
8
9
|
projectType: 'application',
|
|
9
10
|
directory: options.directory,
|
|
10
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
11
11
|
rootProject: options.rootProject,
|
|
12
12
|
});
|
|
13
13
|
options.rootProject = appProjectRoot === '.';
|
|
14
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
15
14
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
16
15
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
17
16
|
const parsedTags = options.tags
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface Schema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
style: 'none' | 'css' | 'scss' | 'less';
|
|
7
7
|
skipFormat?: boolean;
|
|
8
|
-
directory?: string;
|
|
9
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
10
8
|
tags?: string;
|
|
11
9
|
unitTestRunner?: 'vitest' | 'none';
|
|
12
10
|
inSourceTests?: boolean;
|
|
@@ -16,27 +16,22 @@
|
|
|
16
16
|
],
|
|
17
17
|
"type": "object",
|
|
18
18
|
"properties": {
|
|
19
|
-
"
|
|
20
|
-
"description": "The
|
|
19
|
+
"directory": {
|
|
20
|
+
"description": "The directory of the new application.",
|
|
21
21
|
"type": "string",
|
|
22
|
+
"alias": "dir",
|
|
22
23
|
"$default": {
|
|
23
24
|
"$source": "argv",
|
|
24
25
|
"index": 0
|
|
25
26
|
},
|
|
26
|
-
"x-prompt": "
|
|
27
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
|
27
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
30
|
-
"description": "The
|
|
29
|
+
"name": {
|
|
30
|
+
"description": "The name of the application.",
|
|
31
31
|
"type": "string",
|
|
32
|
-
"
|
|
32
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
33
33
|
"x-priority": "important"
|
|
34
34
|
},
|
|
35
|
-
"projectNameAndRootFormat": {
|
|
36
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
37
|
-
"type": "string",
|
|
38
|
-
"enum": ["as-provided", "derived"]
|
|
39
|
-
},
|
|
40
35
|
"style": {
|
|
41
36
|
"description": "The file extension to be used for style files.",
|
|
42
37
|
"type": "string",
|
|
@@ -135,6 +130,6 @@
|
|
|
135
130
|
"hidden": true
|
|
136
131
|
}
|
|
137
132
|
},
|
|
138
|
-
"required": ["
|
|
133
|
+
"required": ["directory"],
|
|
139
134
|
"examplesFile": "../../../docs/application-examples.md"
|
|
140
135
|
}
|
|
@@ -9,10 +9,9 @@ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/a
|
|
|
9
9
|
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
10
10
|
let tsModule;
|
|
11
11
|
async function normalizeOptions(host, options) {
|
|
12
|
-
const { artifactName: name,
|
|
12
|
+
const { artifactName: name, fileName, filePath, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
13
13
|
name: options.name,
|
|
14
|
-
|
|
15
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
14
|
+
path: options.path,
|
|
16
15
|
fileExtension: 'vue',
|
|
17
16
|
});
|
|
18
17
|
let { className } = (0, devkit_1.names)(fileName);
|
|
@@ -26,8 +25,8 @@ async function normalizeOptions(host, options) {
|
|
|
26
25
|
options.inSourceTests = options.inSourceTests ?? false;
|
|
27
26
|
return {
|
|
28
27
|
...options,
|
|
29
|
-
filePath,
|
|
30
28
|
directory,
|
|
29
|
+
filePath,
|
|
31
30
|
className,
|
|
32
31
|
fileName: componentFileName,
|
|
33
32
|
projectSourceRoot,
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
|
2
|
-
|
|
3
1
|
export interface ComponentGeneratorSchema {
|
|
4
|
-
|
|
2
|
+
path: string;
|
|
3
|
+
name?: string;
|
|
5
4
|
skipTests?: boolean;
|
|
6
|
-
directory?: string;
|
|
7
5
|
export?: boolean;
|
|
8
6
|
routing?: boolean;
|
|
9
7
|
js?: boolean;
|
|
10
8
|
fileName?: string;
|
|
11
9
|
inSourceTests?: boolean;
|
|
12
10
|
skipFormat?: boolean;
|
|
13
|
-
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
export interface NormalizedSchema extends ComponentGeneratorSchema {
|
|
14
|
+
directory: string;
|
|
17
15
|
projectName: string;
|
|
18
16
|
projectSourceRoot: string;
|
|
19
17
|
fileName: string;
|
|
@@ -7,25 +7,29 @@
|
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
|
-
"command": "nx g @nx/vue:component
|
|
11
|
-
"description": "Generate a component in the `my-app` application"
|
|
10
|
+
"command": "nx g @nx/vue:component my-app/src/app/one --name=one --unitTestRunner=vitest",
|
|
11
|
+
"description": "Generate a component `one` in the `my-app` application at my-app/src/app/one"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"command": "nx g @nx/vue:component my-app/src/app/one",
|
|
15
|
+
"description": "Generate a component `one` in the `my-app` application at my-app/src/app/one"
|
|
12
16
|
}
|
|
13
17
|
],
|
|
14
18
|
"properties": {
|
|
15
|
-
"
|
|
19
|
+
"path": {
|
|
16
20
|
"type": "string",
|
|
17
|
-
"description": "
|
|
21
|
+
"description": "Path where the component will be generated.",
|
|
18
22
|
"$default": {
|
|
19
23
|
"$source": "argv",
|
|
20
24
|
"index": 0
|
|
21
25
|
},
|
|
22
|
-
"x-prompt": "
|
|
26
|
+
"x-prompt": "Where should the component be generated?",
|
|
23
27
|
"x-priority": "important"
|
|
24
28
|
},
|
|
25
|
-
"
|
|
26
|
-
"description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
29
|
+
"name": {
|
|
27
30
|
"type": "string",
|
|
28
|
-
"
|
|
31
|
+
"description": "The name of the component.",
|
|
32
|
+
"x-prompt": "What name would you like to use for the component?"
|
|
29
33
|
},
|
|
30
34
|
"js": {
|
|
31
35
|
"type": "boolean",
|
|
@@ -38,12 +42,6 @@
|
|
|
38
42
|
"default": false,
|
|
39
43
|
"x-priority": "internal"
|
|
40
44
|
},
|
|
41
|
-
"directory": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"description": "The directory at which to create the component file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.",
|
|
44
|
-
"alias": "dir",
|
|
45
|
-
"x-priority": "important"
|
|
46
|
-
},
|
|
47
45
|
"export": {
|
|
48
46
|
"type": "boolean",
|
|
49
47
|
"description": "When true, the component is exported from the project `index.ts` (if it exists).",
|
|
@@ -71,5 +69,5 @@
|
|
|
71
69
|
"x-priority": "internal"
|
|
72
70
|
}
|
|
73
71
|
},
|
|
74
|
-
"required": ["
|
|
72
|
+
"required": ["path"]
|
|
75
73
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vueInitGenerator = vueInitGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
7
|
function updateDependencies(host, schema) {
|
|
7
8
|
const tasks = [];
|
|
@@ -10,6 +11,7 @@ function updateDependencies(host, schema) {
|
|
|
10
11
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
11
12
|
}
|
|
12
13
|
async function vueInitGenerator(host, schema) {
|
|
14
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'vue', 'init');
|
|
13
15
|
let installTask = () => { };
|
|
14
16
|
if (!schema.skipPackageJson) {
|
|
15
17
|
installTask = updateDependencies(host, schema);
|
|
@@ -4,12 +4,12 @@ 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
|
async function normalizeOptions(host, options) {
|
|
7
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
7
8
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
9
|
name: options.name,
|
|
9
10
|
projectType: 'library',
|
|
10
11
|
directory: options.directory,
|
|
11
12
|
importPath: options.importPath,
|
|
12
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
13
|
});
|
|
14
14
|
const fileName = projectNames.projectFileName;
|
|
15
15
|
const parsedTags = options.tags
|
|
@@ -4,6 +4,7 @@ exports.libraryGenerator = libraryGenerator;
|
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
8
|
const init_1 = require("../init/init");
|
|
8
9
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
10
|
const add_linting_1 = require("../../utils/add-linting");
|
|
@@ -19,6 +20,7 @@ function libraryGenerator(tree, schema) {
|
|
|
19
20
|
return libraryGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
20
21
|
}
|
|
21
22
|
async function libraryGeneratorInternal(tree, schema) {
|
|
23
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'vue', 'library');
|
|
22
24
|
const tasks = [];
|
|
23
25
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
24
26
|
if (options.publishable === true && !schema.importPath) {
|
|
@@ -45,10 +47,9 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
45
47
|
tasks.push(await (0, add_vite_1.addVite)(tree, options));
|
|
46
48
|
if (options.component) {
|
|
47
49
|
const relativeCwd = (0, artifact_name_and_directory_utils_1.getRelativeCwd)();
|
|
48
|
-
const
|
|
50
|
+
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.fileName);
|
|
49
51
|
await (0, component_1.default)(tree, {
|
|
50
|
-
|
|
51
|
-
nameAndDirectoryFormat: 'as-provided',
|
|
52
|
+
path: relativeCwd ? (0, path_1.relative)(relativeCwd, path) : path,
|
|
52
53
|
skipTests: options.unitTestRunner === 'none' ||
|
|
53
54
|
(options.unitTestRunner === 'vitest' && options.inSourceTests == true),
|
|
54
55
|
export: true,
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
|
-
import type { SupportedStyles } from '../../../typings/style';
|
|
4
2
|
|
|
5
3
|
export interface Schema {
|
|
6
4
|
appProject?: string;
|
|
7
5
|
bundler?: 'none' | 'vite';
|
|
8
6
|
component?: boolean;
|
|
9
|
-
directory
|
|
10
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
7
|
+
directory: string;
|
|
11
8
|
importPath?: string;
|
|
12
9
|
inSourceTests?: boolean;
|
|
13
10
|
js?: boolean;
|
|
14
11
|
linter: Linter | LinterType;
|
|
15
|
-
name
|
|
12
|
+
name?: string;
|
|
16
13
|
publishable?: boolean;
|
|
17
14
|
routing?: boolean;
|
|
18
15
|
setParserOptionsProject?: boolean;
|
|
@@ -16,28 +16,22 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"properties": {
|
|
19
|
-
"
|
|
19
|
+
"directory": {
|
|
20
20
|
"type": "string",
|
|
21
|
-
"description": "
|
|
21
|
+
"description": "A directory where the lib is placed.",
|
|
22
|
+
"alias": "dir",
|
|
22
23
|
"$default": {
|
|
23
24
|
"$source": "argv",
|
|
24
25
|
"index": 0
|
|
25
26
|
},
|
|
26
|
-
"x-prompt": "
|
|
27
|
-
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
|
28
|
-
"x-priority": "important"
|
|
27
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
29
28
|
},
|
|
30
|
-
"
|
|
29
|
+
"name": {
|
|
31
30
|
"type": "string",
|
|
32
|
-
"description": "
|
|
33
|
-
"
|
|
31
|
+
"description": "Library name",
|
|
32
|
+
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
|
34
33
|
"x-priority": "important"
|
|
35
34
|
},
|
|
36
|
-
"projectNameAndRootFormat": {
|
|
37
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
38
|
-
"type": "string",
|
|
39
|
-
"enum": ["as-provided", "derived"]
|
|
40
|
-
},
|
|
41
35
|
"linter": {
|
|
42
36
|
"description": "The tool to use for running lint checks.",
|
|
43
37
|
"type": "string",
|
|
@@ -129,5 +123,5 @@
|
|
|
129
123
|
"default": false
|
|
130
124
|
}
|
|
131
125
|
},
|
|
132
|
-
"required": ["
|
|
126
|
+
"required": ["directory"]
|
|
133
127
|
}
|
package/src/utils/test-utils.js
CHANGED