@nx/plugin 0.0.0-pr-30418-4e2b721 → 0.0.0-pr-3-ec41644

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/plugin",
3
- "version": "0.0.0-pr-30418-4e2b721",
3
+ "version": "0.0.0-pr-3-ec41644",
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": "0.0.0-pr-30418-4e2b721",
32
- "@nx/jest": "0.0.0-pr-30418-4e2b721",
33
- "@nx/js": "0.0.0-pr-30418-4e2b721",
34
- "@nx/eslint": "0.0.0-pr-30418-4e2b721"
31
+ "@nx/devkit": "0.0.0-pr-3-ec41644",
32
+ "@nx/jest": "0.0.0-pr-3-ec41644",
33
+ "@nx/js": "0.0.0-pr-3-ec41644",
34
+ "@nx/eslint": "0.0.0-pr-3-ec41644"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -52,14 +52,12 @@ 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();
56
55
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, './files'), options.projectRoot, {
57
56
  ...options,
58
57
  tmpl: '',
59
58
  rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
60
59
  packageManagerCommands: (0, devkit_1.getPackageManagerCommand)(),
61
60
  pluginPackageName,
62
- simplePluginName,
63
61
  });
64
62
  }
65
63
  async function addJest(host, options) {
@@ -72,7 +70,7 @@ async function addJest(host, options) {
72
70
  };
73
71
  if (options.isTsSolutionSetup) {
74
72
  (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
75
- name: options.projectName,
73
+ name: (0, project_name_and_root_utils_1.resolveImportPath)(host, options.projectName, options.projectRoot),
76
74
  version: '0.0.1',
77
75
  private: true,
78
76
  });
@@ -168,7 +166,7 @@ async function e2eProjectGeneratorInternal(host, schema) {
168
166
  // If we are using the new TS solution
169
167
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
170
168
  if (options.isTsSolutionSetup) {
171
- await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
169
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
172
170
  }
173
171
  if (!options.skipFormat) {
174
172
  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.importPath,
60
+ importPath: options.npmPackageName,
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.projectName : options.projectRoot),
95
- npmPackageName: options.importPath,
94
+ pluginOutputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : options.projectRoot),
95
+ npmPackageName: options.npmPackageName,
96
96
  skipFormat: true,
97
97
  rootProject: options.rootProject,
98
98
  linter: options.linter,
@@ -2,12 +2,13 @@ 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;
5
6
  projectName: string;
6
7
  fileName: string;
7
8
  projectRoot: string;
8
9
  projectDirectory: string;
9
10
  parsedTags: string[];
10
- importPath: string;
11
+ npmPackageName: string;
11
12
  bundler: 'swc' | 'tsc';
12
13
  publishable: boolean;
13
14
  unitTestRunner: 'jest' | 'vitest' | 'none';
@@ -5,6 +5,7 @@ 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");
8
9
  async function normalizeOptions(host, options) {
9
10
  const linter = await (0, generator_prompts_1.normalizeLinterOption)(host, options.linter);
10
11
  const unitTestRunner = await (0, generator_prompts_1.normalizeUnitTestRunnerOption)(host, options.unitTestRunner, ['jest', 'vitest']);
@@ -14,8 +15,8 @@ async function normalizeOptions(host, options) {
14
15
  (isTsSolutionSetup &&
15
16
  process.env.NX_ADD_PLUGINS !== 'false' &&
16
17
  nxJson.useInferencePlugins !== false);
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, {
18
+ await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
19
+ const { projectName, projectRoot, importPath: npmPackageName, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
19
20
  name: options.name,
20
21
  projectType: 'library',
21
22
  directory: options.directory,
@@ -31,11 +32,14 @@ async function normalizeOptions(host, options) {
31
32
  ...options,
32
33
  bundler: options.compiler ?? 'tsc',
33
34
  fileName: projectName,
34
- projectName: isTsSolutionSetup && !options.name ? importPath : projectName,
35
+ name: projectName,
36
+ projectName: isTsSolutionSetup
37
+ ? (0, get_import_path_1.getImportPath)(host, projectName)
38
+ : projectName,
35
39
  projectRoot,
36
40
  projectDirectory,
37
41
  parsedTags,
38
- importPath,
42
+ npmPackageName,
39
43
  publishable: options.publishable ?? false,
40
44
  linter,
41
45
  unitTestRunner,