nx 17.3.0-beta.1 → 17.3.0-beta.3

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 (40) hide show
  1. package/changelog-renderer/index.d.ts +11 -1
  2. package/changelog-renderer/index.js +24 -9
  3. package/migrations.json +6 -0
  4. package/package.json +12 -12
  5. package/src/adapter/ngcli-adapter.d.ts +13 -2
  6. package/src/adapter/ngcli-adapter.js +34 -6
  7. package/src/command-line/connect/command-object.d.ts +1 -2
  8. package/src/command-line/connect/command-object.js +3 -7
  9. package/src/command-line/connect/connect-to-nx-cloud.d.ts +2 -5
  10. package/src/command-line/connect/connect-to-nx-cloud.js +4 -6
  11. package/src/command-line/format/format.js +13 -4
  12. package/src/command-line/graph/graph.js +5 -2
  13. package/src/command-line/init/command-object.js +2 -2
  14. package/src/command-line/init/implementation/add-nx-to-nest.js +0 -1
  15. package/src/command-line/init/implementation/angular/index.js +1 -0
  16. package/src/command-line/init/implementation/utils.js +1 -1
  17. package/src/command-line/migrate/migrate.js +2 -4
  18. package/src/command-line/release/changelog.js +80 -40
  19. package/src/command-line/release/command-object.js +2 -3
  20. package/src/command-line/release/config/config.js +21 -6
  21. package/src/command-line/release/publish.js +5 -0
  22. package/src/command-line/release/release.js +5 -3
  23. package/src/command-line/release/utils/git.d.ts +1 -1
  24. package/src/command-line/release/utils/git.js +3 -1
  25. package/src/command-line/release/utils/github.js +64 -1
  26. package/src/command-line/release/utils/markdown.js +6 -1
  27. package/src/command-line/release/utils/shared.d.ts +1 -1
  28. package/src/command-line/release/utils/shared.js +17 -16
  29. package/src/command-line/release/version.js +24 -7
  30. package/src/config/nx-json.d.ts +8 -3
  31. package/src/core/graph/3rdpartylicenses.txt +76 -26
  32. package/src/core/graph/main.js +1 -1
  33. package/src/core/graph/polyfills.js +1 -1
  34. package/src/core/graph/runtime.js +1 -1
  35. package/src/core/graph/styles.css +1 -1
  36. package/src/core/graph/styles.js +1 -1
  37. package/src/migrations/update-17-3-0/nx-release-git-operations-explicit-opt-out.d.ts +2 -0
  38. package/src/migrations/update-17-3-0/nx-release-git-operations-explicit-opt-out.js +46 -0
  39. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  40. package/src/utils/ab-testing.js +2 -2
@@ -36,7 +36,17 @@ export interface DefaultChangelogRenderOptions extends ChangelogRenderOptions {
36
36
  * Whether or not the commit authors should be added to the bottom of the changelog in a "Thank You"
37
37
  * section. Defaults to true.
38
38
  */
39
- includeAuthors?: boolean;
39
+ authors?: boolean;
40
+ /**
41
+ * Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.
42
+ * Defaults to true.
43
+ */
44
+ commitReferences?: boolean;
45
+ /**
46
+ * Whether or not to include the date in the version title. It can be set to false to disable it, or true to enable
47
+ * with the default of (YYYY-MM-DD). Defaults to true.
48
+ */
49
+ versionTitleDate?: boolean;
40
50
  }
