@nx/devkit 16.8.0-beta.5 → 16.8.0-beta.7

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/devkit",
3
- "version": "16.8.0-beta.5",
3
+ "version": "16.8.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more.",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://nx.dev",
30
30
  "dependencies": {
31
- "@nrwl/devkit": "16.8.0-beta.5",
31
+ "@nrwl/devkit": "16.8.0-beta.7",
32
32
  "ejs": "^3.1.7",
33
33
  "enquirer": "~2.3.6",
34
34
  "ignore": "^5.0.4",
@@ -46,5 +46,5 @@
46
46
  "migrations": "./migrations.json"
47
47
  },
48
48
  "type": "commonjs",
49
- "gitHead": "ad2d1e8a55b2d1b358bb5e7483343d9757ff2c53"
49
+ "gitHead": "6175b0f2033a80504bdc79d6212de9377843d787"
50
50
  }
@@ -10,7 +10,9 @@ async function determineProjectNameAndRootOptions(tree, options) {
10
10
  validateName(options.name, options.projectNameAndRootFormat);
11
11
  const formats = getProjectNameAndRootFormats(tree, options);
12
12
  const format = options.projectNameAndRootFormat ??
13
- (await determineFormat(tree, formats, options.callingGenerator));
13
+ (getDefaultProjectNameAndRootFormat(tree) === 'as-provided'
14
+ ? 'as-provided'
15
+ : await determineFormat(tree, formats, options.callingGenerator));
14
16
  return {
15
17
  ...formats[format],
16
18
  projectNameAndRootFormat: format,
@@ -79,11 +81,7 @@ async function determineFormat(tree, formats, callingGenerator) {
79
81
  initial: true,
80
82
  });
81
83
  if (saveDefault) {
82
- const nxJson = readNxJson(tree);
83
- nxJson.generators ??= {};
84
- nxJson.generators[callingGenerator] ??= {};
85
- nxJson.generators[callingGenerator].projectNameAndRootFormat = result;
86
- updateNxJson(tree, nxJson);
84
+ setProjectNameAndRootFormatDefault(tree);
87
85
  }
88
86
  else {
89
87
  logger.warn(deprecationWarning);
@@ -95,6 +93,16 @@ async function determineFormat(tree, formats, callingGenerator) {
95
93
  }
96
94
  return result;
97
95
  }
96
+ function setProjectNameAndRootFormatDefault(tree) {
97
+ const nxJson = readNxJson(tree);
98
+ nxJson.workspaceLayout ??= {};
99
+ nxJson.workspaceLayout.projectNameAndRootFormat = 'as-provided';
100
+ updateNxJson(tree, nxJson);
101
+ }
102
+ function getDefaultProjectNameAndRootFormat(tree) {
103
+ const nxJson = readNxJson(tree);
104
+ return nxJson.workspaceLayout?.projectNameAndRootFormat ?? 'derived';
105
+ }
98
106
  function getProjectNameAndRootFormats(tree, options) {
99
107
  const name = (0, names_1.names)(options.name).fileName;
100
108
  const directory = options.directory