nx 19.7.0-beta.1 → 19.7.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/.eslintrc.json +12 -1
  2. package/package.json +13 -13
  3. package/schemas/nx-schema.json +7 -0
  4. package/src/command-line/connect/connect-to-nx-cloud.js +7 -6
  5. package/src/command-line/graph/graph.d.ts +18 -1
  6. package/src/command-line/graph/graph.js +35 -18
  7. package/src/command-line/login/command-object.d.ts +2 -0
  8. package/src/command-line/login/command-object.js +16 -0
  9. package/src/command-line/login/login.d.ts +5 -0
  10. package/src/command-line/login/login.js +16 -0
  11. package/src/command-line/logout/command-object.d.ts +2 -0
  12. package/src/command-line/logout/command-object.js +12 -0
  13. package/src/command-line/logout/logout.d.ts +4 -0
  14. package/src/command-line/logout/logout.js +13 -0
  15. package/src/command-line/migrate/migrate.js +5 -36
  16. package/src/command-line/nx-commands.js +7 -3
  17. package/src/command-line/release/index.d.ts +6 -4
  18. package/src/command-line/sync/sync.js +12 -1
  19. package/src/command-line/yargs-utils/shared-options.d.ts +2 -1
  20. package/src/command-line/yargs-utils/shared-options.js +11 -15
  21. package/src/config/nx-json.d.ts +5 -1
  22. package/src/core/graph/main.js +1 -1
  23. package/src/core/graph/styles.css +1 -1
  24. package/src/core/graph/styles.js +1 -1
  25. package/src/daemon/client/client.js +4 -2
  26. package/src/daemon/server/sync-generators.js +11 -3
  27. package/src/devkit-exports.d.ts +1 -0
  28. package/src/executors/run-commands/run-commands.impl.js +8 -3
  29. package/src/hasher/node-task-hasher-impl.d.ts +1 -1
  30. package/src/hasher/node-task-hasher-impl.js +34 -16
  31. package/src/native/nx.wasm32-wasi.wasm +0 -0
  32. package/src/nx-cloud/update-manager.d.ts +1 -1
  33. package/src/nx-cloud/utilities/axios.js +1 -6
  34. package/src/plugins/js/package-json/create-package-json.d.ts +1 -0
  35. package/src/plugins/js/package-json/create-package-json.js +24 -0
  36. package/src/tasks-runner/cache.js +2 -2
  37. package/src/tasks-runner/default-tasks-runner.js +1 -1
  38. package/src/tasks-runner/init-tasks-runner.d.ts +2 -0
  39. package/src/tasks-runner/init-tasks-runner.js +1 -0
  40. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +4 -6
  41. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +5 -0
  42. package/src/tasks-runner/run-command.js +2 -11
  43. package/src/tasks-runner/task-env.d.ts +3 -3
  44. package/src/tasks-runner/task-env.js +3 -3
  45. package/src/tasks-runner/task-orchestrator.d.ts +2 -1
  46. package/src/tasks-runner/task-orchestrator.js +5 -2
  47. package/src/utils/package-json.d.ts +3 -0
  48. package/src/utils/sync-generators.d.ts +6 -3
  49. package/src/utils/sync-generators.js +27 -5
@@ -1,5 +1,7 @@
1
1
  import type { GeneratorCallback } from '../config/misc-interfaces';
2
+ import { type NxJsonConfiguration } from '../config/nx-json';
2
3
  import type { ProjectGraph } from '../config/project-graph';
4
+ import type { TaskGraph } from '../config/task-graph';
3
5
  import type { ProjectConfiguration } from '../config/workspace-json-project-json';
4
6
  import { FsTree, type FileChange, type Tree } from '../generators/tree';
5
7
  export type SyncGeneratorResult = void | {
@@ -15,8 +17,9 @@ export type SyncGeneratorChangesResult = {
15
17
  };
16
18
  export declare function getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorChangesResult[]>;
17
19
  export declare function flushSyncGeneratorChanges(results: SyncGeneratorChangesResult[]): Promise<void>;
18
- export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph): Promise<string[]>;
20
+ export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Promise<string[]>;
19
21
  export declare function runSyncGenerator(tree: FsTree, generatorSpecifier: string, projects: Record<string, ProjectConfiguration>): Promise<SyncGeneratorChangesResult>;
