@nx/js 21.3.0-beta.2 → 21.3.0-beta.4

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": "21.3.0-beta.2",
3
+ "version": "21.3.0-beta.4",
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": "21.3.0-beta.2",
43
- "@nx/workspace": "21.3.0-beta.2",
42
+ "@nx/devkit": "21.3.0-beta.4",
43
+ "@nx/workspace": "21.3.0-beta.4",
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",
@@ -188,9 +188,10 @@ To fix this you will either need to add a package.json file at that location, or
188
188
  // We always need to independently resolve the current version from git tag per project if the projects are independent
189
189
  options.releaseGroup.projectsRelationship === 'independent') {
190
190
  const releaseTagPattern = options.releaseGroup.releaseTagPattern;
191
+ const releaseTagPatternRequireSemver = options.releaseGroup.releaseTagPatternRequireSemver;
191
192
  latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
192
193
  projectName: project.name,
193
- }, options.releaseGroup.releaseTagPatternCheckAllBranchesWhen);
194
+ }, options.releaseGroup.releaseTagPatternCheckAllBranchesWhen, releaseTagPatternRequireSemver ?? true);
194
195
  if (!latestMatchingGitTag) {
195
196
  if (options.fallbackCurrentVersionResolver === 'disk') {
196
197
  if (!currentVersionFromDisk &&
@@ -5,12 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
6
6
  const posix_1 = require("node:path/posix");
7
7
  const devkit_internals_1 = require("nx/src/devkit-internals");
8
- const plugin_1 = require("../../utils/typescript/plugin");
9
8
  const get_import_path_1 = require("../../utils/get-import-path");
10
9
  const update_package_json_1 = require("../../utils/package-json/update-package-json");
11
10
  const add_swc_config_1 = require("../../utils/swc/add-swc-config");
12
11
  const add_swc_dependencies_1 = require("../../utils/swc/add-swc-dependencies");
13
12
  const ensure_typescript_1 = require("../../utils/typescript/ensure-typescript");
13
+ const plugin_1 = require("../../utils/typescript/plugin");
14
14
  const ts_config_1 = require("../../utils/typescript/ts-config");
15
15
  const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
16
16
  const versions_1 = require("../../utils/versions");
@@ -29,7 +29,7 @@ async function setupBuildGenerator(tree, options) {
29
29
  mainFile = options.main;
30
30
  }
31
31
  else {
32
- const root = project.sourceRoot ?? project.root;
32
+ const root = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
33
33
  for (const f of [
34
34
  (0, devkit_1.joinPathFragments)(root, 'main.ts'),
35
35
  (0, devkit_1.joinPathFragments)(root, 'main.js'),
@@ -7,6 +7,7 @@ exports.getRootTsConfigPath = getRootTsConfigPath;
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const path_1 = require("path");
10
+ const ts_solution_setup_1 = require("./typescript/ts-solution-setup");
10
11
  function isInlineGraphEmpty(inlineGraph) {
11
12
  return Object.keys(inlineGraph.nodes).length === 0;
12
13
  }
@@ -72,7 +73,7 @@ function projectNodeToInlineProjectNode(projectNode, pathAlias = '', buildOutput
72
73
  return {
73
74
  name: projectNode.name,
74
75
  root: projectNode.data.root,
75
- sourceRoot: projectNode.data.sourceRoot,
76
+ sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data),
76
77
  pathAlias,
77
78
  buildOutputPath,
78
79
  };
@@ -1,4 +1,4 @@
1
- import { type Tree } from '@nx/devkit';
1
+ import { type ProjectConfiguration, type Tree } from '@nx/devkit';
2
2
  export declare function isUsingTypeScriptPlugin(tree: Tree): boolean;
3
3
  export declare function isUsingTsSolutionSetup(tree?: Tree): boolean;
4
4
  export declare function assertNotUsingTsSolutionSetup(tree: Tree, pluginName: string, generatorName: string): void;
@@ -6,4 +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): Promise<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;
9
+ export declare function getProjectSourceRoot(project: ProjectConfiguration, tree?: Tree): string;
@@ -9,6 +9,7 @@ exports.addProjectToTsSolutionWorkspace = addProjectToTsSolutionWorkspace;
9
9
  exports.getProjectType = getProjectType;
10
10
  exports.getProjectSourceRoot = getProjectSourceRoot;
11
11
  const devkit_1 = require("@nx/devkit");
12
+ const node_fs_1 = require("node:fs");
12
13
  const posix_1 = require("node:path/posix");
13
14
  const tree_1 = require("nx/src/generators/tree");
14
15
  const package_manager_workspaces_1 = require("../package-manager-workspaces");
@@ -206,9 +207,15 @@ function getProjectType(tree, projectRoot, projectType) {
206
207
  return 'application';
207
208
  return 'library';
208
209
  }
209
- function getProjectSourceRoot(tree, projectSourceRoot, projectRoot) {
210
- return (projectSourceRoot ??
211
- (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'src'))
212
- ? (0, devkit_1.joinPathFragments)(projectRoot, 'src')
213
- : projectRoot));
210
+ function getProjectSourceRoot(project, tree) {
211
+ if (tree) {
212
+ return (project.sourceRoot ??
213
+ (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'src'))
214
+ ? (0, devkit_1.joinPathFragments)(project.root, 'src')
215
+ : project.root));
216
+ }
217
+ return (project.sourceRoot ??
218
+ ((0, node_fs_1.existsSync)((0, posix_1.join)(devkit_1.workspaceRoot, project.root, 'src'))
219
+ ? (0, devkit_1.joinPathFragments)(project.root, 'src')
220
+ : project.root));
214
221
  }