41
51
  /**
42
52
  * The default ChangelogRenderer implementation that nx exports for the common case of generating markdown
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const semver_1 = require("semver");
3
4
  const github_1 = require("../src/command-line/release/utils/github");
4
5
  const shared_1 = require("../src/command-line/release/utils/shared");
5
6
  // axios types and values don't seem to match
@@ -44,12 +45,12 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
44
45
  // No changes for the workspace
45
46
  if (commits.length === 0) {
46
47
  if (entryWhenNoChanges) {
47
- markdownLines.push('', `## ${releaseVersion}\n\n${entryWhenNoChanges}`, '');
48
+ markdownLines.push('', `${createVersionTitle(releaseVersion, changelogRenderOptions)}\n\n${entryWhenNoChanges}`, '');
48
49
  }
49
50
  return markdownLines.join('\n').trim();
50
51
  }
51
52
  const typeGroups = groupBy(commits, 'type');
52
- markdownLines.push('', `## ${releaseVersion}`, '');
53
+ markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
53
54
  for (const type of Object.keys(commitTypes)) {
54
55
  const group = typeGroups[type];
55
56
  if (!group || group.length === 0) {
@@ -67,7 +68,7 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
67
68
  for (const scope of scopesSortedAlphabetically) {
68
69
  const commits = commitsGroupedByScope[scope];
69
70
  for (const commit of commits) {
70
- const line = formatCommit(commit, repoSlug);
71
+ const line = formatCommit(commit, changelogRenderOptions, repoSlug);
71
72
  markdownLines.push(line);
72
73
  if (commit.isBreaking) {
73
74
  const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
@@ -85,11 +86,11 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
85
86
  // Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
86
87
  if (relevantCommits.length === 0) {
87
88
  if (entryWhenNoChanges) {
88
- markdownLines.push('', `## ${releaseVersion}\n\n${entryWhenNoChanges}`, '');
89
+ markdownLines.push('', `${createVersionTitle(releaseVersion, changelogRenderOptions)}\n\n${entryWhenNoChanges}`, '');
89
90
  }
90
91
  return markdownLines.join('\n').trim();
91
92
  }
92
- markdownLines.push('', `## ${releaseVersion}`, '');
93
+ markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
93
94
  const typeGroups = groupBy(
94
95
  // Sort the relevant commits to have the unscoped commits first, before grouping by type
95
96
  relevantCommits.sort((a, b) => (b.scope ? 1 : 0) - (a.scope ? 1 : 0)), 'type');
@@ -101,7 +102,7 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
101
102
  markdownLines.push('', `### ${commitTypes[type].title}`, '');
102
103
  const commitsInChronologicalOrder = group.reverse();
103
104
  for (const commit of commitsInChronologicalOrder) {
104
- const line = formatCommit(commit, repoSlug);
105
+ const line = formatCommit(commit, changelogRenderOptions, repoSlug);
105
106
  markdownLines.push(line + '\n');
106
107
  if (commit.isBreaking) {
107
108
  const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
@@ -115,7 +116,7 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
115
116
  if (breakingChanges.length > 0) {
116
117
  markdownLines.push('', '#### ⚠️ Breaking Changes', '', ...breakingChanges);
117
118
  }
118
- if (changelogRenderOptions.includeAuthors) {
119
+ if (changelogRenderOptions.authors) {
119
120
  const _authors = new Map();
120
121
  for (const commit of commits) {
121
122
  if (!commit.author) {
@@ -190,12 +191,12 @@ function groupBy(items, key) {
190
191
  }
191
192
  return groups;
192
193
  }
193
- function formatCommit(commit, repoSlug) {
194
+ function formatCommit(commit, changelogRenderOptions, repoSlug) {
194
195
  let commitLine = '- ' +
195
196
  (commit.isBreaking ? '⚠️ ' : '') +
196
197
  (commit.scope ? `**${commit.scope.trim()}:** ` : '') +
197
198
  commit.description;
198
- if (repoSlug) {
199
+ if (repoSlug && changelogRenderOptions.commitReferences) {
199
200
  commitLine += (0, github_1.formatReferences)(commit.references, repoSlug);
200
201
  }
201
202
  return commitLine;
@@ -221,3 +222,17 @@ function extractBreakingChangeExplanation(message) {
221
222
  // Extract and return the breaking change message
222
223
  return message.substring(startOfBreakingChange, endOfBreakingChange).trim();
223
224
  }
225
+ function createVersionTitle(version, changelogRenderOptions) {
226
+ // Normalize by removing any leading `v` during comparison
227
+ const isMajorVersion = `${(0, semver_1.major)(version)}.0.0` === version.replace(/^v/, '');
228
+ let maybeDateStr = '';
229
+ if (changelogRenderOptions.versionTitleDate) {
230
+ // YYYY-MM-DD
231
+ const dateStr = new Date().toISOString().slice(0, 10);
232
+ maybeDateStr = ` (${dateStr})`;
233
+ }
234
+ if (isMajorVersion) {
235
+ return `# ${version}${maybeDateStr}`;
236
+ }
237
+ return `## ${version}${maybeDateStr}`;
238
+ }
package/migrations.json CHANGED
@@ -76,6 +76,12 @@
76
76
  "version": "17.0.0-rc.1",
77
77
  "description": "Migration for v17.0.0-rc.1",
78
78
  "implementation": "./src/migrations/update-17-0-0/rm-default-collection-npm-scope"
79
+ },
80
+ "17.3.0-nx-release-git-operations-explicit-opt-out": {
81
+ "cli": "nx",
82
+ "version": "17.3.0-beta.3",
83
+ "description": "Explicitly opt-out of git operations in nx release",
84
+ "implementation": "./src/migrations/update-17-3-0/nx-release-git-operations-explicit-opt-out"
79
85
  }
80
86
  }
81
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "17.3.0-beta.1",
3
+ "version": "17.3.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -66,7 +66,7 @@
66
66
  "yargs": "^17.6.2",
67
67
  "yargs-parser": "21.1.1",
68
68
  "node-machine-id": "1.1.12",
69
- "@nrwl/tao": "17.3.0-beta.1"
69
+ "@nrwl/tao": "17.3.0-beta.3"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.6.7",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "17.3.0-beta.1",
85
- "@nx/nx-darwin-arm64": "17.3.0-beta.1",
86
- "@nx/nx-linux-x64-gnu": "17.3.0-beta.1",
87
- "@nx/nx-linux-x64-musl": "17.3.0-beta.1",
88
- "@nx/nx-win32-x64-msvc": "17.3.0-beta.1",
89
- "@nx/nx-linux-arm64-gnu": "17.3.0-beta.1",
90
- "@nx/nx-linux-arm64-musl": "17.3.0-beta.1",
91
- "@nx/nx-linux-arm-gnueabihf": "17.3.0-beta.1",
92
- "@nx/nx-win32-arm64-msvc": "17.3.0-beta.1",
93
- "@nx/nx-freebsd-x64": "17.3.0-beta.1"
84
+ "@nx/nx-darwin-x64": "17.3.0-beta.3",
85
+ "@nx/nx-darwin-arm64": "17.3.0-beta.3",
86
+ "@nx/nx-linux-x64-gnu": "17.3.0-beta.3",
87
+ "@nx/nx-linux-x64-musl": "17.3.0-beta.3",
88
+ "@nx/nx-win32-x64-msvc": "17.3.0-beta.3",
89
+ "@nx/nx-linux-arm64-gnu": "17.3.0-beta.3",
90
+ "@nx/nx-linux-arm64-musl": "17.3.0-beta.3",
91
+ "@nx/nx-linux-arm-gnueabihf": "17.3.0-beta.3",
92
+ "@nx/nx-win32-arm64-msvc": "17.3.0-beta.3",
93
+ "@nx/nx-freebsd-x64": "17.3.0-beta.3"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -24,15 +24,26 @@ export declare class NxScopedHost extends virtualFs.ScopedHost<any> {
24
24
  private root;
25
25
  constructor(root: string);
26
26
  read(path: Path): Observable<FileBuffer>;
27
- private readMergedWorkspaceConfiguration;
27
+ protected readMergedWorkspaceConfiguration(): Observable<any>;
28
28
  write(path: Path, content: FileBuffer): Observable<void>;
29
29
  isFile(path: Path): Observable<boolean>;
30
30
  exists(path: Path): Observable<boolean>;
31
31
  mergeProjectConfiguration(existing: AngularProjectConfiguration, updated: AngularProjectConfiguration, projectName: string): AngularProjectConfiguration;
32
32
  readExistingAngularJson(): Observable<any>;
33
- private readJson;
33
+ protected readJson<T = any>(path: string): Observable<T>;
34
+ }
35
+ /**
36
+ * Host used by Angular CLI builders. It reads the project configurations from
37
+ * the project graph to access the expanded targets.
38
+ */
39
+ export declare class NxScopedHostForBuilders extends NxScopedHost {
40
+ protected readMergedWorkspaceConfiguration(): Observable<any>;
34
41
  }
