nx 19.7.4 → 19.8.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/bin/nx-cloud.js +0 -0
  2. package/package.json +17 -17
  3. package/src/command-line/activate-powerpack/activate-powerpack.d.ts +2 -0
  4. package/src/command-line/activate-powerpack/activate-powerpack.js +32 -0
  5. package/src/command-line/activate-powerpack/command-object.d.ts +6 -0
  6. package/src/command-line/activate-powerpack/command-object.js +25 -0
  7. package/src/command-line/add/command-object.d.ts +1 -1
  8. package/src/command-line/format/format.js +24 -7
  9. package/src/command-line/generate/generator-utils.d.ts +2 -1
  10. package/src/command-line/import/command-object.js +1 -1
  11. package/src/command-line/import/import.js +6 -2
  12. package/src/command-line/init/init-v2.d.ts +1 -1
  13. package/src/command-line/init/init-v2.js +8 -2
  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/report/report.d.ts +3 -0
  18. package/src/command-line/report/report.js +27 -1
  19. package/src/command-line/sync/command-object.js +2 -2
  20. package/src/core/graph/main.js +1 -1
  21. package/src/core/graph/styles.css +1 -1
  22. package/src/daemon/client/client.d.ts +2 -1
  23. package/src/daemon/client/client.js +7 -0
  24. package/src/daemon/message-types/task-history.d.ts +9 -3
  25. package/src/daemon/message-types/task-history.js +10 -2
  26. package/src/daemon/server/handle-task-history.d.ts +5 -1
  27. package/src/daemon/server/handle-task-history.js +11 -9
  28. package/src/daemon/server/server.js +5 -2
  29. package/src/native/index.d.ts +3 -1
  30. package/src/native/nx.wasm32-wasi.wasm +0 -0
  31. package/src/tasks-runner/cache.d.ts +5 -1
  32. package/src/tasks-runner/cache.js +51 -5
  33. package/src/tasks-runner/init-tasks-runner.d.ts +1 -1
  34. package/src/tasks-runner/init-tasks-runner.js +5 -3
  35. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +0 -2
  36. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +0 -5
  37. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +2 -6
  38. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +2 -6
  39. package/src/tasks-runner/life-cycles/store-run-information-life-cycle.d.ts +2 -7
  40. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +1 -1
  41. package/src/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +2 -7
  42. package/src/tasks-runner/life-cycles/task-results-life-cycle.d.ts +6 -0
  43. package/src/tasks-runner/life-cycles/task-results-life-cycle.js +17 -0
  44. package/src/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +2 -7
  45. package/src/tasks-runner/run-command.d.ts +12 -2
  46. package/src/tasks-runner/run-command.js +52 -59
  47. package/src/tasks-runner/task-orchestrator.js +4 -1
  48. package/src/tasks-runner/tasks-schedule.d.ts +3 -0
  49. package/src/tasks-runner/tasks-schedule.js +26 -4
  50. package/src/utils/db-connection.d.ts +4 -1
  51. package/src/utils/db-connection.js +15 -4
  52. package/src/utils/git-utils.d.ts +1 -0
  53. package/src/utils/git-utils.js +4 -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
  58. package/src/utils/task-history.d.ts +12 -1
  59. package/src/utils/task-history.js +23 -0
package/bin/nx-cloud.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.7.4",
3
+ "version": "19.8.0-beta.1",
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": {
@@ -8,9 +8,6 @@
8
8
  "url": "https://github.com/nrwl/nx.git",
9
9
  "directory": "packages/nx"
10
10
  },
11
- "scripts": {
12
- "postinstall": "node ./bin/post-install"
13
- },
14
11
  "keywords": [
15
12
  "Monorepo",
16
13
  "Angular",
@@ -71,7 +68,7 @@
71
68
  "yargs-parser": "21.1.1",
72
69
  "node-machine-id": "1.1.12",
73
70
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.7.4"
71
+ "@nrwl/tao": "19.8.0-beta.1"
75
72
  },
76
73
  "peerDependencies": {
77
74
  "@swc-node/register": "^1.8.0",
@@ -86,16 +83,16 @@
86
83
  }
87
84
  },
