nx 19.8.0-canary.20240917-5b34ea5 → 19.8.0-canary.20240919-7f4a877

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 (57) hide show
  1. package/bin/nx-cloud.js +0 -0
  2. package/package.json +17 -17
  3. package/schemas/nx-schema.json +2 -2
  4. package/src/command-line/activate-powerpack/activate-powerpack.d.ts +2 -0
  5. package/src/command-line/activate-powerpack/activate-powerpack.js +32 -0
  6. package/src/command-line/activate-powerpack/command-object.d.ts +6 -0
  7. package/src/command-line/activate-powerpack/command-object.js +26 -0
  8. package/src/command-line/add/command-object.d.ts +1 -1
  9. package/src/command-line/format/format.js +24 -7
  10. package/src/command-line/import/import.js +9 -4
  11. package/src/command-line/import/utils/prepare-source-repo.js +7 -35
  12. package/src/command-line/init/init-v2.d.ts +1 -1
  13. package/src/command-line/init/init-v2.js +10 -4
  14. package/src/command-line/list/list.js +2 -0
  15. package/src/command-line/nx-commands.d.ts +1 -1
  16. package/src/command-line/nx-commands.js +77 -57
  17. package/src/command-line/release/command-object.d.ts +2 -2
  18. package/src/command-line/release/config/config.js +8 -2
  19. package/src/command-line/release/utils/git.d.ts +2 -2
  20. package/src/command-line/release/utils/git.js +12 -2
  21. package/src/command-line/release/utils/shared.d.ts +1 -1
  22. package/src/command-line/release/version.js +4 -0
  23. package/src/command-line/report/report.d.ts +3 -0
  24. package/src/command-line/report/report.js +27 -1
  25. package/src/config/nx-json.d.ts +13 -5
  26. package/src/core/graph/main.js +1 -1
  27. package/src/native/index.d.ts +2 -1
  28. package/src/native/nx.wasm32-wasi.wasm +0 -0
  29. package/src/tasks-runner/cache.d.ts +5 -1
  30. package/src/tasks-runner/cache.js +51 -5
  31. package/src/tasks-runner/init-tasks-runner.d.ts +1 -1
  32. package/src/tasks-runner/init-tasks-runner.js +5 -3
  33. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +0 -2
  34. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +0 -5
  35. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +2 -6
  36. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +2 -6
  37. package/src/tasks-runner/life-cycles/store-run-information-life-cycle.d.ts +2 -7
  38. package/src/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +2 -7
  39. package/src/tasks-runner/life-cycles/task-results-life-cycle.d.ts +6 -0
  40. package/src/tasks-runner/life-cycles/task-results-life-cycle.js +17 -0
  41. package/src/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +2 -7
  42. package/src/tasks-runner/run-command.d.ts +12 -2
  43. package/src/tasks-runner/run-command.js +52 -59
  44. package/src/tasks-runner/task-orchestrator.d.ts +0 -1
  45. package/src/tasks-runner/task-orchestrator.js +5 -7
  46. package/src/utils/db-connection.d.ts +4 -1
  47. package/src/utils/db-connection.js +15 -4
  48. package/src/utils/git-utils.d.ts +4 -2
  49. package/src/utils/git-utils.index-filter.d.ts +0 -0
  50. package/src/utils/git-utils.index-filter.js +20 -0
  51. package/src/utils/git-utils.js +48 -13
  52. package/src/utils/git-utils.tree-filter.d.ts +11 -0
  53. package/src/utils/git-utils.tree-filter.js +43 -0
  54. package/src/utils/plugins/output.d.ts +1 -0
  55. package/src/utils/plugins/output.js +7 -0
  56. package/src/utils/powerpack.d.ts +5 -0
  57. package/src/utils/powerpack.js +38 -0
@@ -188,7 +188,12 @@ async function gitCommit({ messages, additionalArgs, dryRun, verbose, logFn, })
188
188
  commandArgs.push('--message', message);
189
189
  }
190
190
  if (additionalArgs) {
191
- commandArgs.push(...additionalArgs.split(' '));
191
+ if (Array.isArray(additionalArgs)) {
192
+ commandArgs.push(...additionalArgs);
193
+ }
194
+ else {
195
+ commandArgs.push(...additionalArgs.split(' '));
196
+ }
192
197
  }
