or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

build-operations.mdconfiguration-files.mdconfiguration.mdindex.mdmanual-loading.mdpackage-management.mdversion-management.md

configuration.mddocs/

0

# Configuration Management

1

2

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

3

4

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

5

6

## Capabilities

7

8

### RushConfiguration

9

10

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

11

12

```typescript { .api }

13

/**

14

* Main configuration class for Rush workspaces

15

*/

16

class RushConfiguration {

17

/** Load configuration from the current working directory or nearest parent with rush.json */

18

static loadFromDefaultLocation(): RushConfiguration;

19

20

/** Load configuration from a specific folder path */

21

static loadFromConfigurationFile(rushJsonFilename: string): RushConfiguration;

22

23

/** Try to find rush.json starting from a folder */

24

static tryFindRushJsonLocation(startingFolder: string): string | undefined;

25

26

/** Rush version specified in rush.json */

27

readonly rushVersion: string;

28

29

/** All projects in the workspace */

30

readonly projects: ReadonlyArray<RushConfigurationProject>;

31

32

/** Projects indexed by package name */

33

readonly projectsByName: ReadonlyMap<string, RushConfigurationProject>;

34

35

/** Path to the common folder (typically 'common') */

36

readonly commonFolder: string;

37

38

/** Folder containing rush.json */

39

readonly rushJsonFolder: string;

40

41

/** Resolved path to common/config/rush folder */

42

readonly commonRushConfigFolder: string;

43

44

/** Resolved path to common/temp folder */

45

readonly commonTempFolder: string;

46

47

/** Package manager (npm, pnpm, yarn) */

48

readonly packageManager: string;

49

50

/** Package manager version */

51

readonly packageManagerToolVersion: string;

52

53

/** Node.js version specified in rush.json */

54

readonly nodeSupportedVersionRange?: string;

55

56

/** Repository URL from rush.json */

57

readonly repositoryUrl?: string;

58

59

/** Default branch name */

60

readonly repositoryDefaultBranch: string;

61

62

/** Whether to use workspaces feature */

63

readonly useWorkspaces: boolean;

64

}

65

```

66

67

**Usage Examples:**

68

69

```typescript

70

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

71

72

// Load from current directory

73

const config = RushConfiguration.loadFromDefaultLocation();

74

75

// Access basic properties

76

console.log(`Rush version: ${config.rushVersion}`);

77

console.log(`Package manager: ${config.packageManager}`);

78

console.log(`Projects: ${config.projects.length}`);

79

80

// Find a specific project

81

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

82

if (myProject) {

83

console.log(`Project folder: ${myProject.projectFolder}`);

84

}

85

86

// Iterate through all projects

87

for (const project of config.projects) {

88

console.log(`${project.packageName}: ${project.projectRelativeFolder}`);

89

}

90

```

91

92

### RushConfigurationProject

93

94

Represents an individual project within the Rush workspace.

95

96

```typescript { .api }

97

/**

98

* Represents an individual project in the Rush workspace

99

*/

100

class RushConfigurationProject {

101

/** Package name from package.json */

102

readonly packageName: string;

103

104

/** Project folder relative to rush.json folder */

105

readonly projectRelativeFolder: string;

106

107

/** Absolute path to project folder */

108

readonly projectFolder: string;

109

110

/** Parsed package.json contents */

111

readonly packageJson: IPackageJson;

112

113

/** Package.json file path */

114

readonly packageJsonPath: string;

115

116

/** Whether this is a published package */

117

readonly shouldPublish: boolean;

118

119

/** Project category for organizing in reports */

120

readonly projectCategory?: string;

121

122

/** Review category for approved packages policy */

123

readonly reviewCategory: string;

124

125

/** Cyclics dependencies that are allowed for this project */

126

readonly cyclicDependencyProjects: ReadonlySet<string>;

127

128

/** Local dependencies within the workspace */

129

readonly localDependencies: ReadonlyArray<RushConfigurationProject>;

130

131

/** Consumer projects that depend on this project */

132

readonly consumingProjects: ReadonlyArray<RushConfigurationProject>;

133

134

/** All dependency projects (direct and indirect) */

135

readonly dependencyProjects: ReadonlyArray<RushConfigurationProject>;

136

137

/** Get dependency by package name */

138

tryGetDependency<TProject = RushConfigurationProject>(packageName: string): TProject | undefined;

139

140

/** Check if project depends on another project */

141

dependsOnProject(project: RushConfigurationProject): boolean;

142

}

143

```

144

145

**Usage Examples:**

146

147

```typescript

148

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

149

150

const config = RushConfiguration.loadFromDefaultLocation();

151

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

152

153

if (project) {

154

// Access project information

155

console.log(`Package: ${project.packageName}`);

156

console.log(`Folder: ${project.projectFolder}`);

157

console.log(`Should publish: ${project.shouldPublish}`);

158

159

// Check dependencies

160

console.log(`Local dependencies: ${project.localDependencies.length}`);

161

for (const dep of project.localDependencies) {

162

console.log(` - ${dep.packageName}`);

163

}

164

165

// Check consumers

166

console.log(`Consuming projects: ${project.consumingProjects.length}`);

167

168

// Check if depends on specific project

169

const otherProject = config.projectsByName.get("@mycompany/other-package");

170

if (otherProject && project.dependsOnProject(otherProject)) {

171

console.log("Project depends on other-package");

172

}

173

}

174

```

175

176

### RushProjectConfiguration

177

178

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

179

180

```typescript { .api }

181

/**

182

* Project-specific Rush configuration

183

*/

184

class RushProjectConfiguration {

185

/** Load configuration for a specific project */

186

static loadForProject(project: RushConfigurationProject): RushProjectConfiguration;

187

188

/** Whether incremental builds are disabled for this project */

189

readonly disableBuildCache: boolean;

190

191

/** Custom commands for this project */

192

readonly operationSettingsByOperationName: ReadonlyMap<string, IOperationSettings>;

193

}

194

195

interface IOperationSettings {

196

readonly outputFolderNames?: ReadonlyArray<string>;

197

readonly disableBuildCache?: boolean;

198

}

199

```

200

201

### RushUserConfiguration

202

203

User-specific Rush preferences and settings.

204

205

```typescript { .api }

206

/**

207

* User-specific Rush configuration loaded from ~/.rush-user folder

208

*/

209

class RushUserConfiguration {

210

/** Load user configuration */

211

static loadForRushConfiguration(rushConfiguration: RushConfiguration): RushUserConfiguration;

212

213

/** Build cache credentials */

214

readonly buildCacheCredential?: IBuildCacheCredential;

215

216

/** NPM authentication credentials */

217

readonly npmCredentials: ReadonlyArray<INpmCredential>;

218

}

219

220

interface IBuildCacheCredential {

221

readonly cacheEntryNamePattern?: string;

222

readonly azureStorageAccountName?: string;

223

readonly azureStorageContainerName?: string;

224

}

225

226

interface INpmCredential {

227

readonly packageScope?: string;

228

readonly registryUrl: string;

229

readonly authToken: string;

230

}

231

```