@nx/vue 20.4.0-beta.0 → 20.4.0-beta.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/package.json +6 -6
- package/src/generators/application/application.js +15 -13
- package/src/generators/application/lib/normalize-options.js +6 -2
- package/src/generators/component/lib/utils.js +7 -4
- package/src/generators/library/lib/add-vite.js +4 -4
- package/src/generators/library/lib/normalize-options.js +6 -1
- package/src/generators/library/library.js +12 -11
- package/src/generators/library/schema.d.ts +1 -0
- package/src/utils/add-linting.d.ts +1 -0
- package/src/utils/add-linting.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "20.4.0-beta.
|
|
3
|
+
"version": "20.4.0-beta.2",
|
|
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.4.0-beta.
|
|
35
|
-
"@nx/js": "20.4.0-beta.
|
|
36
|
-
"@nx/eslint": "20.4.0-beta.
|
|
37
|
-
"@nx/vite": "20.4.0-beta.
|
|
38
|
-
"@nx/web": "20.4.0-beta.
|
|
34
|
+
"@nx/devkit": "20.4.0-beta.2",
|
|
35
|
+
"@nx/js": "20.4.0-beta.2",
|
|
36
|
+
"@nx/eslint": "20.4.0-beta.2",
|
|
37
|
+
"@nx/vite": "20.4.0-beta.2",
|
|
38
|
+
"@nx/web": "20.4.0-beta.2"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -15,8 +15,8 @@ const add_rsbuild_1 = require("./lib/add-rsbuild");
|
|
|
15
15
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
16
16
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
17
17
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
18
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
19
18
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
19
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
20
20
|
function applicationGenerator(tree, options) {
|
|
21
21
|
return applicationGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
22
22
|
}
|
|
@@ -30,23 +30,28 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
30
30
|
skipFormat: true,
|
|
31
31
|
addTsPlugin: _options.useTsSolution,
|
|
32
32
|
formatter: _options.formatter,
|
|
33
|
+
platform: 'web',
|
|
33
34
|
}));
|
|
34
35
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
36
|
+
// If we are using the new TS solution
|
|
37
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
38
|
+
if (options.isUsingTsSolutionConfig) {
|
|
39
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
40
|
+
}
|
|
35
41
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
36
42
|
options.addPlugin ??=
|
|
37
43
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
38
44
|
nxJson.useInferencePlugins !== false;
|
|
39
45
|
if (options.isUsingTsSolutionConfig) {
|
|
40
46
|
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
41
|
-
name:
|
|
47
|
+
name: options.projectName,
|
|
42
48
|
version: '0.0.1',
|
|
43
49
|
private: true,
|
|
44
|
-
nx:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
+
nx: options.parsedTags?.length
|
|
51
|
+
? {
|
|
52
|
+
tags: options.parsedTags,
|
|
53
|
+
}
|
|
54
|
+
: undefined,
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
57
|
else {
|
|
@@ -78,6 +83,7 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
78
83
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
79
84
|
rootProject: options.rootProject,
|
|
80
85
|
addPlugin: options.addPlugin,
|
|
86
|
+
projectName: options.projectName,
|
|
81
87
|
}, 'app'));
|
|
82
88
|
if (options.bundler === 'rsbuild') {
|
|
83
89
|
tasks.push(...(await (0, add_rsbuild_1.addRsbuild)(tree, options)));
|
|
@@ -101,11 +107,7 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
101
107
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
102
108
|
: undefined);
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
106
|
-
if (options.isUsingTsSolutionConfig) {
|
|
107
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
108
|
-
}
|
|
110
|
+
(0, sort_fields_1.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
109
111
|
if (!options.skipFormat)
|
|
110
112
|
await (0, devkit_1.formatFiles)(tree);
|
|
111
113
|
tasks.push(() => {
|
|
@@ -3,6 +3,7 @@ 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");
|
|
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, {
|
|
@@ -17,19 +18,22 @@ async function normalizeOptions(host, options) {
|
|
|
17
18
|
const parsedTags = options.tags
|
|
18
19
|
? options.tags.split(',').map((s) => s.trim())
|
|
19
20
|
: [];
|
|
21
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
20
22
|
const normalized = {
|
|
21
23
|
...options,
|
|
22
|
-
projectName:
|
|
24
|
+
projectName: isUsingTsSolutionConfig
|
|
25
|
+
? (0, get_import_path_1.getImportPath)(host, appProjectName)
|
|
26
|
+
: appProjectName,
|
|
23
27
|
appProjectRoot,
|
|
24
28
|
e2eProjectName,
|
|
25
29
|
e2eProjectRoot,
|
|
26
30
|
parsedTags,
|
|
31
|
+
isUsingTsSolutionConfig,
|
|
27
32
|
};
|
|
28
33
|
normalized.style = options.style ?? 'css';
|
|
29
34
|
normalized.routing = normalized.routing ?? false;
|
|
30
35
|
normalized.unitTestRunner ??= 'vitest';
|
|
31
36
|
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
|
32
|
-
normalized.isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
33
37
|
normalized.bundler = normalized.bundler ?? 'vite';
|
|
34
38
|
return normalized;
|
|
35
39
|
}
|
|
@@ -7,6 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
8
8
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
9
9
|
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
10
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
11
|
let tsModule;
|
|
11
12
|
async function normalizeOptions(host, options) {
|
|
12
13
|
const { fileName, filePath, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
@@ -17,8 +18,9 @@ async function normalizeOptions(host, options) {
|
|
|
17
18
|
let { className } = (0, devkit_1.names)(fileName);
|
|
18
19
|
const componentFileName = fileName;
|
|
19
20
|
const project = (0, devkit_1.getProjects)(host).get(projectName);
|
|
20
|
-
const { sourceRoot: projectSourceRoot, projectType } = project;
|
|
21
|
-
if (options.export &&
|
|
21
|
+
const { root, sourceRoot: projectSourceRoot, projectType } = project;
|
|
22
|
+
if (options.export &&
|
|
23
|
+
(0, ts_solution_setup_1.getProjectType)(host, root, projectType) === 'application') {
|
|
22
24
|
devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`);
|
|
23
25
|
}
|
|
24
26
|
options.routing = options.routing ?? false;
|
|
@@ -38,9 +40,10 @@ function addExportsToBarrel(host, options) {
|
|
|
38
40
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
39
41
|
}
|
|
40
42
|
const workspace = (0, devkit_1.getProjects)(host);
|
|
41
|
-
const
|
|
43
|
+
const proj = workspace.get(options.projectName);
|
|
44
|
+
const isApp = (0, ts_solution_setup_1.getProjectType)(host, proj.root, proj.projectType) === 'application';
|
|
42
45
|
if (options.export && !isApp) {
|
|
43
|
-
const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot, options.js ? 'index.js' : 'index.ts');
|
|
46
|
+
const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot ?? 'src', options.js ? 'index.js' : 'index.ts');
|
|
44
47
|
const indexSource = host.read(indexFilePath, 'utf-8');
|
|
45
48
|
if (indexSource !== null) {
|
|
46
49
|
const indexSourceFile = tsModule.createSourceFile(indexFilePath, indexSource, tsModule.ScriptTarget.Latest, true);
|
|
@@ -10,7 +10,7 @@ async function addVite(tree, options) {
|
|
|
10
10
|
const { viteConfigurationGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
11
11
|
const viteTask = await viteConfigurationGenerator(tree, {
|
|
12
12
|
uiFramework: 'none',
|
|
13
|
-
project: options.
|
|
13
|
+
project: options.projectName,
|
|
14
14
|
newProject: true,
|
|
15
15
|
includeLib: true,
|
|
16
16
|
inSourceTests: options.inSourceTests,
|
|
@@ -21,7 +21,7 @@ async function addVite(tree, options) {
|
|
|
21
21
|
});
|
|
22
22
|
tasks.push(viteTask);
|
|
23
23
|
createOrEditViteConfig(tree, {
|
|
24
|
-
project: options.
|
|
24
|
+
project: options.projectName,
|
|
25
25
|
includeLib: true,
|
|
26
26
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
27
27
|
inSourceTests: options.inSourceTests,
|
|
@@ -36,7 +36,7 @@ async function addVite(tree, options) {
|
|
|
36
36
|
const { vitestGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
37
37
|
const vitestTask = await vitestGenerator(tree, {
|
|
38
38
|
uiFramework: 'none',
|
|
39
|
-
project: options.
|
|
39
|
+
project: options.projectName,
|
|
40
40
|
coverageProvider: 'v8',
|
|
41
41
|
inSourceTests: options.inSourceTests,
|
|
42
42
|
skipFormat: true,
|
|
@@ -46,7 +46,7 @@ async function addVite(tree, options) {
|
|
|
46
46
|
});
|
|
47
47
|
tasks.push(vitestTask);
|
|
48
48
|
createOrEditViteConfig(tree, {
|
|
49
|
-
project: options.
|
|
49
|
+
project: options.projectName,
|
|
50
50
|
includeLib: true,
|
|
51
51
|
includeVitest: true,
|
|
52
52
|
inSourceTests: options.inSourceTests,
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
async function normalizeOptions(host, options) {
|
|
8
9
|
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
9
10
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -26,9 +27,13 @@ async function normalizeOptions(host, options) {
|
|
|
26
27
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
27
28
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
28
29
|
nxJson.useInferencePlugins !== false;
|
|
30
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
29
31
|
const normalized = {
|
|
30
32
|
addPlugin,
|
|
31
33
|
...options,
|
|
34
|
+
projectName: isUsingTsSolutionConfig
|
|
35
|
+
? (0, get_import_path_1.getImportPath)(host, projectName)
|
|
36
|
+
: projectName,
|
|
32
37
|
bundler,
|
|
33
38
|
fileName,
|
|
34
39
|
routePath: `/${projectNames.projectFileName}`,
|
|
@@ -36,7 +41,7 @@ async function normalizeOptions(host, options) {
|
|
|
36
41
|
projectRoot,
|
|
37
42
|
parsedTags,
|
|
38
43
|
importPath,
|
|
39
|
-
isUsingTsSolutionConfig
|
|
44
|
+
isUsingTsSolutionConfig,
|
|
40
45
|
};
|
|
41
46
|
// Libraries with a bundler or is publishable must also be buildable.
|
|
42
47
|
normalized.bundler =
|
|
@@ -18,6 +18,7 @@ const path_1 = require("path");
|
|
|
18
18
|
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
19
19
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
20
20
|
const determine_entry_fields_1 = require("./lib/determine-entry-fields");
|
|
21
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
21
22
|
function libraryGenerator(tree, schema) {
|
|
22
23
|
return libraryGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
23
24
|
}
|
|
@@ -28,6 +29,11 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
28
29
|
if (options.publishable === true && !schema.importPath) {
|
|
29
30
|
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
|
30
31
|
}
|
|
32
|
+
// If we are using the new TS solution
|
|
33
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
34
|
+
if (options.isUsingTsSolutionConfig) {
|
|
35
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
36
|
+
}
|
|
31
37
|
if (options.isUsingTsSolutionConfig) {
|
|
32
38
|
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
33
39
|
name: (0, get_import_path_1.getImportPath)(tree, options.name),
|
|
@@ -35,12 +41,11 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
35
41
|
private: true,
|
|
36
42
|
...(0, determine_entry_fields_1.determineEntryFields)(options),
|
|
37
43
|
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
38
|
-
nx:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
+
nx: options.parsedTags?.length
|
|
45
|
+
? {
|
|
46
|
+
tags: options.parsedTags,
|
|
47
|
+
}
|
|
48
|
+
: undefined,
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
else {
|
|
@@ -102,11 +107,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
102
107
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
103
108
|
: undefined);
|
|
104
109
|
}
|
|
105
|
-
|
|
106
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
107
|
-
if (options.isUsingTsSolutionConfig) {
|
|
108
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
109
|
-
}
|
|
110
|
+
(0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
|
|
110
111
|
if (!options.skipFormat)
|
|
111
112
|
await (0, devkit_1.formatFiles)(tree);
|
|
112
113
|
// Always run install to link packages.
|
package/src/utils/add-linting.js
CHANGED
|
@@ -12,7 +12,7 @@ async function addLinting(host, options, projectType) {
|
|
|
12
12
|
const tasks = [];
|
|
13
13
|
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
14
14
|
linter: options.linter,
|
|
15
|
-
project: options.
|
|
15
|
+
project: options.projectName,
|
|
16
16
|
tsConfigPaths: [
|
|
17
17
|
(0, path_1.joinPathFragments)(options.projectRoot, `tsconfig.${projectType}.json`),
|
|
18
18
|
],
|