nx 19.3.0-beta.0 → 19.3.0-beta.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.
Files changed (35) hide show
  1. package/bin/post-install.js +1 -3
  2. package/migrations.json +12 -0
  3. package/package.json +12 -12
  4. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +38 -13
  5. package/src/command-line/init/implementation/utils.js +15 -2
  6. package/src/command-line/release/command-object.js +1 -1
  7. package/src/command-line/release/utils/git.d.ts +2 -2
  8. package/src/command-line/release/utils/git.js +19 -11
  9. package/src/command-line/release/version.d.ts +1 -1
  10. package/src/command-line/release/version.js +1 -1
  11. package/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  12. package/src/core/graph/main.js +1 -1
  13. package/src/daemon/client/client.js +0 -2
  14. package/src/executors/run-commands/run-commands.impl.d.ts +6 -2
  15. package/src/executors/run-commands/run-commands.impl.js +52 -25
  16. package/src/executors/run-commands/schema.json +5 -2
  17. package/src/generators/utils/project-configuration.js +1 -1
  18. package/src/hasher/file-hasher.js +1 -1
  19. package/src/migrations/update-19-2-4/set-project-name.d.ts +2 -0
  20. package/src/migrations/update-19-2-4/set-project-name.js +34 -0
  21. package/src/plugins/js/package-json/create-package-json.js +3 -0
  22. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +9 -4
  23. package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
  24. package/src/plugins/package-json-workspaces/create-nodes.js +34 -11
  25. package/src/plugins/project-json/build-nodes/project-json.d.ts +1 -0
  26. package/src/plugins/project-json/build-nodes/project-json.js +16 -4
  27. package/src/project-graph/error-types.js +10 -0
  28. package/src/project-graph/file-utils.js +1 -1
  29. package/src/project-graph/plugins/internal-api.js +1 -1
  30. package/src/project-graph/utils/normalize-project-nodes.js +24 -6
  31. package/src/project-graph/utils/project-configuration-utils.js +9 -1
  32. package/src/tasks-runner/create-task-graph.js +32 -33
  33. package/src/utils/ab-testing.d.ts +1 -1
  34. package/src/utils/find-matching-projects.js +13 -1
  35. package/src/utils/package-json.d.ts +1 -0
@@ -64,7 +64,26 @@ class ProcessTasks {
64
64
  ? overrides
65
65
  : { __overrides_unparsed__: [] };
66
66
  if (dependencyConfig.projects) {
67
- this.processTasksForMatchingProjects(dependencyConfig, projectUsedToDeriveDependencies, configuration, task, taskOverrides, overrides);
67
+ /** LERNA SUPPORT START - Remove in v20 */
68
+ // Lerna uses `dependencies` in `prepNxOptions`, so we need to maintain
69
+ // support for it until lerna can be updated to use the syntax.
70
+ //
71
+ // This should have been removed in v17, but the updates to lerna had not
72
+ // been made yet.
73
+ //
74
+ // TODO(@agentender): Remove this part in v20
75
+ if (typeof dependencyConfig.projects === 'string') {
76
+ if (dependencyConfig.projects === 'self') {
77
+ this.processTasksForSingleProject(task, task.target.project, dependencyConfig, configuration, taskOverrides, overrides);
78
+ continue;
79
+ }
80
+ else if (dependencyConfig.projects === 'dependencies') {
81
+ this.processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides);
82
+ continue;
83
+ }
84
+ }
85
+ /** LERNA SUPPORT END - Remove in v17 */
86
+ this.processTasksForMatchingProjects(dependencyConfig, configuration, task, taskOverrides, overrides);
68
87
  }
69
88
  else if (dependencyConfig.dependencies) {
70
89
  this.processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides);
@@ -74,41 +93,21 @@ class ProcessTasks {
74
93
  }
75
94
  }
76
95
  }