88
85
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.7.4",
90
- "@nx/nx-darwin-arm64": "19.7.4",
91
- "@nx/nx-linux-x64-gnu": "19.7.4",
92
- "@nx/nx-linux-x64-musl": "19.7.4",
93
- "@nx/nx-win32-x64-msvc": "19.7.4",
94
- "@nx/nx-linux-arm64-gnu": "19.7.4",
95
- "@nx/nx-linux-arm64-musl": "19.7.4",
96
- "@nx/nx-linux-arm-gnueabihf": "19.7.4",
97
- "@nx/nx-win32-arm64-msvc": "19.7.4",
98
- "@nx/nx-freebsd-x64": "19.7.4"
86
+ "@nx/nx-darwin-x64": "19.8.0-beta.1",
87
+ "@nx/nx-darwin-arm64": "19.8.0-beta.1",
88
+ "@nx/nx-linux-x64-gnu": "19.8.0-beta.1",
89
+ "@nx/nx-linux-x64-musl": "19.8.0-beta.1",
90
+ "@nx/nx-win32-x64-msvc": "19.8.0-beta.1",
91
+ "@nx/nx-linux-arm64-gnu": "19.8.0-beta.1",
92
+ "@nx/nx-linux-arm64-musl": "19.8.0-beta.1",
93
+ "@nx/nx-linux-arm-gnueabihf": "19.8.0-beta.1",
94
+ "@nx/nx-win32-arm64-msvc": "19.8.0-beta.1",
95
+ "@nx/nx-freebsd-x64": "19.8.0-beta.1"
99
96
  },
100
97
  "nx-migrations": {
101
98
  "migrations": "./migrations.json",
@@ -192,5 +189,8 @@
192
189
  },
193
190
  "main": "./bin/nx.js",
194
191
  "type": "commonjs",
