@nx/js 20.5.0-rc.3 → 20.5.0

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/js",
3
- "version": "20.5.0-rc.3",
3
+ "version": "20.5.0",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "20.5.0-rc.3",
43
- "@nx/workspace": "20.5.0-rc.3",
42
+ "@nx/devkit": "20.5.0",
43
+ "@nx/workspace": "20.5.0",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^3.1.0",
@@ -22,7 +22,6 @@ const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
22
22
  const versions_1 = require("../../utils/versions");
23
23
  const init_1 = require("../init/init");
24
24
  const sort_fields_1 = require("../../utils/package-json/sort-fields");
25
- const get_import_path_1 = require("../../utils/get-import-path");
26
25
  const add_release_config_1 = require("./utils/add-release-config");
27
26
  const defaultOutputDirectory = 'dist';
28
27
  async function libraryGenerator(tree, schema) {
@@ -236,9 +235,7 @@ async function configureProject(tree, options) {
236
235
  }
237
236
  }
238
237
  // empty targets are cleaned up automatically by `updateProjectConfiguration`
239
- (0, devkit_1.updateProjectConfiguration)(tree, options.isUsingTsSolutionConfig
240
- ? options.importPath ?? options.name
241
- : options.name, projectConfiguration);
238
+ (0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfiguration);
242
239
  }
243
240
  else if (options.config === 'workspace' || options.config === 'project') {
244
241
  (0, devkit_1.addProjectConfiguration)(tree, options.name, projectConfiguration);
@@ -468,6 +465,11 @@ function createFiles(tree, options) {
468
465
  format: ['esm'],
469
466
  });
470
467
  }
468
+ if (!options.useProjectJson && options.name !== options.importPath) {
469
+ packageJson.nx = {
470
+ name: options.name,
471
+ };
472
+ }
471
473
  (0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
472
474
  }
473
475
  if (options.config === 'npm-scripts') {
@@ -527,7 +529,7 @@ function replaceJestConfig(tree, options) {
527
529
  });
528
530
  }
529
531
  async function normalizeOptions(tree, options) {
530
- await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'library');
532
+ await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
531
533
  const nxJson = (0, devkit_1.readNxJson)(tree);
532
534
  options.addPlugin ??=
533
535
  process.env.NX_ADD_PLUGINS !== 'false' &&
@@ -629,9 +631,7 @@ async function normalizeOptions(tree, options) {
629
631
  return {
630
632
  ...options,
631
633
  fileName,
632
- name: isUsingTsSolutionConfig
633
- ? (0, get_import_path_1.getImportPath)(tree, projectName)
634
- : projectName,
634
+ name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
635
635
  projectNames,
636
636
  projectRoot,
637
637
  parsedTags,
@@ -6,3 +6,4 @@ export declare function findRuntimeTsConfigName(projectRoot: string, tree?: Tree
6
6
  export declare function updateTsconfigFiles(tree: Tree, projectRoot: string, runtimeTsconfigFileName: string, compilerOptions: Record<string, string | boolean | string[]>, exclude?: string[], rootDir?: string): void;
7
7
  export declare function addProjectToTsSolutionWorkspace(tree: Tree, projectDir: string): void;
8
8
  export declare function getProjectType(tree: Tree, projectRoot: string, projectType?: 'library' | 'application'): 'library' | 'application';
9
+ export declare function getProjectSourceRoot(tree: Tree, projectSourceRoot: string | undefined, projectRoot: string): string | undefined;
@@ -7,6 +7,7 @@ exports.findRuntimeTsConfigName = findRuntimeTsConfigName;
7
7
  exports.updateTsconfigFiles = updateTsconfigFiles;
8
8
  exports.addProjectToTsSolutionWorkspace = addProjectToTsSolutionWorkspace;
9
9
  exports.getProjectType = getProjectType;
10
+ exports.getProjectSourceRoot = getProjectSourceRoot;
10
11
  const devkit_1 = require("@nx/devkit");
11
12
  const posix_1 = require("node:path/posix");
12
13
  const tree_1 = require("nx/src/generators/tree");
@@ -192,3 +193,9 @@ function getProjectType(tree, projectRoot, projectType) {
192
193
  return 'application';
193
194
  return 'library';
194
195
  }
196
+ function getProjectSourceRoot(tree, projectSourceRoot, projectRoot) {
197
+ return (projectSourceRoot ??
198
+ (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'src'))
199
+ ? (0, devkit_1.joinPathFragments)(projectRoot, 'src')
200
+ : projectRoot));
201
+ }