@nx/devkit 17.3.0 → 17.3.1

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/nx.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireNx = void 0;
4
- // After Nx v18, this can be removed and replaced with either:
4
+ // After Nx v19, this can be removed and replaced with either:
5
5
  // - import {} from 'nx/src/devkit-exports'
6
6
  // - import {} from 'nx/src/devkit-internals'
7
7
  function requireNx() {
@@ -9,7 +9,7 @@ function requireNx() {
9
9
  try {
10
10
  result = {
11
11
  ...result,
12
- // Remove in Nx v18, devkit should not support Nx v16.0.2 at that point.
12
+ // Remove in Nx v19, devkit should not support Nx v16.0.2 at that point.
13
13
  ...require('nx/src/devkit-internals'),
14
14
  };
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "17.3.0",
3
+ "version": "17.3.1",
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. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "tslib": "^2.3.0",
36
36
  "semver": "7.5.3",
37
37
  "yargs-parser": "21.1.1",
38
- "@nrwl/devkit": "17.3.0"
38
+ "@nrwl/devkit": "17.3.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "nx": ">= 16 <= 18"
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.targetToTargetString = exports.parseTargetString = void 0;
4
4
  const nx_1 = require("../../nx");
5
5
  let { readCachedProjectGraph, splitTarget, splitByColons } = (0, nx_1.requireNx)();
6
- // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
6
+ // TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
7
7
  splitTarget = splitTarget ?? require('nx/src/utils/split-target').splitTarget;
8
8
  splitByColons =
9
9
  splitByColons ?? ((s) => s.split(':'));
@@ -4,7 +4,7 @@ exports.readTargetOptions = void 0;
4
4
  const nx_1 = require("../../nx");
5
5
  const path_1 = require("path");
6
6
  let { Workspaces, getExecutorInformation, calculateDefaultProjectName, combineOptionsForExecutor, } = (0, nx_1.requireNx)();
7
- // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
7
+ // TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
8
8
  combineOptionsForExecutor =
9
9
  combineOptionsForExecutor ??
10
10
  require('nx/src/utils/params').combineOptionsForExecutor;
@@ -19,16 +19,19 @@ function readTargetOptions({ project, target, configuration }, context) {
19
19
  throw new Error(`Unable to find project ${project}`);
20
20
  }
21
21
  const targetConfiguration = projectConfiguration.targets[target];
22
- // TODO(v18): remove Workspaces.
22
+ if (!targetConfiguration) {
23
+ throw new Error(`Unable to find target ${target} for project ${project}`);
24
+ }
25
+ // TODO(v19): remove Workspaces.
23
26
  const ws = new Workspaces(context.root);
24
27
  const [nodeModule, executorName] = targetConfiguration.executor.split(':');
25
28
  const { schema } = getExecutorInformation
26
29
  ? getExecutorInformation(nodeModule, executorName, context.root, context.projectsConfigurations?.projects ?? context.workspace.projects)
27
- : // TODO(v18): remove readExecutor. This is to be backwards compatible with Nx 16.5 and below.
30
+ : // TODO(v19): remove readExecutor. This is to be backwards compatible with Nx 16.5 and below.
28
31
  ws.readExecutor(nodeModule, executorName);
29
32
  const defaultProject = calculateDefaultProjectName
30
33
  ? calculateDefaultProjectName(context.cwd, context.root, { version: 2, projects: context.projectsConfigurations.projects }, context.nxJsonConfiguration)
31
- : // TODO(v18): remove calculateDefaultProjectName. This is to be backwards compatible with Nx 16.5 and below.
34
+ : // TODO(v19): remove calculateDefaultProjectName. This is to be backwards compatible with Nx 16.5 and below.
32
35
  ws.calculateDefaultProjectName(context.cwd, { version: 2, projects: context.projectsConfigurations.projects }, context.nxJsonConfiguration);
33
36
  return combineOptionsForExecutor({}, configuration ?? targetConfiguration.defaultConfiguration ?? '', targetConfiguration, schema, defaultProject, (0, path_1.relative)(context.root, context.cwd));
34
37
  }
@@ -54,7 +54,7 @@ async function determineFormat(formats, options) {
54
54
  }
55
55
  function logDeprecationMessage(options, formats) {
56
56
  logger.warn(`
57
- In Nx 18, generating a ${options.artifactType} will no longer support providing a project and deriving the directory.
57
+ In Nx 19, generating a ${options.artifactType} will no longer support providing a project and deriving the directory.
58
58
  Please provide the exact directory in the future.
59
59
  Example: nx g ${options.callingGenerator} ${formats['derived'].artifactName} --directory ${formats['derived'].directory}
60
60
  NOTE: The example above assumes the command is being run from the workspace root. If the command is being run from a subdirectory, the directory option should be adjusted accordingly.
@@ -4,7 +4,7 @@ exports.formatFiles = void 0;
4
4
  const path = require("path");
5
5
  const nx_1 = require("../../nx");
6
6
  let { updateJson, readJson, sortObjectByKeys } = (0, nx_1.requireNx)();
7
- // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
7
+ // TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
8
8
  sortObjectByKeys =
9
9
  sortObjectByKeys ?? require('nx/src/utils/object-sort').sortObjectByKeys;
10
10
  /**
@@ -46,7 +46,7 @@ function validateName(name, projectNameAndRootFormat) {
46
46
  }
47
47
  function logDeprecationMessage(callingGenerator, formats) {
48
48
  logger.warn(stripIndents `
49
- In Nx 18, generating projects will no longer derive the name and root.
49
+ In Nx 19, generating projects will no longer derive the name and root.
50
50
  Please provide the exact project name and root in the future.
51
51
  Example: nx g ${callingGenerator} ${formats['derived'].projectName} --directory ${formats['derived'].projectRoot}
52
52
  `);
@@ -14,7 +14,7 @@ function convertNxExecutor(executor) {
14
14
  const workspaces = new Workspaces(builderContext.workspaceRoot);
15
15
  const nxJsonConfiguration = readNxJsonFromDisk
16
16
  ? readNxJsonFromDisk(builderContext.workspaceRoot)
17
- : // TODO(v18): remove readNxJson. This is to be backwards compatible with Nx 16.5 and below.
17
+ : // TODO(v19): remove readNxJson. This is to be backwards compatible with Nx 16.5 and below.
18
18
  workspaces.readNxJson();
19
19
  const promise = async () => {
20
20
  const projectsConfigurations = retrieveProjectConfigurationsWithAngularProjects
@@ -22,7 +22,7 @@ function convertNxExecutor(executor) {
22
22
  version: 2,
23
23
  projects: await retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => p.projectNodes ?? p.projects),
24
24
  }
25
- : // TODO(v18): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
25
+ : // TODO(v19): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
26
26
  workspaces.readProjectsConfigurations({
27
27
  _includeProjectsFromAngularJson: true,
28
28
  });
@@ -4,7 +4,7 @@ exports.convertNxGenerator = void 0;
4
4
  const path_1 = require("path");
5
5
  const nx_1 = require("../../nx");
6
6
  let { logger, stripIndent } = (0, nx_1.requireNx)();
7
- // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
7
+ // TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
8
8
  stripIndent = stripIndent ?? require('nx/src/utils/logger').stripIndent;
9
9
  class RunCallbackTask {
10
10
  constructor(callback) {