Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
is-nx-cloud-used.ts1.36 kB
import { importNxPackagePath, readNxJson } from '@nx-console/shared-npm'; import { Logger } from '@nx-console/shared-utils'; import type { NxJsonConfiguration } from 'nx/src/devkit-exports'; export async function isNxCloudUsed( workspacePath: string, logger?: Logger, ): Promise<boolean> { let nxJson: NxJsonConfiguration; try { nxJson = await readNxJson(workspacePath); } catch (e) { return false; } if (!nxJson) { return false; } let getIsNxCloudUsed: (nxJson: NxJsonConfiguration) => boolean; try { // try to use nx utils if they exist const nxCloudUtils = await importNxPackagePath< typeof import('nx/src/utils/nx-cloud-utils') >(workspacePath, 'src/utils/nx-cloud-utils', logger); getIsNxCloudUsed = nxCloudUtils.isNxCloudUsed; } catch (e) { // fallback implementation, copied from nx getIsNxCloudUsed = (nxJson: NxJsonConfiguration) => { if (process.env.NX_NO_CLOUD === 'true' || nxJson.neverConnectToCloud) { return false; } return ( !!process.env.NX_CLOUD_ACCESS_TOKEN || !!nxJson.nxCloudAccessToken || !!nxJson.nxCloudId || !!Object.values(nxJson.tasksRunnerOptions ?? {}).find( (r) => r?.runner == '@nrwl/nx-cloud' || r?.runner == 'nx-cloud', ) ); }; } return getIsNxCloudUsed(nxJson); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nrwl/nx-console'

If you have feedback or need assistance with the MCP directory API, please join our Discord server