@nx/plugin 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/package.json +5 -5
- package/src/generators/e2e-project/e2e.js +4 -2
- package/src/generators/plugin/plugin.js +3 -3
- package/src/generators/plugin/utils/normalize-schema.d.ts +1 -2
- package/src/generators/plugin/utils/normalize-schema.js +4 -8
- /package/src/generators/e2e-project/files/src/{__pluginName__.spec.ts__tmpl__ → __simplePluginName__.spec.ts__tmpl__} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "21.0.0-beta.
|
|
3
|
+
"version": "21.0.0-beta.2",
|
|
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": "21.0.0-beta.
|
|
32
|
-
"@nx/jest": "21.0.0-beta.
|
|
33
|
-
"@nx/js": "21.0.0-beta.
|
|
34
|
-
"@nx/eslint": "21.0.0-beta.
|
|
31
|
+
"@nx/devkit": "21.0.0-beta.2",
|
|
32
|
+
"@nx/jest": "21.0.0-beta.2",
|
|
33
|
+
"@nx/js": "21.0.0-beta.2",
|
|
34
|
+
"@nx/eslint": "21.0.0-beta.2"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -52,12 +52,14 @@ function validatePlugin(host, pluginName) {
|
|
|
52
52
|
function addFiles(host, options) {
|
|
53
53
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.pluginName);
|
|
54
54
|
const { name: pluginPackageName } = (0, devkit_1.readJson)(host, (0, path_1.join)(projectConfiguration.root, 'package.json'));
|
|
55
|
+
const simplePluginName = options.pluginName.split('/').pop();
|
|
55
56
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, './files'), options.projectRoot, {
|
|
56
57
|
...options,
|
|
57
58
|
tmpl: '',
|
|
58
59
|
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
|
|
59
60
|
packageManagerCommands: (0, devkit_1.getPackageManagerCommand)(),
|
|
60
61
|
pluginPackageName,
|
|
62
|
+
simplePluginName,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
async function addJest(host, options) {
|
|
@@ -70,7 +72,7 @@ async function addJest(host, options) {
|
|
|
70
72
|
};
|
|
71
73
|
if (options.isTsSolutionSetup) {
|
|
72
74
|
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
73
|
-
name:
|
|
75
|
+
name: options.projectName,
|
|
74
76
|
version: '0.0.1',
|
|
75
77
|
private: true,
|
|
76
78
|
});
|
|
@@ -166,7 +168,7 @@ async function e2eProjectGeneratorInternal(host, schema) {
|
|
|
166
168
|
// If we are using the new TS solution
|
|
167
169
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
168
170
|
if (options.isTsSolutionSetup) {
|
|
169
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
171
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
170
172
|
}
|
|
171
173
|
if (!options.skipFormat) {
|
|
172
174
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -57,7 +57,7 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
57
57
|
config: 'project',
|
|
58
58
|
bundler: options.bundler,
|
|
59
59
|
publishable: options.publishable,
|
|
60
|
-
importPath: options.
|
|
60
|
+
importPath: options.importPath,
|
|
61
61
|
linter: options.linter,
|
|
62
62
|
unitTestRunner: options.unitTestRunner,
|
|
63
63
|
useProjectJson: options.useProjectJson,
|
|
@@ -91,8 +91,8 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
91
91
|
tasks.push(await (0, e2e_1.e2eProjectGenerator)(host, {
|
|
92
92
|
pluginName: options.projectName,
|
|
93
93
|
projectDirectory: options.projectDirectory,
|
|
94
|
-
pluginOutputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.
|
|
95
|
-
npmPackageName: options.
|
|
94
|
+
pluginOutputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.projectName : options.projectRoot),
|
|
95
|
+
npmPackageName: options.importPath,
|
|
96
96
|
skipFormat: true,
|
|
97
97
|
rootProject: options.rootProject,
|
|
98
98
|
linter: options.linter,
|
|
@@ -2,13 +2,12 @@ import { type Tree } from '@nx/devkit';
|
|
|
2
2
|
import type { LinterType } from '@nx/eslint';
|
|
3
3
|
import type { Schema } from '../schema';
|
|
4
4
|
export interface NormalizedSchema extends Schema {
|
|
5
|
-
name: string;
|
|
6
5
|
projectName: string;
|
|
7
6
|
fileName: string;
|
|
8
7
|
projectRoot: string;
|
|
9
8
|
projectDirectory: string;
|
|
10
9
|
parsedTags: string[];
|
|
11
|
-
|
|
10
|
+
importPath: string;
|
|
12
11
|
bundler: 'swc' | 'tsc';
|
|
13
12
|
publishable: boolean;
|
|
14
13
|
unitTestRunner: 'jest' | 'vitest' | 'none';
|
|
@@ -5,7 +5,6 @@ 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 generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
9
8
|
async function normalizeOptions(host, options) {
|
|
10
9
|
const linter = await (0, generator_prompts_1.normalizeLinterOption)(host, options.linter);
|
|
11
10
|
const unitTestRunner = await (0, generator_prompts_1.normalizeUnitTestRunnerOption)(host, options.unitTestRunner, ['jest', 'vitest']);
|
|
@@ -15,8 +14,8 @@ async function normalizeOptions(host, options) {
|
|
|
15
14
|
(isTsSolutionSetup &&
|
|
16
15
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
16
|
nxJson.useInferencePlugins !== false);
|
|
18
|
-
await (0, project_name_and_root_utils_1.
|
|
19
|
-
const { projectName, projectRoot, importPath
|
|
17
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
|
18
|
+
const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
20
19
|
name: options.name,
|
|
21
20
|
projectType: 'library',
|
|
22
21
|
directory: options.directory,
|
|
@@ -32,14 +31,11 @@ async function normalizeOptions(host, options) {
|
|
|
32
31
|
...options,
|
|
33
32
|
bundler: options.compiler ?? 'tsc',
|
|
34
33
|
fileName: projectName,
|
|
35
|
-
name: projectName,
|
|
36
|
-
projectName: isTsSolutionSetup
|
|
37
|
-
? (0, get_import_path_1.getImportPath)(host, projectName)
|
|
38
|
-
: projectName,
|
|
34
|
+
projectName: isTsSolutionSetup && !options.name ? importPath : projectName,
|
|
39
35
|
projectRoot,
|
|
40
36
|
projectDirectory,
|
|
41
37
|
parsedTags,
|
|
42
|
-
|
|
38
|
+
importPath,
|
|
43
39
|
publishable: options.publishable ?? false,
|
|
44
40
|
linter,
|
|
45
41
|
unitTestRunner,
|