@nx/vue 21.0.0-beta.1 → 21.0.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/migrations.json +21 -0
- package/package.json +6 -6
- package/src/generators/application/application.js +22 -13
- package/src/generators/application/lib/add-e2e.js +45 -15
- package/src/generators/application/lib/normalize-options.js +7 -7
- package/src/generators/application/schema.d.ts +3 -1
- package/src/generators/application/schema.json +4 -0
- package/src/generators/library/lib/create-library-files.js +3 -2
- package/src/generators/library/lib/determine-entry-fields.js +15 -17
- package/src/generators/library/lib/normalize-options.js +8 -8
- package/src/generators/library/library.js +49 -32
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +4 -0
- package/src/utils/versions.d.ts +5 -5
- package/src/utils/versions.js +5 -5
package/migrations.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {},
|
|
3
3
|
"packageJsonUpdates": {
|
|
4
|
+
"20.7.1": {
|
|
5
|
+
"version": "20.7.1-beta.0",
|
|
6
|
+
"packages": {
|
|
7
|
+
"vue": {
|
|
8
|
+
"version": "^3.5.13",
|
|
9
|
+
"alwaysAddToPackageJson": false
|
|
10
|
+
},
|
|
11
|
+
"vue-tsc": {
|
|
12
|
+
"version": "^2.2.8",
|
|
13
|
+
"alwaysAddToPackageJson": false
|
|
14
|
+
},
|
|
15
|
+
"vue-router": {
|
|
16
|
+
"version": "^4.5.0",
|
|
17
|
+
"alwaysAddToPackageJson": false
|
|
18
|
+
},
|
|
19
|
+
"@vitejs/plugin-vue": {
|
|
20
|
+
"version": "^5.2.3",
|
|
21
|
+
"alwaysAddToPackageJson": false
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
4
25
|
"19.4.3": {
|
|
5
26
|
"version": "19.4.3-beta.0",
|
|
6
27
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "21.0.0-beta.
|
|
3
|
+
"version": "21.0.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": "21.0.0-beta.
|
|
35
|
-
"@nx/js": "21.0.0-beta.
|
|
36
|
-
"@nx/eslint": "21.0.0-beta.
|
|
37
|
-
"@nx/vite": "21.0.0-beta.
|
|
38
|
-
"@nx/web": "21.0.0-beta.
|
|
34
|
+
"@nx/devkit": "21.0.0-beta.2",
|
|
35
|
+
"@nx/js": "21.0.0-beta.2",
|
|
36
|
+
"@nx/eslint": "21.0.0-beta.2",
|
|
37
|
+
"@nx/vite": "21.0.0-beta.2",
|
|
38
|
+
"@nx/web": "21.0.0-beta.2"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -18,7 +18,11 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
|
18
18
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
19
19
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
20
20
|
function applicationGenerator(tree, options) {
|
|
21
|
-
return applicationGeneratorInternal(tree, {
|
|
21
|
+
return applicationGeneratorInternal(tree, {
|
|
22
|
+
addPlugin: false,
|
|
23
|
+
useProjectJson: true,
|
|
24
|
+
...options,
|
|
25
|
+
});
|
|
22
26
|
}
|
|
23
27
|
async function applicationGeneratorInternal(tree, _options) {
|
|
24
28
|
const tasks = [];
|
|
@@ -36,23 +40,25 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
36
40
|
// If we are using the new TS solution
|
|
37
41
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
38
42
|
if (options.isUsingTsSolutionConfig) {
|
|
39
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
43
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
40
44
|
}
|
|
41
45
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
42
46
|
options.addPlugin ??=
|
|
43
47
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
44
48
|
nxJson.useInferencePlugins !== false;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const packageJson = {
|
|
50
|
+
name: options.importPath,
|
|
51
|
+
version: '0.0.1',
|
|
52
|
+
private: true,
|
|
53
|
+
};
|
|
54
|
+
if (!options.useProjectJson) {
|
|
55
|
+
if (options.projectName !== options.importPath) {
|
|
56
|
+
packageJson.nx = { name: options.projectName };
|
|
57
|
+
}
|
|
58
|
+
if (options.parsedTags?.length) {
|
|
59
|
+
packageJson.nx ??= {};
|
|
60
|
+
packageJson.nx.tags = options.parsedTags;
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
else {
|
|
58
64
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
@@ -63,6 +69,9 @@ async function applicationGeneratorInternal(tree, _options) {
|
|
|
63
69
|
targets: {},
|
|
64
70
|
});
|
|
65
71
|
}
|
|
72
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
73
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
74
|
+
}
|
|
66
75
|
tasks.push(await (0, init_1.vueInitGenerator)(tree, {
|
|
67
76
|
...options,
|
|
68
77
|
skipFormat: true,
|
|
@@ -34,14 +34,29 @@ 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
|
+
const packageJson = {
|
|
38
|
+
name: options.e2eProjectName,
|
|
39
|
+
version: '0.0.1',
|
|
40
|
+
private: true,
|
|
41
|
+
};
|
|
42
|
+
if (!options.useProjectJson) {
|
|
43
|
+
packageJson.nx = {
|
|
44
|
+
implicitDependencies: [options.projectName],
|
|
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
|
+
}
|
|
57
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
58
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
59
|
+
}
|
|
45
60
|
const e2eTask = await configurationGenerator(tree, {
|
|
46
61
|
...options,
|
|
47
62
|
project: options.e2eProjectName,
|
|
@@ -77,13 +92,28 @@ async function addE2e(tree, options) {
|
|
|
77
92
|
}
|
|
78
93
|
case 'playwright': {
|
|
79
94
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
const packageJson = {
|
|
96
|
+
name: options.e2eProjectName,
|
|
97
|
+
version: '0.0.1',
|
|
98
|
+
private: true,
|
|
99
|
+
};
|
|
100
|
+
if (!options.useProjectJson) {
|
|
101
|
+
packageJson.nx = {
|
|
102
|
+
implicitDependencies: [options.projectName],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
107
|
+
projectType: 'application',
|
|
108
|
+
root: options.e2eProjectRoot,
|
|
109
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
110
|
+
targets: {},
|
|
111
|
+
implicitDependencies: [options.projectName],
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
115
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
116
|
+
}
|
|
87
117
|
const e2eTask = await configurationGenerator(tree, {
|
|
88
118
|
...options,
|
|
89
119
|
project: options.e2eProjectName,
|
|
@@ -3,32 +3,32 @@ 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,
|
|
31
30
|
isUsingTsSolutionConfig,
|
|
31
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
32
32
|
};
|
|
33
33
|
normalized.style = options.style ?? 'css';
|
|
34
34
|
normalized.routing = normalized.routing ?? false;
|
|
@@ -21,11 +21,13 @@ export interface Schema {
|
|
|
21
21
|
addPlugin?: boolean;
|
|
22
22
|
nxCloudToken?: string;
|
|
23
23
|
useTsSolution?: boolean;
|
|
24
|
+
useProjectJson?: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export interface NormalizedSchema extends Schema {
|
|
27
|
+
export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
27
28
|
projectName: string;
|
|
28
29
|
appProjectRoot: string;
|
|
30
|
+
importPath: string;
|
|
29
31
|
e2eProjectName: string;
|
|
30
32
|
e2eProjectRoot: string;
|
|
31
33
|
parsedTags: string[];
|
|
@@ -139,6 +139,10 @@
|
|
|
139
139
|
"type": "boolean",
|
|
140
140
|
"default": false,
|
|
141
141
|
"hidden": true
|
|
142
|
+
},
|
|
143
|
+
"useProjectJson": {
|
|
144
|
+
"type": "boolean",
|
|
145
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
142
146
|
}
|
|
143
147
|
},
|
|
144
148
|
"required": ["directory"],
|
|
@@ -15,17 +15,18 @@ function createLibraryFiles(host, options) {
|
|
|
15
15
|
};
|
|
16
16
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files'), options.projectRoot, substitutions);
|
|
17
17
|
if (!options.isUsingTsSolutionConfig &&
|
|
18
|
+
options.useProjectJson &&
|
|
18
19
|
(options.publishable || options.bundler !== 'none')) {
|
|
19
20
|
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
20
|
-
name: options.
|
|
21
|
+
name: options.importPath ?? options.projectName,
|
|
21
22
|
version: '0.0.1',
|
|
22
23
|
main: './index.js',
|
|
23
24
|
types: './index.d.ts',
|
|
24
25
|
exports: {
|
|
25
26
|
'.': {
|
|
27
|
+
types: './index.d.ts',
|
|
26
28
|
import: './index.mjs',
|
|
27
29
|
require: './index.js',
|
|
28
|
-
types: './index.d.ts',
|
|
29
30
|
},
|
|
30
31
|
},
|
|
31
32
|
});
|
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.determineEntryFields = determineEntryFields;
|
|
4
4
|
function determineEntryFields(options) {
|
|
5
|
-
if (options.bundler
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
types: options.js ? './src/index.js' : './src/index.ts',
|
|
9
|
-
exports: {
|
|
10
|
-
'.': options.js
|
|
11
|
-
? './src/index.js'
|
|
12
|
-
: {
|
|
13
|
-
types: './src/index.ts',
|
|
14
|
-
import: './src/index.ts',
|
|
15
|
-
default: './src/index.ts',
|
|
16
|
-
},
|
|
17
|
-
'./package.json': './package.json',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
5
|
+
if (options.bundler !== 'none' || !options.isUsingTsSolutionConfig) {
|
|
6
|
+
// for buildable libraries, the entries are configured by the bundler
|
|
7
|
+
return undefined;
|
|
20
8
|
}
|
|
21
9
|
return {
|
|
22
|
-
module: './
|
|
23
|
-
types: './
|
|
10
|
+
module: options.js ? './src/index.js' : './src/index.ts',
|
|
11
|
+
types: options.js ? './src/index.js' : './src/index.ts',
|
|
12
|
+
exports: {
|
|
13
|
+
'.': options.js
|
|
14
|
+
? './src/index.js'
|
|
15
|
+
: {
|
|
16
|
+
types: './src/index.ts',
|
|
17
|
+
import: './src/index.ts',
|
|
18
|
+
default: './src/index.ts',
|
|
19
|
+
},
|
|
20
|
+
'./package.json': './package.json',
|
|
21
|
+
},
|
|
24
22
|
};
|
|
25
23
|
}
|
|
@@ -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}`,
|
|
@@ -42,6 +39,7 @@ async function normalizeOptions(host, options) {
|
|
|
42
39
|
parsedTags,
|
|
43
40
|
importPath,
|
|
44
41
|
isUsingTsSolutionConfig,
|
|
42
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
45
43
|
};
|
|
46
44
|
// Libraries with a bundler or is publishable must also be buildable.
|
|
47
45
|
normalized.bundler =
|
|
@@ -49,12 +47,14 @@ async function normalizeOptions(host, options) {
|
|
|
49
47
|
normalized.inSourceTests === normalized.minimal || normalized.inSourceTests;
|
|
50
48
|
if (options.appProject) {
|
|
51
49
|
const appProjectConfig = (0, devkit_1.getProjects)(host).get(options.appProject);
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const appProjectType = (0, ts_solution_setup_1.getProjectType)(host, appProjectConfig.root, appProjectConfig.projectType);
|
|
51
|
+
if (appProjectType !== 'application') {
|
|
52
|
+
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
|
54
53
|
}
|
|
54
|
+
const appSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(host, appProjectConfig.sourceRoot, appProjectConfig.root);
|
|
55
55
|
try {
|
|
56
56
|
normalized.appMain = appProjectConfig.targets.build.options.main;
|
|
57
|
-
normalized.appSourceRoot = (0, devkit_1.normalizePath)(
|
|
57
|
+
normalized.appSourceRoot = (0, devkit_1.normalizePath)(appSourceRoot);
|
|
58
58
|
}
|
|
59
59
|
catch (e) {
|
|
60
60
|
throw new Error(`Could not locate project main for ${options.appProject}`);
|
|
@@ -3,53 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
7
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
6
8
|
const js_1 = require("@nx/js");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
+
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
|
10
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
11
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
12
|
+
const use_legacy_versioning_1 = require("nx/src/command-line/release/config/use-legacy-versioning");
|
|
13
|
+
const path_1 = require("path");
|
|
9
14
|
const add_linting_1 = require("../../utils/add-linting");
|
|
10
|
-
const create_library_files_1 = require("./lib/create-library-files");
|
|
11
15
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
16
|
+
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
12
17
|
const component_1 = require("../component/component");
|
|
18
|
+
const init_1 = require("../init/init");
|
|
13
19
|
const add_vite_1 = require("./lib/add-vite");
|
|
14
|
-
const
|
|
15
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
17
|
-
const path_1 = require("path");
|
|
18
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
19
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
20
|
+
const create_library_files_1 = require("./lib/create-library-files");
|
|
20
21
|
const determine_entry_fields_1 = require("./lib/determine-entry-fields");
|
|
21
|
-
const
|
|
22
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
22
23
|
function libraryGenerator(tree, schema) {
|
|
23
|
-
return libraryGeneratorInternal(tree, {
|
|
24
|
+
return libraryGeneratorInternal(tree, {
|
|
25
|
+
addPlugin: false,
|
|
26
|
+
useProjectJson: true,
|
|
27
|
+
...schema,
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
async function libraryGeneratorInternal(tree, schema) {
|
|
26
31
|
const tasks = [];
|
|
27
|
-
tasks.push(await (0, js_1.initGenerator)(tree, { ...schema, skipFormat: true }));
|
|
28
32
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
29
33
|
if (options.publishable === true && !schema.importPath) {
|
|
30
34
|
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
35
|
}
|
|
36
|
+
tasks.push(await (0, js_1.initGenerator)(tree, { ...options, skipFormat: true }));
|
|
32
37
|
// If we are using the new TS solution
|
|
33
38
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
34
39
|
if (options.isUsingTsSolutionConfig) {
|
|
35
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
40
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
let packageJson = {
|
|
43
|
+
name: options.importPath,
|
|
44
|
+
version: '0.0.1',
|
|
45
|
+
};
|
|
46
|
+
if (!options.useProjectJson) {
|
|
47
|
+
packageJson = {
|
|
48
|
+
...packageJson,
|
|
42
49
|
...(0, determine_entry_fields_1.determineEntryFields)(options),
|
|
43
50
|
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
};
|
|
52
|
+
if (options.projectName !== options.importPath) {
|
|
53
|
+
packageJson.nx = { name: options.projectName };
|
|
54
|
+
}
|
|
55
|
+
if (options.parsedTags?.length) {
|
|
56
|
+
packageJson.nx ??= {};
|
|
57
|
+
packageJson.nx.tags = options.parsedTags;
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
else {
|
|
52
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.
|
|
61
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
53
62
|
root: options.projectRoot,
|
|
54
63
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
55
64
|
projectType: 'library',
|
|
@@ -57,6 +66,9 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
57
66
|
targets: {},
|
|
58
67
|
});
|
|
59
68
|
}
|
|
69
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
70
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
|
|
71
|
+
}
|
|
60
72
|
tasks.push(await (0, init_1.vueInitGenerator)(tree, {
|
|
61
73
|
...options,
|
|
62
74
|
skipFormat: true,
|
|
@@ -82,13 +94,6 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
82
94
|
skipFormat: true,
|
|
83
95
|
});
|
|
84
96
|
}
|
|
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
97
|
if (!options.skipTsConfig && !options.isUsingTsSolutionConfig) {
|
|
93
98
|
(0, js_1.addTsConfigPath)(tree, options.importPath, [
|
|
94
99
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
@@ -108,6 +113,18 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
108
113
|
: undefined);
|
|
109
114
|
}
|
|
110
115
|
(0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
|
|
116
|
+
if (options.publishable) {
|
|
117
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
118
|
+
if (options.isUsingTsSolutionConfig) {
|
|
119
|
+
await (0, add_release_config_1.addReleaseConfigForTsSolution)(tree, options.projectName, projectConfig);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
|
123
|
+
await (0, add_release_config_1.addReleaseConfigForNonTsSolution)((0, use_legacy_versioning_1.shouldUseLegacyVersioning)(nxJson.release), tree, options.projectName, projectConfig);
|
|
124
|
+
}
|
|
125
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
126
|
+
tasks.push(await (0, add_release_config_1.releaseTasks)(tree));
|
|
127
|
+
}
|
|
111
128
|
if (!options.skipFormat)
|
|
112
129
|
await (0, devkit_1.formatFiles)(tree);
|
|
113
130
|
// Always run install to link packages.
|
|
@@ -125,6 +125,10 @@
|
|
|
125
125
|
"description": "Create a Vue library with a minimal setup, no separate test files.",
|
|
126
126
|
"type": "boolean",
|
|
127
127
|
"default": false
|
|
128
|
+
},
|
|
129
|
+
"useProjectJson": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
128
132
|
}
|
|
129
133
|
},
|
|
130
134
|
"required": ["directory"]
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const vueVersion = "^3.
|
|
3
|
-
export declare const vueTscVersion = "^2.
|
|
4
|
-
export declare const vueRouterVersion = "^4.
|
|
5
|
-
export declare const vueTestUtilsVersion = "^2.4.
|
|
6
|
-
export declare const vitePluginVueVersion = "^
|
|
2
|
+
export declare const vueVersion = "^3.5.13";
|
|
3
|
+
export declare const vueTscVersion = "^2.2.8";
|
|
4
|
+
export declare const vueRouterVersion = "^4.5.0";
|
|
5
|
+
export declare const vueTestUtilsVersion = "^2.4.6";
|
|
6
|
+
export declare const vitePluginVueVersion = "^5.2.3";
|
|
7
7
|
export declare const vueEslintConfigPrettierVersion = "7.1.0";
|
|
8
8
|
export declare const vueEslintConfigTypescriptVersion = "^11.0.3";
|
|
9
9
|
export declare const eslintPluginVueVersion = "^9.16.1";
|
package/src/utils/versions.js
CHANGED
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.lessVersion = exports.sassVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.eslintPluginVueVersion = exports.vueEslintConfigTypescriptVersion = exports.vueEslintConfigPrettierVersion = exports.vitePluginVueVersion = exports.vueTestUtilsVersion = exports.vueRouterVersion = exports.vueTscVersion = exports.vueVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
// vue core
|
|
6
|
-
exports.vueVersion = '^3.
|
|
7
|
-
exports.vueTscVersion = '^2.
|
|
8
|
-
exports.vueRouterVersion = '^4.
|
|
6
|
+
exports.vueVersion = '^3.5.13';
|
|
7
|
+
exports.vueTscVersion = '^2.2.8';
|
|
8
|
+
exports.vueRouterVersion = '^4.5.0';
|
|
9
9
|
// test deps
|
|
10
|
-
exports.vueTestUtilsVersion = '^2.4.
|
|
11
|
-
exports.vitePluginVueVersion = '^
|
|
10
|
+
exports.vueTestUtilsVersion = '^2.4.6';
|
|
11
|
+
exports.vitePluginVueVersion = '^5.2.3';
|
|
12
12
|
// linting deps
|
|
13
13
|
exports.vueEslintConfigPrettierVersion = '7.1.0';
|
|
14
14
|
exports.vueEslintConfigTypescriptVersion = '^11.0.3';
|