@nx/workspace 0.0.0-pr-29705-bc2a0dd → 0.0.0-pr-29705-2a402a9

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/workspace",
3
- "version": "0.0.0-pr-29705-bc2a0dd",
3
+ "version": "0.0.0-pr-29705-2a402a9",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -38,12 +38,12 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "0.0.0-pr-29705-bc2a0dd",
41
+ "@nx/devkit": "0.0.0-pr-29705-2a402a9",
42
42
  "chalk": "^4.1.0",
43
43
  "enquirer": "~2.3.6",
44
44
  "tslib": "^2.3.0",
45
45
  "yargs-parser": "21.1.1",
46
- "nx": "0.0.0-pr-29705-bc2a0dd"
46
+ "nx": "0.0.0-pr-29705-2a402a9"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeSchema = normalizeSchema;
4
- const devkit_1 = require("@nx/devkit");
5
4
  const get_import_path_1 = require("../../../utilities/get-import-path");
6
5
  const utils_1 = require("./utils");
7
6
  const ts_solution_setup_1 = require("../../../utils/ts-solution-setup");
@@ -37,8 +36,7 @@ function validateName(tree, name, projectConfiguration) {
37
36
  const libraryPattern = '(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$';
38
37
  const appPattern = '^[a-zA-Z][^:]*$';
39
38
  const projectType = (0, ts_solution_setup_1.getProjectType)(tree, projectConfiguration.root, projectConfiguration.projectType);
40
- if (projectType === 'application' ||
41
- tree.exists((0, devkit_1.joinPathFragments)(projectConfiguration.root, 'tsconfig.app.json'))) {
39
+ if (projectType === 'application') {
42
40
  const validationRegex = new RegExp(appPattern);
43
41
  if (!validationRegex.test(name)) {
44
42
  throw new Error(`The new project name should match the pattern "${appPattern}". The provided value "${name}" does not match.`);
@@ -11,8 +11,11 @@ function getProjectType(tree, projectRoot, projectType) {
11
11
  if ((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.app.json'))
12
12
  return 'application';
13
13
  // If there are no exports, assume it is an application since both buildable and non-buildable libraries have exports.
14
- const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'));
15
- if (packageJson.exports)
16
- return 'library';
17
- return 'application';
14
+ const packageJsonPath = (0, devkit_1.joinPathFragments)(projectRoot, 'package.json');
15
+ const packageJson = tree.exists(packageJsonPath)
16
+ ? (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'))
17
+ : null;
18
+ if (!packageJson?.exports)
19
+ return 'application';
20
+ return 'library';
18
21
  }