20
- export declare function collectRegisteredTaskSyncGenerators(projectGraph: ProjectGraph): Set<string>;
21
- export declare function collectRegisteredGlobalSyncGenerators(nxJson?: import("../config/nx-json").NxJsonConfiguration<string[] | "*">): Set<string>;
22
+ export declare function collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
23
+ export declare function collectEnabledTaskSyncGeneratorsFromTaskGraph(taskGraph: TaskGraph, projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
24
+ export declare function collectRegisteredGlobalSyncGenerators(nxJson?: NxJsonConfiguration<string[] | "*">): Set<string>;
22
25
  export declare function syncGeneratorResultsToMessageLines(results: SyncGeneratorChangesResult[]): string[];
@@ -4,7 +4,8 @@ exports.getSyncGeneratorChanges = getSyncGeneratorChanges;
4
4
  exports.flushSyncGeneratorChanges = flushSyncGeneratorChanges;
5
5
  exports.collectAllRegisteredSyncGenerators = collectAllRegisteredSyncGenerators;
6
6
  exports.runSyncGenerator = runSyncGenerator;
7
- exports.collectRegisteredTaskSyncGenerators = collectRegisteredTaskSyncGenerators;
7
+ exports.collectEnabledTaskSyncGeneratorsFromProjectGraph = collectEnabledTaskSyncGeneratorsFromProjectGraph;
8
+ exports.collectEnabledTaskSyncGeneratorsFromTaskGraph = collectEnabledTaskSyncGeneratorsFromTaskGraph;
8
9
  exports.collectRegisteredGlobalSyncGenerators = collectRegisteredGlobalSyncGenerators;
9
10
  exports.syncGeneratorResultsToMessageLines = syncGeneratorResultsToMessageLines;
10
11
  const perf_hooks_1 = require("perf_hooks");
@@ -39,10 +40,10 @@ async function flushSyncGeneratorChanges(results) {
39
40
  await client_1.daemonClient.flushSyncGeneratorChangesToDisk(results.map((r) => r.generatorName));
40
41
  }
41
42
  }
42
- async function collectAllRegisteredSyncGenerators(projectGraph) {
43
+ async function collectAllRegisteredSyncGenerators(projectGraph, nxJson) {
43
44
  if (!client_1.daemonClient.enabled()) {
44
45
  return [
45
- ...collectRegisteredTaskSyncGenerators(projectGraph),
46
+ ...collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph, nxJson),
46
47
  ...collectRegisteredGlobalSyncGenerators(),
47
48
  ];
48
49
  }
@@ -69,17 +70,38 @@ async function runSyncGenerator(tree, generatorSpecifier, projects) {
69
70
  outOfSyncMessage,
70
71
  };
71
72
  }
72
- function collectRegisteredTaskSyncGenerators(projectGraph) {
73
+ function collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph, nxJson) {
73
74
  const taskSyncGenerators = new Set();
75
+ const disabledTaskSyncGenerators = new Set(nxJson.sync?.disabledTaskSyncGenerators ?? []);
74
76
  for (const { data: { targets }, } of Object.values(projectGraph.nodes)) {
75
77
  if (!targets) {
76
78
  continue;
77
79
  }
78
80
  for (const target of Object.values(targets)) {
79
- if (!target.syncGenerators) {
81
+ if (!target.syncGenerators?.length) {
80
82
  continue;
81
83
  }
82
84
  for (const generator of target.syncGenerators) {
85
+ if (!disabledTaskSyncGenerators.has(generator) &&
86
+ !taskSyncGenerators.has(generator)) {
87
+ taskSyncGenerators.add(generator);
88
+ }
89
+ }
90
+ }
91
+ }
92
+ return taskSyncGenerators;
93
+ }
94
+ function collectEnabledTaskSyncGeneratorsFromTaskGraph(taskGraph, projectGraph, nxJson) {
95
+ const taskSyncGenerators = new Set();
96
+ const disabledTaskSyncGenerators = new Set(nxJson.sync?.disabledTaskSyncGenerators ?? []);
97
+ for (const { target } of Object.values(taskGraph.tasks)) {
98
+ const { syncGenerators } = projectGraph.nodes[target.project].data.targets[target.target];
99
+ if (!syncGenerators?.length) {
100
+ continue;
101
+ }
102
+ for (const generator of syncGenerators) {
103
+ if (!disabledTaskSyncGenerators.has(generator) &&
104
+ !taskSyncGenerators.has(generator)) {
83
105
  taskSyncGenerators.add(generator);
84
106
  }
85
107
  }