35
42
  export declare function arrayBufferToString(buffer: any): string;
43
+ /**
44
+ * Host used by Angular CLI schematics. It reads the project configurations from
45
+ * the project configuration files.
46
+ */
36
47
  export declare class NxScopeHostUsedForWrappedSchematics extends NxScopedHost {
37
48
  private readonly host;
38
49
  constructor(root: string, host: Tree);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLogger = exports.wrapAngularDevkitSchematic = exports.mockSchematicsForTesting = exports.runMigration = exports.generate = exports.NxScopeHostUsedForWrappedSchematics = exports.arrayBufferToString = exports.NxScopedHost = exports.scheduleTarget = exports.createBuilderContext = void 0;
3
+ exports.getLogger = exports.wrapAngularDevkitSchematic = exports.mockSchematicsForTesting = exports.runMigration = exports.generate = exports.NxScopeHostUsedForWrappedSchematics = exports.arrayBufferToString = exports.NxScopedHostForBuilders = exports.NxScopedHost = exports.scheduleTarget = exports.createBuilderContext = void 0;
4
4
  const core_1 = require("@angular-devkit/core");
5
5
  const node_1 = require("@angular-devkit/core/node");
6
6
  const chalk = require("chalk");
@@ -23,7 +23,7 @@ const nx_plugin_1 = require("../utils/nx-plugin");
23
23
  const schema_utils_1 = require("../config/schema-utils");
24
24
  async function createBuilderContext(builderInfo, context) {
25
25
  require('./compat');
26
- const fsHost = new NxScopedHost(context.root);
26
+ const fsHost = new NxScopedHostForBuilders(context.root);
27
27
  // the top level import is not patched because it is imported before the
28
28
  // patching happens so we require it here to use the patched version below
29
29
  const { workspaces } = require('@angular-devkit/core');
@@ -108,7 +108,7 @@ exports.createBuilderContext = createBuilderContext;
108
108
  async function scheduleTarget(root, opts, verbose) {
109
109
  const { Architect } = require('@angular-devkit/architect');
110
110
  const logger = (0, exports.getLogger)(verbose);
111
- const fsHost = new NxScopedHost(root);
111
+ const fsHost = new NxScopedHostForBuilders(root);
112
112
  const { workspace } = await core_1.workspaces.readWorkspace('angular.json', core_1.workspaces.createWorkspaceHost(fsHost));
113
113
  const registry = new core_1.schema.CoreSchemaRegistry();
114
114
  registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
@@ -225,7 +225,7 @@ async function runSchematic(host, root, workflow, logger, opts, schematic, print
225
225
  .toPromise();
226
226
  }
227
227
  catch (e) {
228
- console.log(e);
228
+ console.error(e);
229
229
  throw e;
230
230
  }
231
231
  if (!record.error) {
@@ -273,8 +273,8 @@ class NxScopedHost extends core_1.virtualFs.ScopedHost {
273
273
  return workspaceConfig;
274
274
  }));
275
275
  }), (0, operators_1.catchError)((err) => {
276
- console.log('Unable to read angular.json');
277
- console.log(err);
276
+ console.error('Unable to read angular.json');
277
+ console.error(err);
278
278
  process.exit(1);
279
279
  }));
