@nx/plugin 21.5.0-beta.0 → 21.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/plugin",
3
- "version": "21.5.0-beta.0",
3
+ "version": "21.5.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,13 +28,13 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "tslib": "^2.3.0",
31
- "@nx/devkit": "21.5.0-beta.0",
32
- "@nx/jest": "21.5.0-beta.0",
33
- "@nx/js": "21.5.0-beta.0",
34
- "@nx/eslint": "21.5.0-beta.0"
31
+ "@nx/devkit": "21.5.0-beta.2",
32
+ "@nx/jest": "21.5.0-beta.2",
33
+ "@nx/js": "21.5.0-beta.2",
34
+ "@nx/eslint": "21.5.0-beta.2"
35
35
  },
36
36
  "devDependencies": {
37
- "nx": "21.5.0-beta.0"
37
+ "nx": "21.5.0-beta.2"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/executor/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAmCvC,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,iBAsBzB;AAqHD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAajE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/executor/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAmCvC,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,iBAsBzB;AAsID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAajE;AAED,eAAe,iBAAiB,CAAC"}
@@ -84,12 +84,25 @@ async function updateExecutorJson(host, options) {
84
84
  });
85
85
  }
86
86
  async function normalizeOptions(tree, options) {
87
- const { artifactName: name, directory, fileName, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
87
+ const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
88
88
  path: options.path,
89
89
  name: options.name,
90
90
  allowedFileExtensions: ['ts'],
91
91
  fileExtension: 'ts',
92
92
  });
93
+ // Check if the path looks like a directory path (doesn't end with a filename)
94
+ // If so, include the artifact name as a subdirectory
95
+ let directory = initialDirectory;
96
+ const normalizedPath = options.path.replace(/^\.?\//, '').replace(/\/$/, '');
97
+ const pathSegments = normalizedPath.split('/');
98
+ const lastSegment = pathSegments[pathSegments.length - 1];
99
+ // If the last segment doesn't end with a known file extension and matches the artifact name,
100
+ // it's likely a directory path, so we should create a subdirectory
101
+ const knownFileExtensions = ['.ts', '.js', '.jsx', '.tsx'];
102
+ const hasKnownFileExtension = knownFileExtensions.some((ext) => lastSegment.endsWith(ext));
103
+ if (!hasKnownFileExtension && lastSegment === name) {
104
+ directory = (0, devkit_1.joinPathFragments)(initialDirectory, name);
105
+ }
93
106
  const { className, propertyName } = (0, devkit_1.names)(name);
94
107
  const { root: projectRoot, sourceRoot: projectSourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
95
108
  let description;
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,IAAI,EAGL,MAAM,YAAY,CAAC;AASpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA0EvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,UAAU,CAAC,EAAE,OAAO,iBAuBrB;AA2ED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAalE;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,IAAI,EAGL,MAAM,YAAY,CAAC;AASpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2FvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,UAAU,CAAC,EAAE,OAAO,iBAuBrB;AA2ED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAalE;AAED,eAAe,kBAAkB,CAAC"}
@@ -11,12 +11,25 @@ const paths_1 = require("../../utils/paths");
11
11
  const versions_1 = require("../../utils/versions");
12
12
  const generator_1 = require("../lint-checks/generator");
13
13
  async function normalizeOptions(tree, options) {
14
- const { artifactName: name, directory, fileName, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
14
+ const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
15
15
  path: options.path,
16
16
  name: options.name,
17
17
  allowedFileExtensions: ['ts'],
18
18
  fileExtension: 'ts',
19
19
  });
20
+ // Check if the path looks like a directory path (doesn't end with a filename)
21
+ // If so, include the artifact name as a subdirectory
22
+ let directory = initialDirectory;
23
+ const normalizedPath = options.path.replace(/^\.?\//, '').replace(/\/$/, '');
24
+ const pathSegments = normalizedPath.split('/');
25
+ const lastSegment = pathSegments[pathSegments.length - 1];
26
+ // If the last segment doesn't end with a known file extension and matches the artifact name,
27
+ // it's likely a directory path, so we should create a subdirectory
28
+ const knownFileExtensions = ['.ts', '.js', '.jsx', '.tsx'];
29
+ const hasKnownFileExtension = knownFileExtensions.some((ext) => lastSegment.endsWith(ext));
30
+ if (!hasKnownFileExtension && lastSegment === name) {
31
+ directory = (0, devkit_1.joinPathFragments)(initialDirectory, name);
32
+ }
20
33
  const { className, propertyName } = (0, devkit_1.names)(name);
21
34
  const { root: projectRoot, sourceRoot: projectSourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
22
35
  let description;