nx 18.2.2 → 18.3.0-beta.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.
package/bin/init-local.js CHANGED
@@ -126,7 +126,7 @@ function handleAngularCLIFallbacks(workspace) {
126
126
  if (!process.argv[3]) {
127
127
  console.log(`"ng completion" is not natively supported by Nx.
128
128
  Instead, you could try an Nx Editor Plugin for a visual tool to run Nx commands. If you're using VSCode, you can use the Nx Console plugin, or if you're using WebStorm, you could use one of the available community plugins.
129
- For more information, see https://nx.dev/features/integrate-with-editors`);
129
+ For more information, see https://nx.dev/getting-started/editor-setup`);
130
130
  }
131
131
  }
132
132
  else if (process.argv[2] === 'cache') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "18.2.2",
3
+ "version": "18.3.0-beta.0",
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-parser": "21.1.1",
67
67
  "node-machine-id": "1.1.12",
68
68
  "ora": "5.3.0",
69
- "@nrwl/tao": "18.2.2"
69
+ "@nrwl/tao": "18.3.0-beta.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.8.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "18.2.2",
85
- "@nx/nx-darwin-arm64": "18.2.2",
86
- "@nx/nx-linux-x64-gnu": "18.2.2",
87
- "@nx/nx-linux-x64-musl": "18.2.2",
88
- "@nx/nx-win32-x64-msvc": "18.2.2",
89
- "@nx/nx-linux-arm64-gnu": "18.2.2",
90
- "@nx/nx-linux-arm64-musl": "18.2.2",
91
- "@nx/nx-linux-arm-gnueabihf": "18.2.2",
92
- "@nx/nx-win32-arm64-msvc": "18.2.2",
93
- "@nx/nx-freebsd-x64": "18.2.2"
84
+ "@nx/nx-darwin-x64": "18.3.0-beta.0",
85
+ "@nx/nx-darwin-arm64": "18.3.0-beta.0",
86
+ "@nx/nx-linux-x64-gnu": "18.3.0-beta.0",
87
+ "@nx/nx-linux-x64-musl": "18.3.0-beta.0",
88
+ "@nx/nx-win32-x64-msvc": "18.3.0-beta.0",
89
+ "@nx/nx-linux-arm64-gnu": "18.3.0-beta.0",
90
+ "@nx/nx-linux-arm64-musl": "18.3.0-beta.0",
91
+ "@nx/nx-linux-arm-gnueabihf": "18.3.0-beta.0",
92
+ "@nx/nx-win32-arm64-msvc": "18.3.0-beta.0",
93
+ "@nx/nx-freebsd-x64": "18.3.0-beta.0"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -1,5 +1,6 @@
1
1
  import { PackageManager } from '../../utils/package-manager';
2
2
  import { PackageJson } from '../../utils/package-json';
3
+ import { NxJsonConfiguration } from '../../config/nx-json';
3
4
  export declare const packagesWeCareAbout: string[];
4
5
  export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
5
6
  /**
@@ -16,6 +17,7 @@ export interface ReportData {
16
17
  pmVersion: string;
17
18
  localPlugins: string[];
18
19
  communityPlugins: PackageJson[];
20
+ registeredPlugins: string[];
19
21
  packageVersionsWeCareAbout: {
20
22
  package: string;
21
23
  version: string;
@@ -41,6 +43,7 @@ interface OutOfSyncPackageGroup {
41
43
  }
42
44
  export declare function findMisalignedPackagesForPackage(base: PackageJson): undefined | OutOfSyncPackageGroup;
43
45
  export declare function findInstalledCommunityPlugins(): PackageJson[];
46
+ export declare function findRegisteredPluginsBeingUsed(nxJson: NxJsonConfiguration): string[];
44
47
  export declare function findInstalledPackagesWeCareAbout(): {
45
48
  package: string;
46
49
  version: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findInstalledPackagesWeCareAbout = exports.findInstalledCommunityPlugins = exports.findMisalignedPackagesForPackage = exports.getReportData = exports.reportHandler = exports.patternsWeIgnoreInCommunityReport = exports.packagesWeCareAbout = void 0;
3
+ exports.findInstalledPackagesWeCareAbout = exports.findRegisteredPluginsBeingUsed = exports.findInstalledCommunityPlugins = exports.findMisalignedPackagesForPackage = exports.getReportData = exports.reportHandler = exports.patternsWeIgnoreInCommunityReport = exports.packagesWeCareAbout = void 0;
4
4
  const chalk = require("chalk");
5
5
  const output_1 = require("../../utils/output");
6
6
  const path_1 = require("path");
@@ -36,7 +36,7 @@ const LINE_SEPARATOR = '---------------------------------------';
36
36
  *
37
37
  */
