@nx/plugin 20.3.1 → 20.3.3
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/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "20.3.
|
|
3
|
+
"version": "20.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
|
|
6
6
|
"repository": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tslib": "^2.3.0",
|
|
31
|
-
"@nx/devkit": "20.3.
|
|
32
|
-
"@nx/jest": "20.3.
|
|
33
|
-
"@nx/js": "20.3.
|
|
34
|
-
"@nx/eslint": "20.3.
|
|
31
|
+
"@nx/devkit": "20.3.3",
|
|
32
|
+
"@nx/jest": "20.3.3",
|
|
33
|
+
"@nx/js": "20.3.3",
|
|
34
|
+
"@nx/eslint": "20.3.3"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -4,7 +4,6 @@ exports.createPackageGenerator = createPackageGenerator;
|
|
|
4
4
|
exports.createPackageGeneratorInternal = createPackageGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
|
|
8
7
|
const add_tslib_dependencies_1 = require("@nx/js/src/utils/typescript/add-tslib-dependencies");
|
|
9
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
9
|
const versions_1 = require("@nx/js/src/utils/versions");
|
|
@@ -31,19 +30,14 @@ async function createPackageGeneratorInternal(host, schema) {
|
|
|
31
30
|
'create-nx-workspace': versions_2.nxVersion,
|
|
32
31
|
}, {});
|
|
33
32
|
tasks.push(installTask);
|
|
34
|
-
await createCliPackage(host, options, pluginPackageName);
|
|
33
|
+
const cliPackageTask = await createCliPackage(host, options, pluginPackageName);
|
|
34
|
+
tasks.push(cliPackageTask);
|
|
35
35
|
if (options.e2eProject) {
|
|
36
36
|
addE2eProject(host, options);
|
|
37
37
|
}
|
|
38
38
|
if (!options.skipFormat) {
|
|
39
39
|
await (0, devkit_1.formatFiles)(host);
|
|
40
40
|
}
|
|
41
|
-
if (options.isTsSolutionSetup) {
|
|
42
|
-
const projectPackageManagerWorkspaceState = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(host, options.projectRoot);
|
|
43
|
-
if (projectPackageManagerWorkspaceState !== 'included') {
|
|
44
|
-
tasks.push((0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, host.root));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
41
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
@@ -66,7 +60,7 @@ async function addPresetGenerator(host, schema) {
|
|
|
66
60
|
return (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'))?.name;
|
|
67
61
|
}
|
|
68
62
|
async function createCliPackage(host, options, pluginPackageName) {
|
|
69
|
-
await (0, js_1.libraryGenerator)(host, {
|
|
63
|
+
const jsLibraryTask = await (0, js_1.libraryGenerator)(host, {
|
|
70
64
|
...options,
|
|
71
65
|
directory: options.directory,
|
|
72
66
|
rootProject: false,
|
|
@@ -77,7 +71,6 @@ async function createCliPackage(host, options, pluginPackageName) {
|
|
|
77
71
|
skipFormat: true,
|
|
78
72
|
skipTsConfig: true,
|
|
79
73
|
useTscExecutor: true,
|
|
80
|
-
skipWorkspacesWarning: true,
|
|
81
74
|
});
|
|
82
75
|
host.delete((0, devkit_1.joinPathFragments)(options.projectRoot, 'src'));
|
|
83
76
|
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
@@ -126,6 +119,7 @@ async function createCliPackage(host, options, pluginPackageName) {
|
|
|
126
119
|
preset: pluginPackageName,
|
|
127
120
|
tmpl: '',
|
|
128
121
|
});
|
|
122
|
+
return jsLibraryTask;
|
|
129
123
|
}
|
|
130
124
|
/**
|
|
131
125
|
* Add a test file to plugin e2e project
|
|
@@ -10,7 +10,6 @@ const js_1 = require("@nx/js");
|
|
|
10
10
|
const generator_1 = require("@nx/js/src/generators/setup-verdaccio/generator");
|
|
11
11
|
const add_local_registry_scripts_1 = require("@nx/js/src/utils/add-local-registry-scripts");
|
|
12
12
|
const generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
|
|
13
|
-
const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
|
|
14
13
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
14
|
const path_1 = require("path");
|
|
16
15
|
async function normalizeOptions(host, options) {
|
|
@@ -163,15 +162,14 @@ async function e2eProjectGeneratorInternal(host, schema) {
|
|
|
163
162
|
return json;
|
|
164
163
|
});
|
|
165
164
|
}
|
|
165
|
+
// If we are using the new TS solution
|
|
166
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
167
|
+
if (options.isTsSolutionSetup) {
|
|
168
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
169
|
+
}
|
|
166
170
|
if (!options.skipFormat) {
|
|
167
171
|
await (0, devkit_1.formatFiles)(host);
|
|
168
172
|
}
|
|
169
|
-
if (options.isTsSolutionSetup && !options.skipWorkspacesWarning) {
|
|
170
|
-
const projectPackageManagerWorkspaceState = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(host, options.projectRoot);
|
|
171
|
-
if (projectPackageManagerWorkspaceState !== 'included') {
|
|
172
|
-
tasks.push((0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, host.root));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
173
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
176
174
|
}
|
|
177
175
|
exports.default = e2eProjectGenerator;
|
|
@@ -5,7 +5,6 @@ exports.pluginGeneratorInternal = pluginGeneratorInternal;
|
|
|
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 package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
|
|
9
8
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
10
9
|
const add_tslib_dependencies_1 = require("@nx/js/src/utils/typescript/add-tslib-dependencies");
|
|
11
10
|
const path = require("path");
|
|
@@ -63,9 +62,14 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
63
62
|
useProjectJson: options.useProjectJson,
|
|
64
63
|
addPlugin: options.addPlugin,
|
|
65
64
|
skipFormat: true,
|
|
66
|
-
skipWorkspacesWarning: true,
|
|
67
65
|
useTscExecutor: true,
|
|
68
66
|
}));
|
|
67
|
+
if (options.isTsSolutionSetup) {
|
|
68
|
+
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
69
|
+
delete json.type;
|
|
70
|
+
return json;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
69
73
|
if (options.bundler === 'tsc') {
|
|
70
74
|
tasks.push((0, add_tslib_dependencies_1.addTsLibDependencies)(host));
|
|
71
75
|
}
|
|
@@ -93,7 +97,6 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
93
97
|
linter: options.linter,
|
|
94
98
|
useProjectJson: options.useProjectJson,
|
|
95
99
|
addPlugin: options.addPlugin,
|
|
96
|
-
skipWorkspacesWarning: true,
|
|
97
100
|
}));
|
|
98
101
|
}
|
|
99
102
|
if (options.linter === eslint_1.Linter.EsLint && !options.skipLintChecks) {
|
|
@@ -102,12 +105,6 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
102
105
|
if (!options.skipFormat) {
|
|
103
106
|
await (0, devkit_1.formatFiles)(host);
|
|
104
107
|
}
|
|
105
|
-
if (options.isTsSolutionSetup) {
|
|
106
|
-
const projectPackageManagerWorkspaceState = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(host, options.projectRoot);
|
|
107
|
-
if (projectPackageManagerWorkspaceState !== 'included') {
|
|
108
|
-
tasks.push((0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, host.root));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
108
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
112
109
|
}
|
|
113
110
|
exports.default = pluginGenerator;
|