nx 19.3.0 → 19.4.0-canary.20240614-fbd7f80

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,20 +73,24 @@ function buildProjectConfigurationFromPackageJson(packageJson, workspaceRoot, pa
73
73
  throw new Error('Nx requires the root package.json to specify a name if it is being used as an Nx project.');
74
74
  }
75
75
  let name = packageJson.name ?? (0, to_project_name_1.toProjectName)(normalizedPath);
76
- const projectType = nxJson?.workspaceLayout?.appsDir != nxJson?.workspaceLayout?.libsDir &&
77
- nxJson?.workspaceLayout?.appsDir &&
78
- projectRoot.startsWith(nxJson.workspaceLayout.appsDir)
79
- ? 'application'
80
- : 'library';
81
- return {
76
+ const projectConfiguration = {
82
77
  root: projectRoot,
83
78
  sourceRoot: projectRoot,
84
79
  name,
85
- projectType,
86
80
  ...packageJson.nx,
87
81
  targets: (0, package_json_1.readTargetsFromPackageJson)(packageJson),
88
82
  metadata: (0, package_json_1.getMetadataFromPackageJson)(packageJson),
89
83
  };
84
+ if (nxJson?.workspaceLayout?.appsDir != nxJson?.workspaceLayout?.libsDir &&
85
+ nxJson?.workspaceLayout?.appsDir &&
86
+ projectRoot.startsWith(nxJson.workspaceLayout.appsDir)) {
87
+ projectConfiguration.projectType = 'application';
88
+ }
89
+ else if (typeof nxJson?.workspaceLayout?.libsDir !== 'undefined' &&
90
+ projectRoot.startsWith(nxJson.workspaceLayout.libsDir)) {
91
+ projectConfiguration.projectType = 'library';
92
+ }
93
+ return projectConfiguration;
90
94
  }
91
95
  exports.buildProjectConfigurationFromPackageJson = buildProjectConfigurationFromPackageJson;
92
96
  /**