@nx/vue 0.0.0-pr-11-e92ae29 → 0.0.0-pr-29464-ce29f31
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/create-library-files.js +2 -2
- package/src/generators/library/lib/normalize-options.js +7 -8
- package/src/generators/library/library.js +25 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29464-ce29f31",
|
|
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": "0.0.0-pr-
|
|
35
|
-
"@nx/js": "0.0.0-pr-
|
|
36
|
-
"@nx/eslint": "0.0.0-pr-
|
|
37
|
-
"@nx/vite": "0.0.0-pr-
|
|
38
|
-
"@nx/web": "0.0.0-pr-
|
|
34
|
+
"@nx/devkit": "0.0.0-pr-29464-ce29f31",
|
|
35
|
+
"@nx/js": "0.0.0-pr-29464-ce29f31",
|
|
36
|
+
"@nx/eslint": "0.0.0-pr-29464-ce29f31",
|
|
37
|
+
"@nx/vite": "0.0.0-pr-29464-ce29f31",
|
|
38
|
+
"@nx/web": "0.0.0-pr-29464-ce29f31"
|
|
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[];
|
|
@@ -17,15 +17,15 @@ function createLibraryFiles(host, options) {
|
|
|
17
17
|
if (!options.isUsingTsSolutionConfig &&
|
|
18
18
|
(options.publishable || options.bundler !== 'none')) {
|
|
19
19
|
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
20
|
-
name: options.
|
|
20
|
+
name: options.importPath ?? options.projectName,
|
|
21
21
|
version: '0.0.1',
|
|
22
22
|
main: './index.js',
|
|
23
23
|
types: './index.d.ts',
|
|
24
24
|
exports: {
|
|
25
25
|
'.': {
|
|
26
|
+
types: './index.d.ts',
|
|
26
27
|
import: './index.mjs',
|
|
27
28
|
require: './index.js',
|
|
28
|
-
types: './index.d.ts',
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
});
|
|
@@ -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
|
-
? (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}`);
|
|
@@ -15,41 +15,43 @@ const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
|
15
15
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
16
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
17
17
|
const path_1 = require("path");
|
|
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");
|
|
20
19
|
const determine_entry_fields_1 = require("./lib/determine-entry-fields");
|
|
21
20
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
21
|
+
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
|
22
22
|
function libraryGenerator(tree, schema) {
|
|
23
23
|
return libraryGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
24
24
|
}
|
|
25
25
|
async function libraryGeneratorInternal(tree, schema) {
|
|
26
26
|
const tasks = [];
|
|
27
|
-
tasks.push(await (0, js_1.initGenerator)(tree, { ...schema, skipFormat: true }));
|
|
28
27
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
29
28
|
if (options.publishable === true && !schema.importPath) {
|
|
30
29
|
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)`);
|
|
31
30
|
}
|
|
31
|
+
tasks.push(await (0, js_1.initGenerator)(tree, { ...options, skipFormat: true }));
|
|
32
32
|
// If we are using the new TS solution
|
|
33
33
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
34
34
|
if (options.isUsingTsSolutionConfig) {
|
|
35
35
|
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
36
36
|
}
|
|
37
37
|
if (options.isUsingTsSolutionConfig) {
|
|
38
|
-
|
|
39
|
-
name:
|
|
38
|
+
const packageJson = {
|
|
39
|
+
name: options.importPath,
|
|
40
40
|
version: '0.0.1',
|
|
41
|
-
private: true,
|
|
42
41
|
...(0, determine_entry_fields_1.determineEntryFields)(options),
|
|
43
42
|
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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);
|
|
50
52
|
}
|
|
51
53
|
else {
|
|
52
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.
|
|
54
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
53
55
|
root: options.projectRoot,
|
|
54
56
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
55
57
|
projectType: 'library',
|
|
@@ -82,13 +84,6 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
82
84
|
skipFormat: true,
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
|
-
if (!options.isUsingTsSolutionConfig &&
|
|
86
|
-
(options.publishable || options.bundler !== 'none')) {
|
|
87
|
-
(0, devkit_1.updateJson)(tree, `${options.projectRoot}/package.json`, (json) => {
|
|
88
|
-
json.name = options.importPath;
|
|
89
|
-
return json;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
87
|
if (!options.skipTsConfig && !options.isUsingTsSolutionConfig) {
|
|
93
88
|
(0, js_1.addTsConfigPath)(tree, options.importPath, [
|
|
94
89
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
@@ -108,6 +103,17 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
108
103
|
: undefined);
|
|
109
104
|
}
|
|
110
105
|
(0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
|
|
106
|
+
if (options.publishable) {
|
|
107
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
108
|
+
if (options.isUsingTsSolutionConfig) {
|
|
109
|
+
await (0, add_release_config_1.addReleaseConfigForTsSolution)(tree, options.projectName, projectConfig);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
await (0, add_release_config_1.addReleaseConfigForNonTsSolution)(tree, options.projectName, projectConfig);
|
|
113
|
+
}
|
|
114
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
115
|
+
tasks.push(await (0, add_release_config_1.releaseTasks)(tree));
|
|
116
|
+
}
|
|
111
117
|
if (!options.skipFormat)
|
|
112
118
|
await (0, devkit_1.formatFiles)(tree);
|
|
113
119
|
// Always run install to link packages.
|