38
38
  async function reportHandler() {
39
- const { pm, pmVersion, localPlugins, communityPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
39
+ const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
40
40
  const bodyLines = [
41
41
  `Node : ${process.versions.node}`,
42
42
  `OS : ${process.platform}-${process.arch}`,
@@ -47,6 +47,13 @@ async function reportHandler() {
47
47
  packageVersionsWeCareAbout.forEach((p) => {
48
48
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
49
49
  });
50
+ if (registeredPlugins.length) {
51
+ bodyLines.push(LINE_SEPARATOR);
52
+ bodyLines.push('Registered Plugins:');
53
+ for (const plugin of registeredPlugins) {
54
+ bodyLines.push(`${chalk.green(plugin)}`);
55
+ }
56
+ }
50
57
  if (communityPlugins.length) {
51
58
  bodyLines.push(LINE_SEPARATOR);
52
59
  padding = Math.max(...communityPlugins.map((x) => x.name.length)) + 1;
@@ -86,8 +93,10 @@ exports.reportHandler = reportHandler;
86
93
  async function getReportData() {
87
94
  const pm = (0, package_manager_1.detectPackageManager)();
88
95
  const pmVersion = (0, package_manager_1.getPackageManagerVersion)(pm);
89
- const localPlugins = await findLocalPlugins((0, nx_json_1.readNxJson)());
96
+ const nxJson = (0, nx_json_1.readNxJson)();
97
+ const localPlugins = await findLocalPlugins(nxJson);
90
98
  const communityPlugins = findInstalledCommunityPlugins();
99
+ const registeredPlugins = findRegisteredPluginsBeingUsed(nxJson);
91
100
  let projectGraphError = null;
92
101
  if (isNativeAvailable()) {
93
102
  try {
@@ -114,6 +123,7 @@ async function getReportData() {
114
123
  pmVersion,
115
124
  localPlugins,
116
125
  communityPlugins,
126
+ registeredPlugins,
117
127
  packageVersionsWeCareAbout,
118
128
  outOfSyncPackageGroup,
119
129
  projectGraphError,
@@ -178,6 +188,13 @@ function findInstalledCommunityPlugins() {
178
188
  : pattern.test(dep.name)));
179
189
  }
180
190
  exports.findInstalledCommunityPlugins = findInstalledCommunityPlugins;
191
+ function findRegisteredPluginsBeingUsed(nxJson) {
192
+ if (!nxJson.plugins) {
193
+ return [];
194
+ }
195
+ return nxJson.plugins.map((plugin) => typeof plugin === 'object' ? plugin.plugin : plugin);
196
+ }
197
+ exports.findRegisteredPluginsBeingUsed = findRegisteredPluginsBeingUsed;
181
198
  function findInstalledPackagesWeCareAbout() {
182
199
  const packagesWeMayCareAbout = {};
183
200
  // TODO (v19): Remove workaround for hiding @nrwl packages when matching @nx package is found.
@@ -99,10 +99,18 @@ export interface ProjectConfiguration {
99
99
  release?: {
100
100
  version?: Pick<NxReleaseVersionConfiguration, 'generator' | 'generatorOptions'>;
101
101
  };
102
- metadata?: {
103
- technologies?: string[];
104
- targetGroups?: Record<string, string[]>;
105
- };
102
+ /**
103
+ * Metadata about the project
104
+ */
105
+ metadata?: ProjectMetadata;
106
+ }
107
+ export interface ProjectMetadata {
108
+ technologies?: string[];
109
+ targetGroups?: Record<string, string[]>;
110
+ }
111
+ export interface TargetMetadata {
112
+ description?: string;
113
+ technologies?: string[];
106
114
  }
107
115
  export interface TargetDependencyConfig {
108
116
  /**
@@ -190,4 +198,8 @@ export interface TargetConfiguration<T = any> {
190
198
  * Determines if Nx is able to cache a given target.
191
199
  */
192
200
  cache?: boolean;
201
+ /**
202
+ * Metadata about the target
203
+ */
204
+ metadata?: TargetMetadata;
193
205
  }
@@ -104,6 +104,9 @@ skipCommandNormalization) {
104
104
  }
105
105
  }
106
106
  }
107
+ if (project.metadata) {
108
+ updatedProjectConfiguration.metadata = mergeMetadata(sourceMap, sourceInformation, 'metadata', project.metadata, matchingProject.metadata);
109
+ }
107
110
  if (project.targets) {
108
111
  // We merge the targets with special handling, so clear this back to the
109
112
  // targets as defined originally before merging.
@@ -134,68 +137,69 @@ skipCommandNormalization) {
134
137
  updatedProjectConfiguration.targets[targetName] = mergedTarget;
135
138
  }
136
139
  }
137
- if (project.metadata) {
138
- if (sourceMap) {
139
- sourceMap['targets'] ??= sourceInformation;
140
- }
141
- for (const [metadataKey, value] of Object.entries({
142
- ...project.metadata,
143
- })) {
144
- const existingValue = matchingProject.metadata?.[metadataKey];
145
- if (Array.isArray(value) && Array.isArray(existingValue)) {
146
- for (const item of [...value]) {
147
- const newLength = updatedProjectConfiguration.metadata[metadataKey].push(item);
148
- if (sourceMap) {
149
- sourceMap[`metadata.${metadataKey}.${newLength - 1}`] =
150
- sourceInformation;
151
- }
140
+ projectRootMap.set(updatedProjectConfiguration.root, updatedProjectConfiguration);
141
+ }
142
+ exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
143
+ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata, matchingMetadata) {
144
+ const result = {
145
+ ...(matchingMetadata ?? {}),
146
+ };
147
+ for (const [metadataKey, value] of Object.entries(metadata)) {
148
+ const existingValue = matchingMetadata?.[metadataKey];
149
+ if (Array.isArray(value) && Array.isArray(existingValue)) {
150
+ for (const item of [...value]) {
151
+ const newLength = result[metadataKey].push(item);
152
+ if (sourceMap) {
153
+ sourceMap[`${baseSourceMapPath}.${metadataKey}.${newLength - 1}`] =
154
+ sourceInformation;
152
155
  }
153
156
  }
154
- else if (Array.isArray(value) && existingValue === undefined) {
155
- updatedProjectConfiguration.metadata ??= {};
156
- updatedProjectConfiguration.metadata[metadataKey] ??= value;
157
+ }
158
+ else if (Array.isArray(value) && existingValue === undefined) {
159
+ result[metadataKey] ??= value;
160
+ if (sourceMap) {
161
+ sourceMap[`${baseSourceMapPath}.${metadataKey}`] = sourceInformation;
162
+ }
163
+ for (let i = 0; i < value.length; i++) {
157
164
  if (sourceMap) {
158
- sourceMap[`metadata.${metadataKey}`] = sourceInformation;
159
- }
160
- for (let i = 0; i < value.length; i++) {
161
- if (sourceMap) {
162
- sourceMap[`metadata.${metadataKey}.${i}`] = sourceInformation;
163
- }
165
+ sourceMap[`${baseSourceMapPath}.${metadataKey}.${i}`] =
166
+ sourceInformation;
164
167
  }
165
168
  }
166
- else if (typeof value === 'object' &&
167
- typeof existingValue === 'object') {
168
- for (const key in value) {
169
- const existingValue = matchingProject.metadata?.[metadataKey]?.[key];
170
- if (Array.isArray(value[key]) && Array.isArray(existingValue)) {
171
- for (const item of value[key]) {
172
- const i = updatedProjectConfiguration.metadata[metadataKey][key].push(item);
173
- if (sourceMap) {
174
- sourceMap[`metadata.${metadataKey}.${key}.${i - 1}`] =
175
- sourceInformation;
176
- }
177
- }
178
- }
179
- else {
180
- updatedProjectConfiguration.metadata[metadataKey] = value;
169
+ }
170
+ else if (typeof value === 'object' && typeof existingValue === 'object') {
171
+ for (const key in value) {
172
+ const existingValue = matchingMetadata?.[metadataKey]?.[key];
173
+ if (Array.isArray(value[key]) && Array.isArray(existingValue)) {
174
+ for (const item of value[key]) {
175
+ const i = result[metadataKey][key].push(item);
181
176
  if (sourceMap) {
182
- sourceMap[`metadata.${metadataKey}`] = sourceInformation;
177
+ sourceMap[`${baseSourceMapPath}.${metadataKey}.${key}.${i - 1}`] =
178
+ sourceInformation;
183
179
  }
184
180
  }
185
181
  }
182
+ else {
183
+ result[metadataKey] = value;
184
+ if (sourceMap) {
185
+ sourceMap[`${baseSourceMapPath}.${metadataKey}`] =
186
+ sourceInformation;
187
+ }
188
+ }
186
189
  }
187
- else {
188
- updatedProjectConfiguration.metadata[metadataKey] = value;
189
- if (sourceMap) {
190
- sourceMap[`metadata.${metadataKey}`] = sourceInformation;
191
- if (typeof value === 'object') {
192
- for (const k in value) {
193
- sourceMap[`metadata.${metadataKey}.${k}`] = sourceInformation;
194
- if (Array.isArray(value[k])) {
195
- for (let i = 0; i < value[k].length; i++) {
196
- sourceMap[`metadata.${metadataKey}.${k}.${i}`] =
197
- sourceInformation;
198
- }
190
+ }
191
+ else {
192
+ result[metadataKey] = value;
193
+ if (sourceMap) {
194
+ sourceMap[`${baseSourceMapPath}.${metadataKey}`] = sourceInformation;
195
+ if (typeof value === 'object') {
196
+ for (const k in value) {
197
+ sourceMap[`${baseSourceMapPath}.${metadataKey}.${k}`] =
198
+ sourceInformation;
199
+ if (Array.isArray(value[k])) {
200
+ for (let i = 0; i < value[k].length; i++) {
201
+ sourceMap[`${baseSourceMapPath}.${metadataKey}.${k}.${i}`] =
202
+ sourceInformation;
199
203
  }
200
204
  }
201
205
  }
@@ -203,9 +207,8 @@ skipCommandNormalization) {
203
207
  }
204
208
  }
205
209
  }
206
- projectRootMap.set(updatedProjectConfiguration.root, updatedProjectConfiguration);
210
+ return result;
207
211
  }
208
- exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
209
212
  /**
210
213
  * Transforms a list of project paths into a map of project configurations.
211
214
  *
@@ -481,6 +484,9 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
481
484
  if (target.configurations || defaultConfigurations) {
482
485
  result.configurations = mergeConfigurations(target.configurations, isCompatible ? defaultConfigurations : undefined, projectConfigSourceMap, sourceInformation, targetIdentifier);
483
486
  }
487
+ if (target.metadata) {
488
+ result.metadata = mergeMetadata(projectConfigSourceMap, sourceInformation, `${targetIdentifier}.metadata`, target.metadata, baseTarget?.metadata);
489
+ }
484
490
  return result;
485
491
  }
486
492
  exports.mergeTargetConfigurations = mergeTargetConfigurations;
@@ -132,7 +132,7 @@ class ForkedProcessTaskRunner {
132
132
  });
133
133
  }
134
134
  }
135
- async forkProcessWithPseudoTerminal(task, { streamOutput, taskGraph, env, }) {
135
+ async forkProcessWithPseudoTerminal(task, { temporaryOutputPath, streamOutput, taskGraph, env, }) {
136
136
  const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
137
137
  if (streamOutput) {
138
138
  output_1.output.logCommand(args.join(' '));
@@ -160,6 +160,7 @@ class ForkedProcessTaskRunner {
160
160
  if (code >= 128) {
161
161
  process.exit(code);
162
162
  }
163
+ this.writeTerminalOutput(temporaryOutputPath, terminalOutput);
163
164
  res({
164
165
  code,
165
166
  terminalOutput,
@@ -4,6 +4,7 @@ exports.TaskOrchestrator = void 0;
4
4
  const events_1 = require("events");
5
5
  const perf_hooks_1 = require("perf_hooks");
6
6
  const path_1 = require("path");
7
+ const fs_1 = require("fs");
7
8
  const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
8
9
  const forked_process_task_runner_1 = require("./forked-process-task-runner");
9
10
  const cache_1 = require("./cache");
@@ -238,6 +239,7 @@ class TaskOrchestrator {
238
239
  if (!streamOutput) {
239
240
  this.options.lifeCycle.printTaskTerminalOutput(task, status, terminalOutput);
240
241
  }
242
+ (0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
241
243
  results.push({
242
244
  task,
243
245
  status,
@@ -52,6 +52,7 @@ export interface PackageJson {
52
52
  workspaces?: string[] | {
53
53
  packages: string[];
54
54
  };
55
+ publishConfig?: Record<string, string>;
55
56
  nx?: NxProjectPackageJsonConfiguration;
56
57
  generators?: string;
57
58
  schematics?: string;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readModulePackageJson = exports.readModulePackageJsonWithoutFallbacks = exports.readTargetsFromPackageJson = exports.buildTargetFromScript = exports.readNxMigrateConfig = exports.normalizePackageGroup = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
+ const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
6
7
  const fileutils_1 = require("./fileutils");
7
8
  const installation_directory_1 = require("./installation-directory");
8
- const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
9
9
  function normalizePackageGroup(packageGroup) {
10
10
  return Array.isArray(packageGroup)
11
11
  ? packageGroup.map((x) => typeof x === 'string' ? { package: x, version: '*' } : x)