CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-rushstack--rush-sdk

A lightweight proxy API for accessing @microsoft/rush-lib with smart loading and version resolution

Pending
Overview
Eval results
Files

configuration.mddocs/

Configuration Management

Core Rush workspace configuration management including rush.json parsing, project discovery, and workspace structure access.

Note: All APIs in this document are re-exported from @microsoft/rush-lib through @rushstack/rush-sdk.

Capabilities

RushConfiguration

Main configuration class that loads and manages Rush workspace settings from rush.json.

/**
 * Main configuration class for Rush workspaces
 */
class RushConfiguration {
  /** Load configuration from the current working directory or nearest parent with rush.json */
  static loadFromDefaultLocation(): RushConfiguration;
  
  /** Load configuration from a specific folder path */
  static loadFromConfigurationFile(rushJsonFilename: string): RushConfiguration;
  
  /** Try to find rush.json starting from a folder */
  static tryFindRushJsonLocation(startingFolder: string): string | undefined;

  /** Rush version specified in rush.json */
  readonly rushVersion: string;
  
  /** All projects in the workspace */
  readonly projects: ReadonlyArray<RushConfigurationProject>;
  
  /** Projects indexed by package name */
  readonly projectsByName: ReadonlyMap<string, RushConfigurationProject>;
  
  /** Path to the common folder (typically 'common') */
  readonly commonFolder: string;
  
  /** Folder containing rush.json */
  readonly rushJsonFolder: string;
  
  /** Resolved path to common/config/rush folder */
  readonly commonRushConfigFolder: string;
  
  /** Resolved path to common/temp folder */
  readonly commonTempFolder: string;
  
  /** Package manager (npm, pnpm, yarn) */
  readonly packageManager: string;
  
  /** Package manager version */
  readonly packageManagerToolVersion: string;
  
  /** Node.js version specified in rush.json */
  readonly nodeSupportedVersionRange?: string;
  
  /** Repository URL from rush.json */
  readonly repositoryUrl?: string;
  
  /** Default branch name */
  readonly repositoryDefaultBranch: string;
  
  /** Whether to use workspaces feature */
  readonly useWorkspaces: boolean;
}

Usage Examples:

import { RushConfiguration } from "@rushstack/rush-sdk";

// Load from current directory
const config = RushConfiguration.loadFromDefaultLocation();

// Access basic properties
console.log(`Rush version: ${config.rushVersion}`);
console.log(`Package manager: ${config.packageManager}`);
console.log(`Projects: ${config.projects.length}`);

// Find a specific project
const myProject = config.projectsByName.get("@mycompany/my-package");
if (myProject) {
  console.log(`Project folder: ${myProject.projectFolder}`);
}

// Iterate through all projects
for (const project of config.projects) {
  console.log(`${project.packageName}: ${project.projectRelativeFolder}`);
}

RushConfigurationProject

Represents an individual project within the Rush workspace.

/**
 * Represents an individual project in the Rush workspace
 */
class RushConfigurationProject {
  /** Package name from package.json */
  readonly packageName: string;
  
  /** Project folder relative to rush.json folder */
  readonly projectRelativeFolder: string;
  
  /** Absolute path to project folder */
  readonly projectFolder: string;
  
  /** Parsed package.json contents */
  readonly packageJson: IPackageJson;
  
  /** Package.json file path */
  readonly packageJsonPath: string;
  
  /** Whether this is a published package */
  readonly shouldPublish: boolean;
  
  /** Project category for organizing in reports */
  readonly projectCategory?: string;
  
  /** Review category for approved packages policy */
  readonly reviewCategory: string;
  
  /** Cyclics dependencies that are allowed for this project */
  readonly cyclicDependencyProjects: ReadonlySet<string>;
  
  /** Local dependencies within the workspace */
  readonly localDependencies: ReadonlyArray<RushConfigurationProject>;
  
  /** Consumer projects that depend on this project */
  readonly consumingProjects: ReadonlyArray<RushConfigurationProject>;
  
  /** All dependency projects (direct and indirect) */
  readonly dependencyProjects: ReadonlyArray<RushConfigurationProject>;
  
  /** Get dependency by package name */
  tryGetDependency<TProject = RushConfigurationProject>(packageName: string): TProject | undefined;
  
  /** Check if project depends on another project */
  dependsOnProject(project: RushConfigurationProject): boolean;
}

Usage Examples:

import { RushConfiguration } from "@rushstack/rush-sdk";

const config = RushConfiguration.loadFromDefaultLocation();
const project = config.projectsByName.get("@mycompany/my-package");

if (project) {
  // Access project information
  console.log(`Package: ${project.packageName}`);
  console.log(`Folder: ${project.projectFolder}`);
  console.log(`Should publish: ${project.shouldPublish}`);
  
  // Check dependencies
  console.log(`Local dependencies: ${project.localDependencies.length}`);
  for (const dep of project.localDependencies) {
    console.log(`  - ${dep.packageName}`);
  }
  
  // Check consumers
  console.log(`Consuming projects: ${project.consumingProjects.length}`);
  
  // Check if depends on specific project
  const otherProject = config.projectsByName.get("@mycompany/other-package");
  if (otherProject && project.dependsOnProject(otherProject)) {
    console.log("Project depends on other-package");
  }
}

RushProjectConfiguration

Project-specific Rush configuration loaded from rush-project.json.

/**
 * Project-specific Rush configuration
 */
class RushProjectConfiguration {
  /** Load configuration for a specific project */
  static loadForProject(project: RushConfigurationProject): RushProjectConfiguration;
  
  /** Whether incremental builds are disabled for this project */
  readonly disableBuildCache: boolean;
  
  /** Custom commands for this project */
  readonly operationSettingsByOperationName: ReadonlyMap<string, IOperationSettings>;
}

interface IOperationSettings {
  readonly outputFolderNames?: ReadonlyArray<string>;
  readonly disableBuildCache?: boolean;
}

RushUserConfiguration

User-specific Rush preferences and settings.

/**
 * User-specific Rush configuration loaded from ~/.rush-user folder
 */
class RushUserConfiguration {
  /** Load user configuration */
  static loadForRushConfiguration(rushConfiguration: RushConfiguration): RushUserConfiguration;
  
  /** Build cache credentials */
  readonly buildCacheCredential?: IBuildCacheCredential;
  
  /** NPM authentication credentials */
  readonly npmCredentials: ReadonlyArray<INpmCredential>;
}

interface IBuildCacheCredential {
  readonly cacheEntryNamePattern?: string;
  readonly azureStorageAccountName?: string;
  readonly azureStorageContainerName?: string;
}

interface INpmCredential {
  readonly packageScope?: string;
  readonly registryUrl: string;
  readonly authToken: string;
}

Install with Tessl CLI

npx tessl i tessl/npm-rushstack--rush-sdk

docs

build-operations.md

configuration-files.md

configuration.md

index.md

manual-loading.md

package-management.md

version-management.md

tile.json