@nx/workspace 23.2.0-pr.36838.ef8e258 → 23.2.0-rc.0

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.
@@ -36,38 +36,69 @@ async function convertToInferredGenerator(tree, options) {
36
36
  return;
37
37
  }
38
38
  const tasks = [];
39
- for (const generatorCollection of generatorsToRun) {
40
- try {
41
- const generator = generatorCollectionChoices.get(generatorCollection);
42
- if (generator) {
43
- const generatorFactory = generator.implementationFactory();
44
- const callback = await generatorFactory(tree, {
45
- project: options.project,
46
- skipFormat: options.skipFormat,
47
- });
48
- if (callback) {
49
- const task = await callback();
50
- if (typeof task === 'function')
51
- tasks.push(task);
39
+ // Each conversion checks nx.json's plugins array to decide whether it can
40
+ // centralize shared configuration, but every later conversion in this loop
41
+ // appends its own plugin registration afterwards. A batch session defers
42
+ // centralization to a single finalize pass that observes the finished array,
43
+ // so every conversion in the batch can centralize; a lone conversion already
44
+ // sees the finished array and takes the inline path.
45
+ const session = generatorsToRun.length > 1 ? (0, internal_1.openBatchConversionSession)(tree) : undefined;
46
+ try {
47
+ for (const generatorCollection of generatorsToRun) {
48
+ try {
49
+ const generator = generatorCollectionChoices.get(generatorCollection);
50
+ if (generator) {
51
+ const generatorFactory = generator.implementationFactory();
52
+ const runGenerator = () => generatorFactory(tree, {
53
+ project: options.project,
54
+ skipFormat: options.skipFormat,
55
+ });
56
+ const callback = session
57
+ ? await session.runChild(runGenerator)
58
+ : await runGenerator();
59
+ if (callback) {
60
+ tasks.push(async () => {
61
+ try {
62
+ const task = await callback();
63
+ if (typeof task === 'function')
64
+ await task();
65
+ }
66
+ catch (e) {
67
+ devkit_1.output.error({
68
+ title: `${generatorCollection}:convert-to-inferred - Failed`,
69
+ });
70
+ throw e;
71
+ }
72
+ });
73
+ }
74
+ devkit_1.output.success({
75
+ title: `${generatorCollection}:convert-to-inferred - Success`,
76
+ });
52
77
  }
53
- devkit_1.output.success({
54
- title: `${generatorCollection}:convert-to-inferred - Success`,
55
- });
56
- }
57
- }
58
- catch (e) {
59
- if (e instanceof internal_1.NoTargetsToMigrateError) {
60
- devkit_1.output.note({
61
- title: `${generatorCollection}:convert-to-inferred - Skipped (No targets to migrate)`,
62
- });
63
78
  }
64
- else {
65
- devkit_1.output.error({
66
- title: `${generatorCollection}:convert-to-inferred - Failed`,
67
- });
68
- throw e;
79
+ catch (e) {
80
+ if (e instanceof internal_1.NoTargetsToMigrateError) {
81
+ devkit_1.output.note({
82
+ title: `${generatorCollection}:convert-to-inferred - Skipped (No targets to migrate)`,
83
+ });
84
+ }
85
+ else {
86
+ devkit_1.output.error({
87
+ title: `${generatorCollection}:convert-to-inferred - Failed`,
88
+ });
89
+ throw e;
90
+ }
69
91
  }
70
92
  }
93
+ if (session) {
94
+ // Never throws: a failed finalize downgrades to a warning and leaves the
95
+ // conservative per-project configuration, so the queued callbacks below
96
+ // still run.
97
+ await (0, internal_1.finalizeBatchConversion)(tree, session);
98
+ }
99
+ }
100
+ finally {
101
+ session?.close();
71
102
  }
72
103
  if (!options.skipFormat) {
73
104
  await (0, devkit_1.formatFiles)(tree);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "23.2.0-pr.36838.ef8e258",
3
+ "version": "23.2.0-rc.0",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -84,11 +84,11 @@
84
84
  "semver": "^7.6.3",
85
85
  "tslib": "^2.3.0",
86
86
  "yargs-parser": "21.1.1",
87
- "nx": "23.2.0-pr.36838.ef8e258",
88
- "@nx/devkit": "23.2.0-pr.36838.ef8e258"
87
+ "nx": "23.2.0-rc.0",
88
+ "@nx/devkit": "23.2.0-rc.0"
89
89
  },
90
90
  "devDependencies": {
91
- "nx": "23.2.0-pr.36838.ef8e258"
91
+ "nx": "23.2.0-rc.0"
92
92
  },
93
93
  "publishConfig": {
94
94
  "access": "public"