77
- processTasksForMatchingProjects(dependencyConfig, projectUsedToDeriveDependencies, configuration, task, taskOverrides, overrides) {
96
+ processTasksForMatchingProjects(dependencyConfig, configuration, task, taskOverrides, overrides) {
78
97
  const targetProjectSpecifiers = typeof dependencyConfig.projects === 'string'
79
98
  ? [dependencyConfig.projects]
80
99
  : dependencyConfig.projects;
81
- for (const projectSpecifier of targetProjectSpecifiers) {
82
- // Lerna uses `dependencies` in `prepNxOptions`, so we need to maintain
83
- // support for it until lerna can be updated to use the syntax.
84
- // TODO(@agentender): Remove this part in v17
85
- if (projectSpecifier === 'dependencies' &&
86
- !this.projectGraph.nodes[projectSpecifier]) {
87
- this.processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides);
88
- }
89
- else {
90
- // Since we need to maintain support for dependencies, it is more coherent
91
- // that we also support self.
92
- // TODO(@agentender): Remove this part in v17
93
- const matchingProjects =
94
- /** LERNA SUPPORT START - Remove in v17 */
95
- projectSpecifier === 'self' &&
96
- !this.projectGraph.nodes[projectSpecifier]
97
- ? [task.target.project]
98
- : /** LERNA SUPPORT END */
99
- (0, find_matching_projects_1.findMatchingProjects)([projectSpecifier], this.projectGraph.nodes);
100
- if (matchingProjects.length === 0) {
101
- output_1.output.warn({
102
- title: `\`dependsOn\` is misconfigured for ${task.target.project}:${task.target.target}`,
103
- bodyLines: [
104
- `Project pattern "${projectSpecifier}" does not match any projects.`,
105
- ],
106
- });
107
- }
108
- for (const projectName of matchingProjects) {
109
- this.processTasksForSingleProject(task, projectName, dependencyConfig, configuration, taskOverrides, overrides);
110
- }
111
- }
100
+ const matchingProjects = (0, find_matching_projects_1.findMatchingProjects)(targetProjectSpecifiers, this.projectGraph.nodes);
101
+ if (matchingProjects.length === 0) {
102
+ output_1.output.warn({
103
+ title: `\`dependsOn\` is misconfigured for ${task.target.project}:${task.target.target}`,
104
+ bodyLines: [
105
+ `Project patterns "${targetProjectSpecifiers}" does not match any projects.`,
106
+ ],
107
+ });
108
+ }
109
+ for (const projectName of matchingProjects) {
110
+ this.processTasksForSingleProject(task, projectName, dependencyConfig, configuration, taskOverrides, overrides);
112
111
  }
113
112
  }
114
113
  processTasksForSingleProject(task, projectName, dependencyConfig, configuration, taskOverrides, overrides) {
@@ -31,7 +31,7 @@ declare const messageOptions: {
31
31
  }];
32
32
  };
33
33
  export type MessageKey = keyof typeof messageOptions;
34
- export type MessageData = typeof messageOptions[MessageKey][number];
34
+ export type MessageData = (typeof messageOptions)[MessageKey][number];
35
35
  export declare class PromptMessages {
36
36
  private selectedMessages;
37
37
  getPrompt(key: MessageKey): MessageData;
@@ -22,6 +22,15 @@ function findMatchingProjects(patterns = [], projects) {
22
22
  }
23
23
  const projectNames = Object.keys(projects);
24
24
  const matchedProjects = new Set();
25
+ // If the first pattern is an exclude pattern,
26
+ // we add a wildcard pattern at the first to select
27
+ // all projects, except the ones that match the exclude pattern.
28
+ // e.g. ['!tag:someTag', 'project2'] will match all projects except
29
+ // the ones with the tag 'someTag', and also match the project 'project2',
30
+ // regardless of its tags.
31
+ if (isExcludePattern(patterns[0])) {
32
+ patterns.unshift('*');
33
+ }
25
34
  for (const stringPattern of patterns) {
26
35
  if (!stringPattern.length) {
27
36
  continue;
@@ -139,8 +148,11 @@ function addMatchingProjectsByTag(projectNames, projects, pattern, matchedProjec
139
148
  }
140
149
  }
141
150
  }
151
+ function isExcludePattern(pattern) {
152
+ return pattern.startsWith('!');
153
+ }
142
154
  function parseStringPattern(pattern, projects) {
143
- const isExclude = pattern.startsWith('!');
155
+ const isExclude = isExcludePattern(pattern);
144
156
  // Support for things like: `!{type}:value`
145
157
  if (isExclude) {
146
158
  pattern = pattern.substring(1);
@@ -1,6 +1,7 @@
1
1
  import { InputDefinition, ProjectMetadata, TargetConfiguration } from '../config/workspace-json-project-json';
2
2
  import { PackageManagerCommands } from './package-manager';
3
3
  export interface NxProjectPackageJsonConfiguration {
4
+ name?: string;
4
5
  implicitDependencies?: string[];
5
6
  tags?: string[];
6
7
  namedInputs?: {