280
280
  }
@@ -378,6 +378,30 @@ class NxScopedHost extends core_1.virtualFs.ScopedHost {
378
378
  }
379
379
  }
380
380
  exports.NxScopedHost = NxScopedHost;
381
+ /**
382
+ * Host used by Angular CLI builders. It reads the project configurations from
383
+ * the project graph to access the expanded targets.
384
+ */
385
+ class NxScopedHostForBuilders extends NxScopedHost {
386
+ readMergedWorkspaceConfiguration() {
387
+ return (0, rxjs_1.zip)((0, rxjs_1.from)((0, project_graph_1.createProjectGraphAsync)()), this.readExistingAngularJson(), this.readJson('nx.json')).pipe((0, operators_1.map)(([graph, angularJson, nxJson]) => {
388
+ const workspaceConfig = (angularJson || { projects: {} });
389
+ workspaceConfig.cli ??= nxJson.cli;
390
+ workspaceConfig.schematics ??= nxJson.generators;
391
+ for (const projectName of Object.keys(graph.nodes)) {
392
+ workspaceConfig.projects[projectName] ??= {
393
+ ...graph.nodes[projectName].data,
394
+ };
395
+ }
396
+ return workspaceConfig;
397
+ }), (0, operators_1.catchError)((err) => {
398
+ console.error('Unable to read angular.json');
399
+ console.error(err);
400
+ process.exit(1);
401
+ }));
402
+ }
403
+ }
404
+ exports.NxScopedHostForBuilders = NxScopedHostForBuilders;
381
405
  function arrayBufferToString(buffer) {
382
406
  const array = new Uint8Array(buffer);
383
407
  let result = '';
@@ -390,6 +414,10 @@ function arrayBufferToString(buffer) {
390
414
  return result;
391
415
  }
392
416
  exports.arrayBufferToString = arrayBufferToString;
417
+ /**
418
+ * Host used by Angular CLI schematics. It reads the project configurations from
419
+ * the project configuration files.
420
+ */
393
421
  class NxScopeHostUsedForWrappedSchematics extends NxScopedHost {
394
422
  constructor(root, host) {
395
423
  super(root);
@@ -1,4 +1,3 @@
1
1
  import { CommandModule } from 'yargs';
2
- import type { ConnectToNxCloudOptions } from './connect-to-nx-cloud';
3
- export declare const yargsConnectCommand: CommandModule<{}, ConnectToNxCloudOptions>;
2
+ export declare const yargsConnectCommand: CommandModule;
4
3
  export declare const yargsViewLogsCommand: CommandModule;
@@ -6,13 +6,9 @@ exports.yargsConnectCommand = {
6
6
  command: 'connect',
7
7
  aliases: ['connect-to-nx-cloud'],
8
8
  describe: `Connect workspace to Nx Cloud`,
9
- builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs.option('interactive', {
10
- type: 'boolean',
11
- description: 'Prompt for confirmation',
12
- default: true,
13
- }), 'connect-to-nx-cloud'),
14
- handler: async (options) => {
15
- await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand(options);
9
+ builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs, 'connect-to-nx-cloud'),
10
+ handler: async () => {
11
+ await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand();
16
12
  process.exit(0);
17
13
  },
18
14
  };
@@ -2,8 +2,5 @@ import { NxJsonConfiguration } from '../../config/nx-json';
2
2
  import { NxArgs } from '../../utils/command-line-utils';
3
3
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
4
4
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
5
- export interface ConnectToNxCloudOptions {
6
- interactive: boolean;
7
- promptOverride?: string;
8
- }
9
- export declare function connectToNxCloudCommand({ promptOverride, interactive, }: ConnectToNxCloudOptions): Promise<boolean>;
5
+ export declare function connectToNxCloudCommand(): Promise<boolean>;
6
+ export declare function connectToNxCloudPrompt(prompt?: string): Promise<boolean>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.connectToNxCloudCommand = exports.connectToNxCloudIfExplicitlyAsked = exports.onlyDefaultRunnerIsUsed = void 0;
3
+ exports.connectToNxCloudPrompt = exports.connectToNxCloudCommand = exports.connectToNxCloudIfExplicitlyAsked = exports.onlyDefaultRunnerIsUsed = void 0;
4
4
  const output_1 = require("../../utils/output");
5
5
  const configuration_1 = require("../../config/configuration");
6
6
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
@@ -34,7 +34,7 @@ async function connectToNxCloudIfExplicitlyAsked(opts) {
34
34
  }
35
35
  }
36
36
  exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
37
- async function connectToNxCloudCommand({ promptOverride, interactive, }) {
37
+ async function connectToNxCloudCommand() {
38
38
  const nxJson = (0, configuration_1.readNxJson)();
39
39
  if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
40
40
  output_1.output.log({
@@ -49,9 +49,6 @@ async function connectToNxCloudCommand({ promptOverride, interactive, }) {
49
49
  });
50
50
  return false;
51
51
  }
52
- const res = interactive ? await connectToNxCloudPrompt(promptOverride) : true;
53
- if (!res)
54
- return false;
55
52
  (0, child_process_1.runNxSync)(`g nx:connect-to-nx-cloud --quiet --no-interactive`, {
56
53
  stdio: [0, 1, 2],
57
54
  });
@@ -63,7 +60,7 @@ async function connectToNxCloudPrompt(prompt) {
63
60
  .prompt([
64
61
  {
65
62
  name: 'NxCloud',
66
- message: prompt ?? `Enable distributed caching to make your CI faster`,
63
+ message: prompt ?? `Enable remote caching to make your CI faster`,
67
64
  type: 'autocomplete',
68
65
  choices: [
69
66
  {
@@ -79,3 +76,4 @@ async function connectToNxCloudPrompt(prompt) {
79
76
  ])
80
77
  .then((a) => a.NxCloud === 'Yes');
81
78
  }
79
+ exports.connectToNxCloudPrompt = connectToNxCloudPrompt;
@@ -16,6 +16,8 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
16
16
  const configuration_1 = require("../../config/configuration");
17
17
  const chunkify_1 = require("../../utils/chunkify");
18
18
  const all_file_data_1 = require("../../utils/all-file-data");
19
+ const workspace_root_1 = require("../../utils/workspace-root");
20
+ const output_1 = require("../../utils/output");
19
21
  const PRETTIER_PATH = getPrettierPath();
20
22
  async function format(command, args) {
21
23
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
@@ -52,21 +54,28 @@ async function getPatterns(args) {
52
54
  }
53
55
  const p = (0, command_line_utils_1.parseFiles)(args);
54
56
  // In prettier v3 the getSupportInfo result is a promise
55
- const supportedExtensions = (await prettier.getSupportInfo()).languages
57
+ const supportedExtensions = new Set((await prettier.getSupportInfo()).languages
56
58
  .flatMap((language) => language.extensions)
57
59
  .filter((extension) => !!extension)
58
60
  // Prettier supports ".swcrc" as a file instead of an extension
59
61
  // So we add ".swcrc" as a supported extension manually
60
62
  // which allows it to be considered for calculating "patterns"
61
- .concat('.swcrc');
62
- const patterns = p.files.filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.includes(path.extname(f)));
63
+ .concat('.swcrc'));
64
+ const patterns = p.files
65
+ .map((f) => path.relative(workspace_root_1.workspaceRoot, f))
66
+ .filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.has(path.extname(f)));
63
67
  // exclude patterns in .nxignore or .gitignore
64
68
  const nonIgnoredPatterns = (0, ignore_1.getIgnoreObject)().filter(patterns);
65
69
  return args.libsAndApps
66
70
  ? await getPatternsFromApps(nonIgnoredPatterns, await (0, all_file_data_1.allFileData)(), graph)
67
71
  : nonIgnoredPatterns;
68
72
  }
69
- catch {
73
+ catch (err) {
74
+ output_1.output.error({
75
+ title: err?.message ||
76
+ 'Something went wrong when resolving the list of files for the formatter',
77
+ bodyLines: [`Defaulting to all files pattern: "${allFilesPattern}"`],
78
+ });
70
79
  return allFilesPattern;
71
80
  }
72
81
  }
@@ -305,6 +305,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForchang
305
305
  currentProjectGraphClientResponse.focus = focus;
306
306
  currentProjectGraphClientResponse.groupByFolder = groupByFolder;
307
307
  currentProjectGraphClientResponse.exclude = exclude;
308
+ currentSourceMapsClientResponse = sourceMapResponse;
308
309
  const app = http.createServer(async (req, res) => {
309
310
  // parse URL
310
311
  const parsedUrl = new node_url_1.URL(req.url, `http://${host}:${port}`);
@@ -312,6 +313,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForchang
312
313
  // Avoid https://en.wikipedia.org/wiki/Directory_traversal_attack
313
314
  // e.g curl --path-as-is http://localhost:9000/../fileInDanger.txt
314
315
  // by limiting the path to current directory only
316
+ res.setHeader('Access-Control-Allow-Origin', '*');
315
317
  const sanitizePath = (0, path_1.basename)(parsedUrl.pathname);
316
318
  if (sanitizePath === 'project-graph.json') {
317
319
  res.writeHead(200, { 'Content-Type': 'application/json' });
@@ -417,7 +419,8 @@ function createFileWatcher() {
417
419
  output_1.output.note({ title: 'Recalculating project graph...' });
418
420
  const { projectGraphClientResponse, sourceMapResponse } = await createProjectGraphAndSourceMapClientResponse();
419
421
  if (projectGraphClientResponse.hash !==
420
- currentProjectGraphClientResponse.hash) {
422
+ currentProjectGraphClientResponse.hash &&
423
+ sourceMapResponse) {
421
424
  output_1.output.note({ title: 'Graph changes updated.' });
422
425
  currentProjectGraphClientResponse = projectGraphClientResponse;
423
426
  currentSourceMapsClientResponse = sourceMapResponse;
@@ -439,7 +442,7 @@ async function createProjectGraphAndSourceMapClientResponse(affected = []) {
439
442
  const projects = Object.values(graph.nodes);
440
443
  const dependencies = graph.dependencies;
441
444
  const hasher = (0, crypto_1.createHash)('sha256');
442
- hasher.update(JSON.stringify({ layout, projects, dependencies }));
445
+ hasher.update(JSON.stringify({ layout, projects, dependencies, sourceMaps }));
443
446
  const hash = hasher.digest('hex');
444
447
  perf_hooks_1.performance.mark('project graph response generation:end');
445
448
  perf_hooks_1.performance.measure('project graph watch calculation', 'project graph watch calculation:start', 'project graph watch calculation:end');
@@ -4,7 +4,7 @@ exports.yargsInitCommand = void 0;
4
4
  const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  exports.yargsInitCommand = {
6
6
  command: 'init',
7
- describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up distributed caching. For more info, check https://nx.dev/recipes/adopting-nx.',
7
+ describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
8
8
  builder: (yargs) => withInitOptions(yargs),
9
9
  handler: async (args) => {
10
10
  await (await Promise.resolve().then(() => require('./init'))).initHandler(args);
@@ -15,7 +15,7 @@ function withInitOptions(yargs) {
15
15
  return yargs
16
16
  .option('nxCloud', {
17
17
  type: 'boolean',
18
- description: 'Set up distributed caching with Nx Cloud.',
18
+ description: 'Set up remote caching with Nx Cloud.',
19
19
  })
20
20
  .option('interactive', {
21
21
  describe: 'When false disables interactive input prompts for options.',
@@ -171,7 +171,6 @@ function createProjectJson(repoRoot, packageJson, nestCLIOptions) {
171
171
  // lint
172
172
  json.targets['lint'] = {
173
173
  executor: '@nx/eslint:lint',
174
- outputs: ['{options.outputFile}'],
175
174
  options: {
176
175
  lintFilePatterns: ['./src', './test'],
177
176
  },
@@ -106,6 +106,7 @@ function addPluginDependencies() {
106
106
  (0, fileutils_1.writeJsonFile)(packageJsonPath, packageJson);
107
107
  }
108
108
  async function setupWorkspace(cacheableOperations, isIntegratedMigration) {
109
+ (0, utils_1.updateGitIgnore)(repoRoot);
109
110
  if (isIntegratedMigration) {
110
111
  (0, integrated_workspace_1.setupIntegratedWorkspace)();
111
112
  }
@@ -16,7 +16,7 @@ async function askAboutNxCloud() {
16
16
  .prompt([
17
17
  {
18
18
  name: 'NxCloud',
19
- message: `Enable distributed caching to make your CI faster`,
19
+ message: `Enable remote caching to make your CI faster`,
20
20
  type: 'autocomplete',
21
21
  choices: [
22
22
  {
@@ -751,10 +751,8 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
751
751
  (await isMigratingToNewMajor(from, opts.targetVersion)) &&
752
752
  !(0, is_ci_1.isCI)() &&
753
753
  !(0, nx_cloud_utils_1.isNxCloudUsed)(originalNxJson)) {
754
- const useCloud = await (0, connect_to_nx_cloud_1.connectToNxCloudCommand)({
755
- promptOverride: ab_testing_1.messages.getPromptMessage('nxCloudMigration'),
756
- interactive: true,
757
- });
754
+ const setNxCloud = await (0, connect_to_nx_cloud_1.connectToNxCloudPrompt)(ab_testing_1.messages.getPromptMessage('nxCloudMigration'));
755
+ const useCloud = setNxCloud ? await (0, connect_to_nx_cloud_1.connectToNxCloudCommand)() : false;
758
756
  await (0, ab_testing_1.recordStat)({
759
757
  command: 'migrate',
760
758
  nxVersion: versions_1.nxVersion,