From d140b5eb6df402183a73fc522fac6249d62b7a30 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Wed, 27 Sep 2023 10:06:19 -0400 Subject: [PATCH] chore(core): misc cleanup --- docs/generated/devkit/NxJsonConfiguration.md | 28 +++++++-------- docs/generated/devkit/README.md | 1 + docs/generated/devkit/TargetConfiguration.md | 10 ------ docs/generated/devkit/TargetDefaults.md | 3 ++ docs/generated/devkit/Workspace.md | 36 +++++++++---------- .../packages/devkit/documents/nx_devkit.md | 1 + packages/nx/schemas/nx-schema.json | 16 +++++++++ .../connect/connect-to-nx-cloud.ts | 2 +- .../nx/src/command-line/connect/view-logs.ts | 3 +- .../nx/src/command-line/migrate/migrate.ts | 9 ++--- packages/nx/src/config/nx-json.ts | 19 +++++++--- .../src/config/workspace-json-project-json.ts | 6 ---- packages/nx/src/daemon/client/client.ts | 1 + packages/nx/src/devkit-exports.ts | 1 + .../nx/src/generators/utils/deprecated.ts | 4 +-- .../nx/src/tasks-runner/create-task-graph.ts | 3 +- .../life-cycles/view-logs-utils.ts | 3 +- .../nx/src/tasks-runner/run-command.spec.ts | 2 +- packages/nx/src/tasks-runner/run-command.ts | 21 +++++++---- packages/nx/src/tasks-runner/utils.ts | 3 +- packages/nx/src/utils/nx-cloud-utils.ts | 10 +++--- 21 files changed, 105 insertions(+), 77 deletions(-) create mode 100644 docs/generated/devkit/TargetDefaults.md diff --git a/docs/generated/devkit/NxJsonConfiguration.md b/docs/generated/devkit/NxJsonConfiguration.md index 9f6ead99b22568..1eb7add2993abc 100644 --- a/docs/generated/devkit/NxJsonConfiguration.md +++ b/docs/generated/devkit/NxJsonConfiguration.md @@ -18,7 +18,6 @@ Nx.json configuration ### Properties -- [accessToken](../../devkit/documents/NxJsonConfiguration#accesstoken): string - [affected](../../devkit/documents/NxJsonConfiguration#affected): NxAffectedConfig - [cacheDirectory](../../devkit/documents/NxJsonConfiguration#cachedirectory): string - [cli](../../devkit/documents/NxJsonConfiguration#cli): Object @@ -29,6 +28,7 @@ Nx.json configuration - [installation](../../devkit/documents/NxJsonConfiguration#installation): NxInstallationConfiguration - [namedInputs](../../devkit/documents/NxJsonConfiguration#namedinputs): Object - [npmScope](../../devkit/documents/NxJsonConfiguration#npmscope): string +- [nxCloudAccessToken](../../devkit/documents/NxJsonConfiguration#nxcloudaccesstoken): string - [parallel](../../devkit/documents/NxJsonConfiguration#parallel): number - [plugins](../../devkit/documents/NxJsonConfiguration#plugins): string[] - [pluginsConfig](../../devkit/documents/NxJsonConfiguration#pluginsconfig): Record<string, unknown> @@ -40,15 +40,6 @@ Nx.json configuration ## Properties -### accessToken - -• `Optional` **accessToken**: `string` - -If specified Nx will use nx-cloud by default with the given token. -To use a different runner that accepts an access token, define it in [tasksRunnerOptions](../../devkit/documents/Workspace#tasksrunneroptions) - ---- - ### affected • `Optional` **affected**: [`NxAffectedConfig`](../../devkit/documents/NxAffectedConfig) @@ -61,7 +52,7 @@ Default options for `nx affected` • `Optional` **cacheDirectory**: `string` -Changes the default location of the cache directory. +Changes the directory used by Nx to store its cache. --- @@ -169,11 +160,20 @@ NPM Scope that the workspace uses --- +### nxCloudAccessToken + +• `Optional` **nxCloudAccessToken**: `string` + +If specified Nx will use nx-cloud by default with the given token. +To use a different runner that accepts an access token, define it in [tasksRunnerOptions](../../devkit/documents/Workspace#tasksrunneroptions) + +--- + ### parallel • `Optional` **parallel**: `number` -Specifies how many tasks are ran in parallel by Nx for the default tasks runner. +Specifies how many tasks can be run in parallel. --- @@ -203,7 +203,7 @@ Configuration for Nx Plugins ### targetDefaults -• `Optional` **targetDefaults**: `TargetDefaults` +• `Optional` **targetDefaults**: [`TargetDefaults`](../../devkit/documents/TargetDefaults) Dependencies between different target names across all projects @@ -225,7 +225,7 @@ Available Task Runners • `Optional` **useDaemonProcess**: `boolean` -Allows turning the daemon off if set to false explicitly. +Set this to false to disable the daemon. --- diff --git a/docs/generated/devkit/README.md b/docs/generated/devkit/README.md index 5b189866c4e7c1..9ff7a125e01a02 100644 --- a/docs/generated/devkit/README.md +++ b/docs/generated/devkit/README.md @@ -83,6 +83,7 @@ It only uses language primitives and immutable objects - [RawProjectGraphDependency](../../devkit/documents/RawProjectGraphDependency) - [StaticDependency](../../devkit/documents/StaticDependency) - [StringChange](../../devkit/documents/StringChange) +- [TargetDefaults](../../devkit/documents/TargetDefaults) - [TaskGraphExecutor](../../devkit/documents/TaskGraphExecutor) - [WorkspaceConfiguration](../../devkit/documents/WorkspaceConfiguration) - [WorkspaceJsonConfiguration](../../devkit/documents/WorkspaceJsonConfiguration) diff --git a/docs/generated/devkit/TargetConfiguration.md b/docs/generated/devkit/TargetConfiguration.md index ae0a478bdf5226..251878c7850c02 100644 --- a/docs/generated/devkit/TargetConfiguration.md +++ b/docs/generated/devkit/TargetConfiguration.md @@ -12,7 +12,6 @@ Target's configuration ### Properties -- [cache](../../devkit/documents/TargetConfiguration#cache): boolean - [command](../../devkit/documents/TargetConfiguration#command): string - [configurations](../../devkit/documents/TargetConfiguration#configurations): Object - [defaultConfiguration](../../devkit/documents/TargetConfiguration#defaultconfiguration): string @@ -24,15 +23,6 @@ Target's configuration ## Properties -### cache - -• `Optional` **cache**: `boolean` - -Determines if Nx is able to cache a given target. -Currently only supported in `targetDefaults`. - ---- - ### command • `Optional` **command**: `string` diff --git a/docs/generated/devkit/TargetDefaults.md b/docs/generated/devkit/TargetDefaults.md new file mode 100644 index 00000000000000..6bb0ccfefcdc0d --- /dev/null +++ b/docs/generated/devkit/TargetDefaults.md @@ -0,0 +1,3 @@ +# Type alias: TargetDefaults + +Ƭ **TargetDefaults**: `Record`<`string`, `Partial`<[`TargetConfiguration`](../../devkit/documents/TargetConfiguration)\> & { `cache?`: `boolean` }\> diff --git a/docs/generated/devkit/Workspace.md b/docs/generated/devkit/Workspace.md index 07a89a98551655..9e8d8639c28ce8 100644 --- a/docs/generated/devkit/Workspace.md +++ b/docs/generated/devkit/Workspace.md @@ -16,7 +16,6 @@ use ProjectsConfigurations or NxJsonConfiguration ### Properties -- [accessToken](../../devkit/documents/Workspace#accesstoken): string - [affected](../../devkit/documents/Workspace#affected): NxAffectedConfig - [cacheDirectory](../../devkit/documents/Workspace#cachedirectory): string - [cli](../../devkit/documents/Workspace#cli): Object @@ -27,6 +26,7 @@ use ProjectsConfigurations or NxJsonConfiguration - [installation](../../devkit/documents/Workspace#installation): NxInstallationConfiguration - [namedInputs](../../devkit/documents/Workspace#namedinputs): Object - [npmScope](../../devkit/documents/Workspace#npmscope): string +- [nxCloudAccessToken](../../devkit/documents/Workspace#nxcloudaccesstoken): string - [parallel](../../devkit/documents/Workspace#parallel): number - [plugins](../../devkit/documents/Workspace#plugins): string[] - [pluginsConfig](../../devkit/documents/Workspace#pluginsconfig): Record<string, unknown> @@ -40,19 +40,6 @@ use ProjectsConfigurations or NxJsonConfiguration ## Properties -### accessToken - -• `Optional` **accessToken**: `string` - -If specified Nx will use nx-cloud by default with the given token. -To use a different runner that accepts an access token, define it in [tasksRunnerOptions](../../devkit/documents/Workspace#tasksrunneroptions) - -#### Inherited from - -[NxJsonConfiguration](../../devkit/documents/NxJsonConfiguration).[accessToken](../../devkit/documents/NxJsonConfiguration#accesstoken) - ---- - ### affected • `Optional` **affected**: [`NxAffectedConfig`](../../devkit/documents/NxAffectedConfig) @@ -69,7 +56,7 @@ Default options for `nx affected` • `Optional` **cacheDirectory**: `string` -Changes the default location of the cache directory. +Changes the directory used by Nx to store its cache. #### Inherited from @@ -213,11 +200,24 @@ NPM Scope that the workspace uses --- +### nxCloudAccessToken + +• `Optional` **nxCloudAccessToken**: `string` + +If specified Nx will use nx-cloud by default with the given token. +To use a different runner that accepts an access token, define it in [tasksRunnerOptions](../../devkit/documents/Workspace#tasksrunneroptions) + +#### Inherited from + +[NxJsonConfiguration](../../devkit/documents/NxJsonConfiguration).[nxCloudAccessToken](../../devkit/documents/NxJsonConfiguration#nxcloudaccesstoken) + +--- + ### parallel • `Optional` **parallel**: `number` -Specifies how many tasks are ran in parallel by Nx for the default tasks runner. +Specifies how many tasks can be run in parallel. #### Inherited from @@ -275,7 +275,7 @@ Projects' projects ### targetDefaults -• `Optional` **targetDefaults**: `TargetDefaults` +• `Optional` **targetDefaults**: [`TargetDefaults`](../../devkit/documents/TargetDefaults) Dependencies between different target names across all projects @@ -305,7 +305,7 @@ Available Task Runners • `Optional` **useDaemonProcess**: `boolean` -Allows turning the daemon off if set to false explicitly. +Set this to false to disable the daemon. #### Inherited from diff --git a/docs/generated/packages/devkit/documents/nx_devkit.md b/docs/generated/packages/devkit/documents/nx_devkit.md index 5b189866c4e7c1..9ff7a125e01a02 100644 --- a/docs/generated/packages/devkit/documents/nx_devkit.md +++ b/docs/generated/packages/devkit/documents/nx_devkit.md @@ -83,6 +83,7 @@ It only uses language primitives and immutable objects - [RawProjectGraphDependency](../../devkit/documents/RawProjectGraphDependency) - [StaticDependency](../../devkit/documents/StaticDependency) - [StringChange](../../devkit/documents/StringChange) +- [TargetDefaults](../../devkit/documents/TargetDefaults) - [TaskGraphExecutor](../../devkit/documents/TaskGraphExecutor) - [WorkspaceConfiguration](../../devkit/documents/WorkspaceConfiguration) - [WorkspaceJsonConfiguration](../../devkit/documents/WorkspaceJsonConfiguration) diff --git a/packages/nx/schemas/nx-schema.json b/packages/nx/schemas/nx-schema.json index 091b7d0169510e..4a7cb7e3383cd9 100644 --- a/packages/nx/schemas/nx-schema.json +++ b/packages/nx/schemas/nx-schema.json @@ -81,6 +81,22 @@ "defaultProject": { "type": "string", "description": "Default project. When project isn't provided, the default project will be used." + }, + "accessToken": { + "type": "string", + "description": "The access token to use for nx-cloud. If set, the default tasks runner will be nx-cloud." + }, + "parallel": { + "type": "number", + "description": "Specifies how many tasks are ran in parallel by Nx for the default tasks runner." + }, + "cacheDirectory": { + "type": "string", + "description": "Specifies the default location of the cache directory." + }, + "useDaemonProcess": { + "type": "boolean", + "description": "Specifies whether the daemon should be used for the default tasks runner." } }, "definitions": { diff --git a/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts b/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts index 578dd5704ad344..afb0329cbea9fd 100644 --- a/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts +++ b/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts @@ -35,7 +35,7 @@ export async function connectToNxCloudIfExplicitlyAsked(opts: { export async function connectToNxCloudCommand( promptOverride?: string ): Promise { - if (isNxCloudUsed()) { + if (isNxCloudUsed(readNxJson())) { output.log({ title: '✅ This workspace is already connected to Nx Cloud.', bodyLines: [ diff --git a/packages/nx/src/command-line/connect/view-logs.ts b/packages/nx/src/command-line/connect/view-logs.ts index f4eda36ca691ca..3fc3df8d08da9d 100644 --- a/packages/nx/src/command-line/connect/view-logs.ts +++ b/packages/nx/src/command-line/connect/view-logs.ts @@ -3,9 +3,10 @@ import { execSync } from 'child_process'; import { isNxCloudUsed } from '../../utils/nx-cloud-utils'; import { output } from '../../utils/output'; import { runNxSync } from '../../utils/child-process'; +import { readNxJson } from '../../config/nx-json'; export async function viewLogs(): Promise { - const cloudUsed = isNxCloudUsed(); + const cloudUsed = isNxCloudUsed(readNxJson()); if (cloudUsed) { output.error({ title: 'Your workspace is already connected to Nx Cloud', diff --git a/packages/nx/src/command-line/migrate/migrate.ts b/packages/nx/src/command-line/migrate/migrate.ts index 57889a93ac56d1..7e94a001760aa4 100644 --- a/packages/nx/src/command-line/migrate/migrate.ts +++ b/packages/nx/src/command-line/migrate/migrate.ts @@ -1203,16 +1203,17 @@ async function generateMigrationsJsonAndUpdatePackageJson( let originalPackageJson = existsSync(rootPkgJsonPath) ? readJsonFile(rootPkgJsonPath) : null; - const originalNxInstallation = readNxJson().installation; + const originalNxJson = readNxJson(); const from = - originalNxInstallation?.version ?? readNxVersion(originalPackageJson); + originalNxJson.installation?.version ?? + readNxVersion(originalPackageJson); try { if ( ['nx', '@nrwl/workspace'].includes(opts.targetPackage) && (await isMigratingToNewMajor(from, opts.targetVersion)) && !isCI() && - !isNxCloudUsed() + !isNxCloudUsed(originalNxJson) ) { const useCloud = await connectToNxCloudCommand( messages.getPromptMessage('nxCloudMigration') @@ -1237,7 +1238,7 @@ async function generateMigrationsJsonAndUpdatePackageJson( const migrator = new Migrator({ packageJson: originalPackageJson, - nxInstallation: originalNxInstallation, + nxInstallation: originalNxJson.installation, getInstalledPackageVersion: createInstalledPackageVersionsResolver(root), fetch: createFetcher(), from: opts.from, diff --git a/packages/nx/src/config/nx-json.ts b/packages/nx/src/config/nx-json.ts index 0b8d9aec3754a7..8df96cad87a171 100644 --- a/packages/nx/src/config/nx-json.ts +++ b/packages/nx/src/config/nx-json.ts @@ -25,7 +25,16 @@ export interface NxAffectedConfig { defaultBase?: string; } -export type TargetDefaults = Record>; +export type TargetDefaults = Record< + string, + Partial & { + /** + * Determines if Nx is able to cache a given target. + * Currently only supported in `targetDefaults`. + */ + cache?: boolean; + } +>; export type TargetDependencies = Record< string, @@ -196,20 +205,20 @@ export interface NxJsonConfiguration { * If specified Nx will use nx-cloud by default with the given token. * To use a different runner that accepts an access token, define it in {@link tasksRunnerOptions} */ - accessToken?: string; + nxCloudAccessToken?: string; /** - * Specifies how many tasks are ran in parallel by Nx for the default tasks runner. + * Specifies how many tasks can be run in parallel. */ parallel?: number; /** - * Changes the default location of the cache directory. + * Changes the directory used by Nx to store its cache. */ cacheDirectory?: string; /** - * Allows turning the daemon off if set to false explicitly. + * Set this to false to disable the daemon. */ useDaemonProcess?: boolean; } diff --git a/packages/nx/src/config/workspace-json-project-json.ts b/packages/nx/src/config/workspace-json-project-json.ts index 1466774b769938..86a2904908a1f6 100644 --- a/packages/nx/src/config/workspace-json-project-json.ts +++ b/packages/nx/src/config/workspace-json-project-json.ts @@ -181,10 +181,4 @@ export interface TargetConfiguration { * A default named configuration to use when a target configuration is not provided. */ defaultConfiguration?: string; - - /** - * Determines if Nx is able to cache a given target. - * Currently only supported in `targetDefaults`. - */ - cache?: boolean; } diff --git a/packages/nx/src/daemon/client/client.ts b/packages/nx/src/daemon/client/client.ts index 778df66051a13e..17d173c683a004 100644 --- a/packages/nx/src/daemon/client/client.ts +++ b/packages/nx/src/daemon/client/client.ts @@ -64,6 +64,7 @@ export class DaemonClient { enabled() { if (this._enabled === undefined) { + // TODO(v18): Add migration to move it out of existing configs and remove the ?? here. const useDaemonProcessOption = this.nxJson.useDaemonProcess ?? this.nxJson.tasksRunnerOptions?.['default']?.options?.useDaemonProcess; diff --git a/packages/nx/src/devkit-exports.ts b/packages/nx/src/devkit-exports.ts index df9b7829115a25..a14192dbc115f3 100644 --- a/packages/nx/src/devkit-exports.ts +++ b/packages/nx/src/devkit-exports.ts @@ -69,6 +69,7 @@ export type { ImplicitDependencyEntry, ImplicitJsonSubsetDependency, NxJsonConfiguration, + TargetDefaults, NxAffectedConfig, } from './config/nx-json'; diff --git a/packages/nx/src/generators/utils/deprecated.ts b/packages/nx/src/generators/utils/deprecated.ts index eb363c1704bd10..0f57cbc5d1ca2b 100644 --- a/packages/nx/src/generators/utils/deprecated.ts +++ b/packages/nx/src/generators/utils/deprecated.ts @@ -40,7 +40,7 @@ export function updateWorkspaceConfiguration( extends: ext, installation, release, - accessToken, + nxCloudAccessToken, cacheDirectory, parallel, useDaemonProcess, @@ -62,7 +62,7 @@ export function updateWorkspaceConfiguration( extends: ext, installation, release, - accessToken, + nxCloudAccessToken, cacheDirectory, parallel, useDaemonProcess, diff --git a/packages/nx/src/tasks-runner/create-task-graph.ts b/packages/nx/src/tasks-runner/create-task-graph.ts index 4676730bc45dd7..412bc2329f62c8 100644 --- a/packages/nx/src/tasks-runner/create-task-graph.ts +++ b/packages/nx/src/tasks-runner/create-task-graph.ts @@ -334,7 +334,8 @@ export class ProcessTasks { target: qualifiedTarget, projectRoot: project.data.root, overrides: interpolateOverrides(overrides, project.name, project.data), - cache: project.data.targets[target].cache, + // TODO(v18): Remove cast here after typing is moved back onto TargetConfiguration + cache: (project.data.targets[target] as any).cache, }; } diff --git a/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts b/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts index 5c5ef847d8e6be..5ac0c5a0ef0ab8 100644 --- a/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts +++ b/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts @@ -1,10 +1,11 @@ +import { readNxJson } from '../../config/nx-json'; import { isNxCloudUsed } from '../../utils/nx-cloud-utils'; import { output } from '../../utils/output'; const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.`; export function viewLogsFooterRows(failedTasks: number) { - if (failedTasks >= 2 && !isNxCloudUsed()) { + if (failedTasks >= 2 && !isNxCloudUsed(readNxJson())) { return [``, output.dim(`${output.X_PADDING} ${VIEW_LOGS_MESSAGE}`)]; } else { return []; diff --git a/packages/nx/src/tasks-runner/run-command.spec.ts b/packages/nx/src/tasks-runner/run-command.spec.ts index 086d61a7bae6b7..4ad8f025029b88 100644 --- a/packages/nx/src/tasks-runner/run-command.spec.ts +++ b/packages/nx/src/tasks-runner/run-command.spec.ts @@ -89,7 +89,7 @@ describe('getRunner', () => { const { tasksRunner } = getRunner( {}, { - accessToken: 'XXXX-XXX-XXXX', + nxCloudAccessToken: 'XXXX-XXX-XXXX', } ); diff --git a/packages/nx/src/tasks-runner/run-command.ts b/packages/nx/src/tasks-runner/run-command.ts index 1fbc629363bca7..c68467fae9058b 100644 --- a/packages/nx/src/tasks-runner/run-command.ts +++ b/packages/nx/src/tasks-runner/run-command.ts @@ -403,7 +403,7 @@ export function getRunner( let runner = nxArgs.runner; runner = runner || 'default'; - if (runner !== 'default' && !nxJson.tasksRunnerOptions[runner]) { + if (runner !== 'default' && !nxJson.tasksRunnerOptions?.[runner]) { throw new Error(`Could not find runner configuration for ${runner}`); } @@ -417,7 +417,12 @@ export function getRunner( return { tasksRunner, - runnerOptions: getRunnerOptions(runner, nxJson, nxArgs), + runnerOptions: getRunnerOptions( + runner, + nxJson, + nxArgs, + modulePath === 'nx-cloud' + ), }; } function getTasksRunnerPath( @@ -433,9 +438,10 @@ function getTasksRunnerPath( return modulePath; } - // No runner prop in tasks runner options, check if access token is set. const isCloudRunner = - nxJson.accessToken || + // No tasksRunnerOptions for given --runner + nxJson.nxCloudAccessToken || + // No runner prop in tasks runner options, check if access token is set. nxJson.tasksRunnerOptions?.[runner]?.options?.accessToken; return isCloudRunner ? 'nx-cloud' : require.resolve('./default-tasks-runner'); @@ -444,7 +450,8 @@ function getTasksRunnerPath( function getRunnerOptions( runner: string, nxJson: NxJsonConfiguration, - nxArgs: NxArgs + nxArgs: NxArgs, + isCloudDefault: boolean ): any { const defaultCacheableOperations = []; @@ -459,8 +466,8 @@ function getRunnerOptions( ...nxArgs, }; - if (nxJson.accessToken) { - result.accessToken ??= nxJson.accessToken; + if (nxJson.nxCloudAccessToken && isCloudDefault) { + result.accessToken ??= nxJson.nxCloudAccessToken; } if (nxJson.parallel) { diff --git a/packages/nx/src/tasks-runner/utils.ts b/packages/nx/src/tasks-runner/utils.ts index 722d9f3c8f048f..0be79f270f7c8b 100644 --- a/packages/nx/src/tasks-runner/utils.ts +++ b/packages/nx/src/tasks-runner/utils.ts @@ -345,7 +345,8 @@ export function isCacheableTask( ): boolean { if ( task.cache !== undefined && - process.env.NX_ALLOW_PROJECT_LEVEL_CACHE === 'true' + process.env.NX_ALLOW_PROJECT_LEVEL_CACHE === 'true' && + !longRunningTask(task) ) { return task.cache; } diff --git a/packages/nx/src/utils/nx-cloud-utils.ts b/packages/nx/src/utils/nx-cloud-utils.ts index ded0d079992e50..572a6b1eb0ce2c 100644 --- a/packages/nx/src/utils/nx-cloud-utils.ts +++ b/packages/nx/src/utils/nx-cloud-utils.ts @@ -1,8 +1,8 @@ -import { readNxJson } from '../config/configuration'; +import { NxJsonConfiguration, readNxJson } from '../config/nx-json'; -export function isNxCloudUsed(nxJson = readNxJson()) { +export function isNxCloudUsed(nxJson: NxJsonConfiguration) { return ( - !!nxJson.accessToken || + !!nxJson.nxCloudAccessToken || Object.values(nxJson.tasksRunnerOptions ?? {}).find( (r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud' ) @@ -10,7 +10,7 @@ export function isNxCloudUsed(nxJson = readNxJson()) { } export function getNxCloudUrl(): string { - const taskRunner = isNxCloudUsed(); + const taskRunner = isNxCloudUsed(readNxJson()); if (!taskRunner) throw new Error('nx-cloud runner not find in nx.json'); return ( (typeof taskRunner === 'object' ? taskRunner.options.url : null) ?? @@ -25,5 +25,5 @@ export function getNxCloudToken(): string { return typeof taskRunner === 'object' ? taskRunner.options.accessToken - : nxJson.accessToken; + : nxJson.nxCloudAccessToken; }