193
198
  if (verbose) {
194
199
  logFn(dryRun
@@ -224,7 +229,12 @@ async function gitTag({ tag, message, additionalArgs, dryRun, verbose, logFn, })
224
229
  message || tag,
225
230
  ];
226
231
  if (additionalArgs) {
227
- commandArgs.push(...additionalArgs.split(' '));
232
+ if (Array.isArray(additionalArgs)) {
233
+ commandArgs.push(...additionalArgs);
234
+ }
235
+ else {
236
+ commandArgs.push(...additionalArgs.split(' '));
237
+ }
228
238
  }
229
239
  if (verbose) {
230
240
  logFn(dryRun
@@ -45,7 +45,7 @@ export declare function commitChanges({ changedFiles, deletedFiles, isDryRun, is
45
45
  isDryRun?: boolean;
46
46
  isVerbose?: boolean;
47
47
  gitCommitMessages?: string[];
48
- gitCommitArgs?: string;
48
+ gitCommitArgs?: string | string[];
49
49
  }): Promise<void>;
50
50
  export declare function createCommitMessageValues(releaseGroups: ReleaseGroupWithName[], releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>, versionData: VersionData, commitMessage: string): string[];
51
51
  export declare function createGitTagValues(releaseGroups: ReleaseGroupWithName[], releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>, versionData: VersionData): string[];
@@ -207,6 +207,10 @@ function createAPI(overrideReleaseConfig) {
207
207
  */
208
208
  for (const releaseGroup of releaseGroups) {
209
209
  const releaseGroupName = releaseGroup.name;
210
+ runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
211
+ dryRun: args.dryRun,
212
+ verbose: args.verbose,
213
+ });
210
214
  const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
211
215
  // Batch based on all projects within the release group
212
216
  releaseGroup.projects);
@@ -15,6 +15,8 @@ export declare function reportHandler(): Promise<void>;
15
15
  export interface ReportData {
16
16
  pm: PackageManager;
17
17
  pmVersion: string;
18
+ powerpackLicense: any | null;
19
+ powerpackPlugins: PackageJson[];
18
20
  localPlugins: string[];
19
21
  communityPlugins: PackageJson[];
20
22
  registeredPlugins: string[];
@@ -43,6 +45,7 @@ interface OutOfSyncPackageGroup {
43
45
  migrateTarget: string;
44
46
  }
45
47
  export declare function findMisalignedPackagesForPackage(base: PackageJson): undefined | OutOfSyncPackageGroup;
48
+ export declare function findInstalledPowerpackPlugins(): PackageJson[];
46
49
  export declare function findInstalledCommunityPlugins(): PackageJson[];
47
50
  export declare function findRegisteredPluginsBeingUsed(nxJson: NxJsonConfiguration): string[];
48
51
  export declare function findInstalledPackagesWeCareAbout(): {
@@ -4,6 +4,7 @@ exports.patternsWeIgnoreInCommunityReport = exports.packagesWeCareAbout = void 0
4
4
  exports.reportHandler = reportHandler;
5
5
  exports.getReportData = getReportData;
6
6
  exports.findMisalignedPackagesForPackage = findMisalignedPackagesForPackage;
7
+ exports.findInstalledPowerpackPlugins = findInstalledPowerpackPlugins;
7
8
  exports.findInstalledCommunityPlugins = findInstalledCommunityPlugins;
8
9
  exports.findRegisteredPluginsBeingUsed = findRegisteredPluginsBeingUsed;
9
10
  exports.findInstalledPackagesWeCareAbout = findInstalledPackagesWeCareAbout;
@@ -20,6 +21,7 @@ const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
20
21
  const installation_directory_1 = require("../../utils/installation-directory");
21
22
  const nx_json_1 = require("../../config/nx-json");
22
23
  const error_types_1 = require("../../project-graph/error-types");
24
+ const powerpack_1 = require("../../utils/powerpack");
23
25
  const nxPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(__dirname, '../../../package.json'));
24
26
  exports.packagesWeCareAbout = [
25
27
  'lerna',
@@ -29,6 +31,7 @@ exports.packagesWeCareAbout = [
29
31
  ];
30
32
  exports.patternsWeIgnoreInCommunityReport = [
31
33
  ...exports.packagesWeCareAbout,
34
+ new RegExp('@nx/powerpack*'),
32
35
  '@schematics/angular',
33
36
  new RegExp('@angular/*'),
34
37
  '@nestjs/schematics',
@@ -43,7 +46,7 @@ const LINE_SEPARATOR = '---------------------------------------';
43
46
  *
44
47
  */
45
48
  async function reportHandler() {
46
- const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
49
+ const { pm, pmVersion, powerpackLicense, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
47
50
  const fields = [
48
51
  ['Node', process.versions.node],
49
52
  ['OS', `${process.platform}-${process.arch}`],
@@ -58,6 +61,17 @@ async function reportHandler() {
58
61
  packageVersionsWeCareAbout.forEach((p) => {
59
62
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
60
63
  });
64
+ if (powerpackLicense) {
65
+ bodyLines.push(LINE_SEPARATOR);
66
+ bodyLines.push(chalk.green('Nx Powerpack'));
67
+ bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''} until ${new Date(powerpackLicense.expiresAt * 1000).toLocaleDateString()}`);
68
+ bodyLines.push('');
69
+ padding =
70
+ Math.max(...powerpackPlugins.map((powerpackPlugin) => powerpackPlugin.name.length)) + 1;
71
+ for (const powerpackPlugin of powerpackPlugins) {
72
+ bodyLines.push(`${chalk.green(powerpackPlugin.name.padEnd(padding))} : ${chalk.bold(powerpackPlugin.version)}`);
73
+ }
74
+ }
61
75
  if (registeredPlugins.length) {
62
76
  bodyLines.push(LINE_SEPARATOR);
63
77
  bodyLines.push('Registered Plugins:');
@@ -106,6 +120,7 @@ async function getReportData() {
106
120
  const { graph, error: projectGraphError } = await tryGetProjectGraph();
107
121
  const nxJson = (0, nx_json_1.readNxJson)();
108
122
  const localPlugins = await findLocalPlugins(graph, nxJson);
123
+ const powerpackPlugins = findInstalledPowerpackPlugins();
109
124
  const communityPlugins = findInstalledCommunityPlugins();
110
125
  const registeredPlugins = findRegisteredPluginsBeingUsed(nxJson);
111
126
  const packageVersionsWeCareAbout = findInstalledPackagesWeCareAbout();
@@ -121,8 +136,15 @@ async function getReportData() {
121
136
  }
122
137
  const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
123
138
  const native = isNativeAvailable();
139
+ let powerpackLicense = null;
140
+ try {
141
+ powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
142
+ }
143
+ catch { }
124
144
  return {
125
145
  pm,
146
+ powerpackLicense,
147
+ powerpackPlugins,
126
148
  pmVersion,
127
149
  localPlugins,
128
150
  communityPlugins,
@@ -197,6 +219,10 @@ function findMisalignedPackagesForPackage(base) {
197
219
  }
198
220
  : undefined;
199
221
  }
222
+ function findInstalledPowerpackPlugins() {
223
+ const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
224
+ return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
225
+ }
200
226
  function findInstalledCommunityPlugins() {
201
227
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
202
228
  return installedPlugins.filter((dep) => dep.name !== 'nx' &&
@@ -101,9 +101,9 @@ export interface NxReleaseGitConfiguration {
101
101
  */
102
102
  commitMessage?: string;
103
103
  /**
104
- * Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes
104
+ * Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes. May be a string or array of strings.
105
105
  */
106
- commitArgs?: string;
106
+ commitArgs?: string | string[];
107
107
  /**
108
108
  * Whether or not to stage the changes made by this command. Always treated as true if commit is true.
109
109
  */
@@ -117,9 +117,9 @@ export interface NxReleaseGitConfiguration {
117
117
  */
118
118
  tagMessage?: string;
119
119
  /**
120
- * Additional arguments to pass to the `git tag` command invoked behind the scenes
120
+ * Additional arguments to pass to the `git tag` command invoked behind the scenes. . May be a string or array of strings.
121
121
  */
122
- tagArgs?: string;
122
+ tagArgs?: string | string[];
123
123
  }
124
124
  export interface NxReleaseConventionalCommitsConfiguration {
125
125
  types?: Record<string,
@@ -179,7 +179,15 @@ export interface NxReleaseConfiguration {
179
179
  *
180
180
  * NOTE: git configuration is not supported at the group level, only the root/command level
181
181
  */
182
- version?: NxReleaseVersionConfiguration;
182
+ version?: NxReleaseVersionConfiguration & {
183
+ /**
184
+ * A command to run after validation of nx release configuration, but before versioning begins.
185
+ * Used for preparing build artifacts. If --dry-run is passed, the command is still executed, but
186
+ * with the NX_DRY_RUN environment variable set to 'true'.
187
+ * It will run in addition to the global `preVersionCommand`
188
+ */
189
+ groupPreVersionCommand?: string;
190
+ };
183
191
  /**
184
192
  * Project changelogs are disabled by default.
185
193
  *