195
- "types": "./bin/nx.d.ts"
196
- }
192
+ "types": "./bin/nx.d.ts",
193
+ "scripts": {
194
+ "postinstall": "node ./bin/post-install"
195
+ }
196
+ }
@@ -0,0 +1,2 @@
1
+ import { ActivatePowerpackOptions } from './command-object';
2
+ export declare function handleActivatePowerpack(options: ActivatePowerpackOptions): Promise<void>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleActivatePowerpack = handleActivatePowerpack;
4
+ const workspace_root_1 = require("../../utils/workspace-root");
5
+ const enquirer_1 = require("enquirer");
6
+ const child_process_1 = require("child_process");
7
+ const package_manager_1 = require("../../utils/package-manager");
8
+ async function handleActivatePowerpack(options) {
9
+ const license = options.license ??
10
+ (await (0, enquirer_1.prompt)({
11
+ type: 'input',
12
+ name: 'license',
13
+ message: 'Enter your License Key',
14
+ }));
15
+ const { activatePowerpack } = await requirePowerpack();
16
+ activatePowerpack(workspace_root_1.workspaceRoot, license);
17
+ }
18
+ async function requirePowerpack() {
19
+ // @ts-ignore
20
+ return Promise.resolve().then(() => require('@nx/powerpack-license')).catch(async (e) => {
21
+ if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
22
+ try {
23
+ (0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/powerpack-license@latest`);
24
+ // @ts-ignore
25
+ return await Promise.resolve().then(() => require('@nx/powerpack-license'));
26
+ }
27
+ catch (e) {
28
+ throw new Error('Failed to install @nx/powerpack-license. Please install @nx/powerpack-license and try again.');
29
+ }
30
+ }
31
+ });
32
+ }
@@ -0,0 +1,6 @@
1
+ import { CommandModule } from 'yargs';
2
+ export interface ActivatePowerpackOptions {
3
+ license: string;
4
+ verbose: boolean;
5
+ }
6
+ export declare const yargsActivatePowerpackCommand: CommandModule<{}, ActivatePowerpackOptions>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.yargsActivatePowerpackCommand = void 0;
4
+ const shared_options_1 = require("../yargs-utils/shared-options");
5
+ const handle_errors_1 = require("../../utils/handle-errors");
6
+ exports.yargsActivatePowerpackCommand = {
7
+ command: 'activate-powerpack <license>',
8
+ describe: 'Activate a Nx Powerpack license.',
9
+ builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
10
+ .parserConfiguration({
11
+ 'strip-dashed': true,
12
+ 'unknown-options-as-args': true,
13
+ })
14
+ .positional('license', {
15
+ type: 'string',
16
+ description: 'This is a License Key for Nx Powerpack.',
17
+ })
18
+ .example('$0 activate-powerpack <license key>', 'Activate a Nx Powerpack license'),
19
+ handler: async (args) => {
20
+ const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
21
+ return (await Promise.resolve().then(() => require('./activate-powerpack'))).handleActivatePowerpack(args);
22
+ });
23
+ process.exit(exitCode);
24
+ },
25
+ };
@@ -5,4 +5,4 @@ export interface AddOptions {
5
5
  verbose?: boolean;
6
6
  __overrides_unparsed__: string[];
7
7
  }
8
- export declare const yargsAddCommand: CommandModule<Record<string, unknown>, AddOptions>;
8
+ export declare const yargsAddCommand: CommandModule<{}, AddOptions>;
@@ -7,7 +7,6 @@ const file_utils_1 = require("../../project-graph/file-utils");
7
7
  const command_line_utils_1 = require("../../utils/command-line-utils");
8
8
  const fileutils_1 = require("../../utils/fileutils");
9
9
  const ignore_1 = require("../../utils/ignore");
10
- const prettier = require("prettier");
11
10
  const configuration_1 = require("../../config/configuration");
12
11
  const typescript_1 = require("../../plugins/js/utils/typescript");
13
12
  const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
@@ -18,8 +17,19 @@ const object_sort_1 = require("../../utils/object-sort");
18
17
  const output_1 = require("../../utils/output");
19
18
  const package_json_1 = require("../../utils/package-json");
20
19
  const workspace_root_1 = require("../../utils/workspace-root");
21
- const PRETTIER_PATH = getPrettierPath();
22
20
  async function format(command, args) {
21
+ try {
22
+ require('prettier');
23
+ }
24
+ catch {
25
+ output_1.output.error({
26
+ title: 'Prettier is not installed.',
27
+ bodyLines: [
28
+ `Please install "prettier" and try again, or don't run the "nx format:${command}" command.`,
29
+ ],
30
+ });
31
+ process.exit(1);
32
+ }
23
33
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
24
34
  const patterns = (await getPatterns({ ...args, ...nxArgs })).map(
25
35
  // prettier removes one of the \
@@ -72,7 +82,7 @@ async function getPatterns(args) {
72
82
  }
73
83
  const p = (0, command_line_utils_1.parseFiles)(args);
74
84
  // In prettier v3 the getSupportInfo result is a promise
75
- const supportedExtensions = new Set((await prettier.getSupportInfo()).languages
85
+ const supportedExtensions = new Set((await require('prettier').getSupportInfo()).languages
76
86
  .flatMap((language) => language.extensions)
77
87
  .filter((extension) => !!extension)
78
88
  // Prettier supports ".swcrc" as a file instead of an extension
@@ -131,11 +141,12 @@ function write(patterns) {
131
141
  result[pattern.includes('.swcrc') ? 0 : 1].push(pattern);
132
142
  return result;
133
143
  }, [[], []]);
134
- (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
144
+ const prettierPath = getPrettierPath();
145
+ (0, node_child_process_1.execSync)(`node "${prettierPath}" --write --list-different ${regularPatterns.join(' ')}`, {
135
146
  stdio: [0, 1, 2],
136
147
  });
137
148
  if (swcrcPatterns.length > 0) {
138
- (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
149
+ (0, node_child_process_1.execSync)(`node "${prettierPath}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
139
150
  stdio: [0, 1, 2],
140
151
  });
141
152
  }
@@ -145,8 +156,9 @@ async function check(patterns) {
145
156
  if (patterns.length === 0) {
146
157
  return [];
147
158
  }
159
+ const prettierPath = getPrettierPath();
148
160
  return new Promise((resolve) => {
149
- (0, node_child_process_1.exec)(`node "${PRETTIER_PATH}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8' }, (error, stdout) => {
161
+ (0, node_child_process_1.exec)(`node "${prettierPath}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8' }, (error, stdout) => {
150
162
  if (error) {
151
163
  // The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
152
164
  resolve(stdout.trim().split('\n'));
@@ -170,7 +182,12 @@ function sortTsConfig() {
170
182
  // catch noop
171
183
  }
172
184
  }
185
+ let prettierPath;
173
186
  function getPrettierPath() {
187
+ if (prettierPath) {
188
+ return prettierPath;
189
+ }
174
190
  const { bin } = (0, package_json_1.readModulePackageJson)('prettier').packageJson;
175
- return require.resolve(path.join('prettier', bin));
191
+ prettierPath = require.resolve(path.join('prettier', bin));
192
+ return prettierPath;
176
193
  }
@@ -1,6 +1,6 @@
1
1
  import { Generator, GeneratorsJson, GeneratorsJsonEntry } from '../../config/misc-interfaces';
2
2
  import { ProjectConfiguration } from '../../config/workspace-json-project-json';
3
- export declare function getGeneratorInformation(collectionName: string, generatorName: string, root: string | null, projects: Record<string, ProjectConfiguration>): {
3
+ export type GeneratorInformation = {
4
4
  resolvedCollectionName: string;
5
5
  normalizedGeneratorName: string;
6
6
  schema: any;
@@ -9,6 +9,7 @@ export declare function getGeneratorInformation(collectionName: string, generato
9
9
  isNxGenerator: boolean;
10
10
  generatorConfiguration: GeneratorsJsonEntry;
11
11
  };
12
+ export declare function getGeneratorInformation(collectionName: string, generatorName: string, root: string | null, projects: Record<string, ProjectConfiguration>): GeneratorInformation;
12
13
  export declare function readGeneratorsJson(collectionName: string, generator: string, root: string | null, projects: Record<string, ProjectConfiguration>): {
13
14
  generatorsFilePath: string;
14
15
  generatorsJson: GeneratorsJson;
@@ -6,7 +6,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
6
6
  const handle_errors_1 = require("../../utils/handle-errors");
7
7
  exports.yargsImportCommand = {
8
8
  command: 'import [sourceRepository] [destinationDirectory]',
9
- describe: false,
9
+ describe: 'Import code and git history from another repository into this repository.',
10
10
  builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)(yargs
11
11
  .positional('sourceRepository', {
12
12
  type: 'string',
@@ -25,7 +25,12 @@ const needs_install_1 = require("./utils/needs-install");
25
25
  const file_utils_1 = require("../../project-graph/file-utils");
26
26
  const importRemoteName = '__tmp_nx_import__';
27
27
  async function importHandler(options) {
28
+ process.env.NX_RUNNING_NX_IMPORT = 'true';
28
29
  let { sourceRepository, ref, source, destination } = options;
30
+ const destinationGitClient = new git_utils_1.GitRepository(process.cwd());
31
+ if (await destinationGitClient.hasUncommittedChanges()) {
32
+ throw new Error(`You have uncommitted changes in the destination repository. Commit or revert the changes and try again.`);
33
+ }
29
34
  output_1.output.log({
30
35
  title: 'Nx will walk you through the process of importing code from the source repository into this repository:',
31
36
  bodyLines: [
@@ -120,7 +125,6 @@ async function importHandler(options) {
120
125
  throw new Error(`The destination directory must be a relative path in this repository.`);
121
126
  }
122
127
  const absDestination = (0, path_1.join)(process.cwd(), destination);
123
- const destinationGitClient = new git_utils_1.GitRepository(process.cwd());
124
128
  await assertDestinationEmpty(destinationGitClient, absDestination);
125
129
  const tempImportBranch = getTempImportBranch(ref);
126
130
  await sourceGitClient.addFetchRemote(importRemoteName, ref);
@@ -152,7 +156,7 @@ async function importHandler(options) {
152
156
  const pmc = (0, package_manager_1.getPackageManagerCommand)();
153
157
  const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
154
158
  (0, workspace_context_1.resetWorkspaceContext)();
155
- const { plugins, updatePackageScripts } = await (0, init_v2_1.detectPlugins)(nxJson, options.interactive);
159
+ const { plugins, updatePackageScripts } = await (0, init_v2_1.detectPlugins)(nxJson, options.interactive, true);
156
160
  if (packageManager !== sourcePackageManager) {
157
161
  output_1.output.warn({
158
162
  title: `Mismatched package managers`,
@@ -8,7 +8,7 @@ export interface InitArgs {
8
8
  }
9
9
  export declare function installPlugins(repoRoot: string, plugins: string[], pmc: PackageManagerCommands, updatePackageScripts: boolean): void;
10
10
  export declare function initHandler(options: InitArgs): Promise<void>;
11
- export declare function detectPlugins(nxJson: NxJsonConfiguration, interactive: boolean): Promise<{
11
+ export declare function detectPlugins(nxJson: NxJsonConfiguration, interactive: boolean, includeAngularCli?: boolean): Promise<{
12
12
  plugins: string[];
13
13
  updatePackageScripts: boolean;
14
14
  }>;
@@ -127,7 +127,7 @@ const npmPackageToPluginMap = {
127
127
  'react-native': '@nx/react-native',
128
128
  '@remix-run/dev': '@nx/remix',
129
129
  };
130
- async function detectPlugins(nxJson, interactive) {
130
+ async function detectPlugins(nxJson, interactive, includeAngularCli) {
131
131
  let files = ['package.json'].concat((0, workspace_context_1.globWithWorkspaceContextSync)(process.cwd(), ['**/*/package.json']));
132
132
  const currentPlugins = new Set((nxJson.plugins ?? []).map((p) => {
133
133
  const plugin = typeof p === 'string' ? p : p.plugin;
@@ -149,7 +149,13 @@ async function detectPlugins(nxJson, interactive) {
149
149
  ...packageJson.dependencies,
150
150
  ...packageJson.devDependencies,
151
151
  };
152
- for (const [dep, plugin] of Object.entries(npmPackageToPluginMap)) {
152
+ const _npmPackageToPluginMap = {
153
+ ...npmPackageToPluginMap,
154
+ };
155
+ if (includeAngularCli) {
156
+ _npmPackageToPluginMap['@angular/cli'] = '@nx/angular';
157
+ }
158
+ for (const [dep, plugin] of Object.entries(_npmPackageToPluginMap)) {
153
159
  if (deps[dep]) {
154
160
  detectedPlugins.add(plugin);
155
161
  }
@@ -6,6 +6,7 @@ const project_graph_1 = require("../../project-graph/project-graph");
6
6
  const output_1 = require("../../utils/output");
7
7
  const plugins_1 = require("../../utils/plugins");
8
8
  const workspace_root_1 = require("../../utils/workspace-root");
9
+ const output_2 = require("../../utils/plugins/output");
9
10
  /**
10
11
  * List available plugins or capabilities within a specific plugin
11
12
  *
@@ -29,6 +30,7 @@ async function listHandler(args) {
29
30
  }
30
31
  (0, plugins_1.listPlugins)(installedPlugins, 'Installed plugins:');
31
32
  (0, plugins_1.listAlsoAvailableCorePlugins)(installedPlugins);
33
+ (0, output_2.listPowerpackPlugins)();
32
34
  output_1.output.note({
33
35
  title: 'Community Plugins',
34
36
  bodyLines: [
@@ -7,4 +7,4 @@ export declare const parserConfiguration: Partial<yargs.ParserConfigurationOptio
7
7
  * from the `.argv` call, so the object and it's relative scripts can
8
8
  * le executed correctly.
9
9
  */
10
- export declare const commandsObject: yargs.Argv<{}>;
10
+ export declare const commandsObject: yargs.Argv<unknown>;
@@ -3,31 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commandsObject = exports.parserConfiguration = void 0;
4
4
  const chalk = require("chalk");
5
5
  const yargs = require("yargs");
6
- const command_object_1 = require("./affected/command-object");
7
- const command_object_2 = require("./connect/command-object");
8
- const command_object_3 = require("./daemon/command-object");
9
- const command_object_4 = require("./graph/command-object");
10
- const command_object_5 = require("./exec/command-object");
11
- const command_object_6 = require("./format/command-object");
12
- const command_object_7 = require("./generate/command-object");
13
- const command_object_8 = require("./import/command-object");
14
- const command_object_9 = require("./init/command-object");
15
- const command_object_10 = require("./list/command-object");
16
- const command_object_11 = require("./migrate/command-object");
17
- const command_object_12 = require("./new/command-object");
18
- const command_object_13 = require("./repair/command-object");
19
- const command_object_14 = require("./report/command-object");
20
- const command_object_15 = require("./run/command-object");
21
- const command_object_16 = require("./run-many/command-object");
22
- const command_object_17 = require("./show/command-object");
23
- const command_object_18 = require("./watch/command-object");
24
- const command_object_19 = require("./reset/command-object");
25
- const command_object_20 = require("./release/command-object");
26
- const command_object_21 = require("./add/command-object");
27
- const command_object_22 = require("./login/command-object");
28
- const command_object_23 = require("./logout/command-object");
6
+ const command_object_1 = require("./activate-powerpack/command-object");
7
+ const command_object_2 = require("./affected/command-object");
8
+ const command_object_3 = require("./connect/command-object");
9
+ const command_object_4 = require("./daemon/command-object");
10
+ const command_object_5 = require("./graph/command-object");
11
+ const command_object_6 = require("./exec/command-object");
12
+ const command_object_7 = require("./format/command-object");
13
+ const command_object_8 = require("./generate/command-object");
14
+ const command_object_9 = require("./import/command-object");
15
+ const command_object_10 = require("./init/command-object");
16
+ const command_object_11 = require("./list/command-object");
17
+ const command_object_12 = require("./migrate/command-object");
18
+ const command_object_13 = require("./new/command-object");
19
+ const command_object_14 = require("./repair/command-object");
20
+ const command_object_15 = require("./report/command-object");
21
+ const command_object_16 = require("./run/command-object");
22
+ const command_object_17 = require("./run-many/command-object");
23
+ const command_object_18 = require("./show/command-object");
24
+ const command_object_19 = require("./watch/command-object");
25
+ const command_object_20 = require("./reset/command-object");
26
+ const command_object_21 = require("./release/command-object");
27
+ const command_object_22 = require("./add/command-object");
28
+ const command_object_23 = require("./login/command-object");
29
+ const command_object_24 = require("./logout/command-object");
29
30
  const command_objects_1 = require("./deprecated/command-objects");
30
- const command_object_24 = require("./sync/command-object");
31
+ const command_object_25 = require("./sync/command-object");
31
32
  // Ensure that the output takes up the available width of the terminal.
32
33
  yargs.wrap(yargs.terminalWidth());
33
34
  exports.parserConfiguration = {
@@ -44,44 +45,63 @@ exports.commandsObject = yargs
44
45
  .parserConfiguration(exports.parserConfiguration)
45
46
  .usage(chalk.bold('Smart Monorepos · Fast CI'))
46
47
  .demandCommand(1, '')
47
- .command(command_object_21.yargsAddCommand)
48
- .command(command_object_1.yargsAffectedBuildCommand)
49
- .command(command_object_1.yargsAffectedCommand)
50
- .command(command_object_1.yargsAffectedE2ECommand)
51
- .command(command_object_1.yargsAffectedLintCommand)
52
- .command(command_object_1.yargsAffectedTestCommand)
48
+ .command(command_object_1.yargsActivatePowerpackCommand)
49
+ .command(command_object_22.yargsAddCommand)
50
+ .command(command_object_2.yargsAffectedBuildCommand)
51
+ .command(command_object_2.yargsAffectedCommand)
52
+ .command(command_object_2.yargsAffectedE2ECommand)
53
+ .command(command_object_2.yargsAffectedLintCommand)
54
+ .command(command_object_2.yargsAffectedTestCommand)
53
55
  .command(command_objects_1.yargsAffectedGraphCommand)
54
- .command(command_object_2.yargsConnectCommand)
55
- .command(command_object_3.yargsDaemonCommand)
56
- .command(command_object_4.yargsGraphCommand)
57
- .command(command_object_5.yargsExecCommand)
58
- .command(command_object_6.yargsFormatCheckCommand)
59
- .command(command_object_6.yargsFormatWriteCommand)
60
- .command(command_object_7.yargsGenerateCommand)
61
- .command(command_object_8.yargsImportCommand)
62
- .command(command_object_9.yargsInitCommand)
63
- .command(command_object_11.yargsInternalMigrateCommand)
64
- .command(command_object_10.yargsListCommand)
65
- .command(command_object_11.yargsMigrateCommand)
66
- .command(command_object_12.yargsNewCommand)
56
+ .command(command_object_3.yargsConnectCommand)
57
+ .command(command_object_4.yargsDaemonCommand)
58
+ .command(command_object_5.yargsGraphCommand)
59
+ .command(command_object_6.yargsExecCommand)
60
+ .command(command_object_7.yargsFormatCheckCommand)
61
+ .command(command_object_7.yargsFormatWriteCommand)
62
+ .command(command_object_8.yargsGenerateCommand)
63
+ .command(command_object_9.yargsImportCommand)
64
+ .command(command_object_10.yargsInitCommand)
65
+ .command(command_object_12.yargsInternalMigrateCommand)
66
+ .command(command_object_11.yargsListCommand)
67
+ .command(command_object_12.yargsMigrateCommand)
68
+ .command(command_object_13.yargsNewCommand)
67
69
  .command(command_objects_1.yargsPrintAffectedCommand)
68
- .command(command_object_20.yargsReleaseCommand)
69
- .command(command_object_13.yargsRepairCommand)
70
- .command(command_object_14.yargsReportCommand)
71
- .command(command_object_19.yargsResetCommand)
72
- .command(command_object_15.yargsRunCommand)
73
- .command(command_object_16.yargsRunManyCommand)
74
- .command(command_object_17.yargsShowCommand)
75
- .command(command_object_24.yargsSyncCommand)
76
- .command(command_object_24.yargsSyncCheckCommand)
77
- .command(command_object_2.yargsViewLogsCommand)
78
- .command(command_object_18.yargsWatchCommand)
79
- .command(command_object_15.yargsNxInfixCommand)
80
- .command(command_object_22.yargsLoginCommand)
81
- .command(command_object_23.yargsLogoutCommand)
70
+ .command(command_object_21.yargsReleaseCommand)
71
+ .command(command_object_14.yargsRepairCommand)
72
+ .command(command_object_15.yargsReportCommand)
73
+ .command(command_object_20.yargsResetCommand)
74
+ .command(command_object_16.yargsRunCommand)
75
+ .command(command_object_17.yargsRunManyCommand)
76
+ .command(command_object_18.yargsShowCommand)
77
+ .command(command_object_25.yargsSyncCommand)
78
+ .command(command_object_25.yargsSyncCheckCommand)
79
+ .command(command_object_3.yargsViewLogsCommand)
80
+ .command(command_object_19.yargsWatchCommand)
81
+ .command(command_object_16.yargsNxInfixCommand)
82
+ .command(command_object_23.yargsLoginCommand)
83
+ .command(command_object_24.yargsLogoutCommand)
84
+ .command(resolveConformanceCommandObject())
82
85
  .scriptName('nx')
83
86
  .help()
84
87
  // NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
85
88
  // so that it shows up in help. The default yargs implementation of --version is not
86
89
  // hit, as the implementation in nx.ts is hit first and calls process.exit(0).
87
90
  .version();
91
+ function resolveConformanceCommandObject() {
92
+ try {
93
+ const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
94
+ return yargsConformanceCommand;
95
+ }
96
+ catch (e) {
97
+ return {
98
+ command: 'conformance',
99
+ // Hide from --help output in the common case of not having the plugin installed
100
+ describe: false,
101
+ handler: () => {
102
+ // TODO: Add messaging to help with learning more about powerpack and conformance
103
+ process.exit(1);
104
+ },
105
+ };
106
+ }
107
+ }
@@ -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).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' &&
@@ -4,7 +4,7 @@ exports.yargsSyncCheckCommand = exports.yargsSyncCommand = void 0;
4
4
  const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  exports.yargsSyncCommand = {
6
6
  command: 'sync',
7
- describe: false,
7
+ describe: 'Sync the workspace files by running all the sync generators.',
8
8
  builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
9
9
  handler: async (args) => {
10
10
  process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler(args)));
@@ -12,7 +12,7 @@ exports.yargsSyncCommand = {
12
12
  };
13
13
  exports.yargsSyncCheckCommand = {
14
14
  command: 'sync:check',
15
- describe: false,
15
+ describe: 'Check that no changes are required after running all sync generators.',
16
16
  builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
17
17
  handler: async (args) => {
18
18
  process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler({ ...args, check: true })));