or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mdindex.mdpackage-inspection.mdpackage-management.mdscript-running.mdstore-management.mdworkspace-management.md

package-management.mddocs/

0

# Package Management

1

2

Core package management operations for installing, adding, removing, and updating Node.js packages with pnpm's fast, space-efficient approach.

3

4

## Capabilities

5

6

### Install Dependencies

7

8

Install all dependencies from package.json using the lockfile for reproducible builds.

9

10

```bash { .api }

11

/**

12

* Install all dependencies from package.json

13

* Uses pnpm-lock.yaml for deterministic installations

14

*/

15

pnpm install [options]

16

pnpm i [options]

17

```

18

19

**Options:**

20

- `--frozen-lockfile` - Don't generate lockfile and fail if update is needed

21

- `--offline` - Don't make network requests, use cached packages only

22

- `--prefer-offline` - Use cached packages when available

23

- `--production` - Only install production dependencies

24

- `--dev` - Only install development dependencies

25

- `--ignore-scripts` - Don't run lifecycle scripts

26

27

**Usage Examples:**

28

29

```bash

30

# Standard install

31

pnpm install

32

33

# Production-only install

34

pnpm install --production

35

36

# Install without updating lockfile

37

pnpm install --frozen-lockfile

38

39

# Offline install from cache

40

pnpm install --offline

41

```

42

43

### Add Packages

44

45

Add new packages to dependencies with automatic package.json and lockfile updates.

46

47

```bash { .api }

48

/**

49

* Add packages to dependencies

50

* Updates package.json and pnpm-lock.yaml

51

*/

52

pnpm add <pkg>[@version] [options]

53

```

54

55

**Options:**

56

- `--save-dev`, `-D` - Add to devDependencies

57

- `--save-prod`, `-P` - Add to dependencies (default)

58

- `--save-optional`, `-O` - Add to optionalDependencies

59

- `--save-exact`, `-E` - Save exact version instead of range

60

- `--global`, `-g` - Install globally

61

- `--workspace` - Add as workspace dependency

62

63

**Usage Examples:**

64

65

```bash

66

# Add production dependency

67

pnpm add lodash

68

69

# Add development dependency

70

pnpm add -D typescript

71

72

# Add specific version

73

pnpm add react@18.2.0

74

75

# Add with exact version

76

pnpm add -E prettier

77

78

# Add multiple packages

79

pnpm add lodash axios express

80

81

# Add global package

82

pnpm add -g pm2

83

```

84

85

### Remove Packages

86

87

Remove packages from dependencies and clean up package.json and lockfile.

88

89

```bash { .api }

90

/**

91

* Remove packages from dependencies

92

* Updates package.json and pnpm-lock.yaml

93

*/

94

pnpm remove <pkg> [options]

95

pnpm rm <pkg> [options]

96

pnpm uninstall <pkg> [options]

97

pnpm un <pkg> [options]

98

pnpm uni <pkg> [options]

99

```

100

101

**Options:**

102

- `--global`, `-g` - Remove from global packages

103

- `--save-dev`, `-D` - Remove from devDependencies only

104

- `--save-prod`, `-P` - Remove from dependencies only

105

106

**Usage Examples:**

107

108

```bash

109

# Remove package

110

pnpm remove lodash

111

112

# Remove multiple packages

113

pnpm remove lodash axios

114

115

# Remove development dependency

116

pnpm remove -D typescript

117

118

# Remove global package

119

pnpm remove -g pm2

120

```

121

122

### Update Packages

123

124

Update packages to their latest versions based on version ranges in package.json.

125

126

```bash { .api }

127

/**

128

* Update packages to latest compatible versions

129

* Respects version ranges in package.json

130

*/

131

pnpm update [pkg] [options]

132

pnpm up [pkg] [options]

133

pnpm upgrade [pkg] [options]

134

```

135

136

**Options:**

137

- `--latest`, `-L` - Update to latest versions ignoring ranges

138

- `--global`, `-g` - Update global packages

139

- `--recursive`, `-r` - Update in all workspace packages

140

- `--interactive`, `-i` - Interactive update mode

141

- `--prod` - Update only production dependencies

142

- `--dev` - Update only development dependencies

143

144

**Usage Examples:**

145

146

```bash

147

# Update all packages

148

pnpm update

149

150

# Update specific package

151

pnpm update react

152

153

# Update to latest versions

154

pnpm update --latest

155

156

# Interactive update

157

pnpm update --interactive

158

159

# Update in all workspaces

160

pnpm update --recursive

161

```

162

163

### Link Packages

164

165

Link local packages for development and testing across projects.

166

167

```bash { .api }

168

/**

169

* Link local packages for development

170

* Creates symlinks for local development workflow

171

*/

172

pnpm link [path] [options]

173

pnpm ln [path] [options]

174

```

175

176

**Options:**

177

- `--global`, `-g` - Link to global packages

178

- `--dir <path>` - Specify target directory

179

180

**Usage Examples:**

181

182

```bash

183

# Link current package globally

184

pnpm link

185

186

# Link to specific package

187

pnpm link ../my-other-package

188

189

# Link global package to current project

190

pnpm link --global some-package

191

```

192

193

### Unlink Packages

194

195

Remove previously created package links.

196

197

```bash { .api }

198

/**

199

* Remove package links

200

* Removes symlinks created by pnpm link

201

*/

202

pnpm unlink [pkg] [options]

203

pnpm dislink [pkg] [options]

204

```

205

206

**Usage Examples:**

207

208

```bash

209

# Unlink current package

210

pnpm unlink

211

212

# Unlink specific package

213

pnpm unlink some-package

214

```

215

216

### Clean Install (CI)

217

218

Perform clean installation optimized for continuous integration environments.

219

220

```bash { .api }

221

/**

222

* Clean install from lockfile for CI environments

223

* Removes node_modules and installs from lockfile only

224

*/

225

pnpm ci [options]

226

pnpm clean-install [options]

227

pnpm ic [options]

228

pnpm install-clean [options]

229

```

230

231

**Usage Examples:**

232

233

```bash

234

# Clean install for CI

235

pnpm ci

236

237

# Clean install with production only

238

pnpm ci --production

239

```

240

241

### Import Lockfiles

242

243

Generate pnpm-lock.yaml from other package manager lockfiles.

244

245

```bash { .api }

246

/**

247

* Import lockfile from other package managers

248

* Converts package-lock.json or yarn.lock to pnpm-lock.yaml

249

*/

250

pnpm import [options]

251

```

252

253

**Usage Examples:**

254

255

```bash

256

# Import from package-lock.json

257

pnpm import

258

259

# Import in workspace

260

pnpm import --recursive

261

```

262

263

### Prune Dependencies

264

265

Remove extraneous packages not listed in package.json.

266

267

```bash { .api }

268

/**

269

* Remove extraneous packages

270

* Cleans up packages not in package.json

271

*/

272

pnpm prune [options]

273

```

274

275

**Options:**

276

- `--production` - Remove devDependencies

277

- `--no-optional` - Remove optionalDependencies

278

279

**Usage Examples:**

280

281

```bash

282

# Remove all extraneous packages

283

pnpm prune

284

285

# Remove devDependencies (production mode)

286

pnpm prune --production

287

```

288

289

### Deduplicate Dependencies

290

291

Remove duplicate dependencies by updating the lockfile.

292

293

```bash { .api }

294

/**

295

* Remove duplicate dependencies

296

* Optimizes dependency tree in lockfile

297

*/

298

pnpm dedupe [options]

299

```

300

301

**Usage Examples:**

302

303

```bash

304

# Deduplicate all dependencies

305

pnpm dedupe

306

```

307

308

### Fetch Packages

309

310

Download packages to the store without installing to node_modules.

311

312

```bash { .api }

313

/**

314

* Download packages to store without installing

315

* Pre-populates store for faster subsequent installs

316

*/

317

pnpm fetch [options]

318

```

319

320

**Options:**

321

- `--dev` - Fetch devDependencies

322

- `--prod` - Fetch production dependencies only

323

324

**Usage Examples:**

325

326

```bash

327

# Fetch all dependencies

328

pnpm fetch

329

330

# Fetch production dependencies only

331

pnpm fetch --prod

332

```

333

334

### Rebuild Packages

335

336

Rebuild native modules and run install scripts.

337

338

```bash { .api }

339

/**

340

* Rebuild native modules

341

* Recompiles packages with native dependencies

342

*/

343

pnpm rebuild [pkg] [options]

344

pnpm rb [pkg] [options]

345

```

346

347

**Usage Examples:**

348

349

```bash

350

# Rebuild all packages

351

pnpm rebuild

352

353

# Rebuild specific package

354

pnpm rebuild node-sass

355

356

# Rebuild in workspace

357

pnpm rebuild --recursive

358

```

359

360

### Patch Management

361

362

Create and manage package patches for local modifications.

363

364

```bash { .api }

365

/**

366

* Create package patches for local modifications

367

* Allows temporary fixes to packages

368

*/

369

pnpm patch <pkg> [options]

370

```

371

372

**Usage Examples:**

373

374

```bash

375

# Create patch for package

376

pnpm patch react@18.2.0

377

378

# Patch with specific edit directory

379

pnpm patch lodash --edit-dir /tmp/lodash-patch

380

```

381

382

### Commit Package Patches

383

384

Commit changes made to a patched package.

385

386

```bash { .api }

387

/**

388

* Commit changes to package patch

389

* Finalizes modifications made during patch editing

390

*/

391

pnpm patch-commit <path> [options]

392

```

393

394

**Usage Examples:**

395

396

```bash

397

# Commit patch changes

398

pnpm patch-commit /tmp/pnpm-patch-123

399

400

# Commit with specific patch directory

401

pnpm patch-commit ./patches/react-patch

402

```

403

404

### Remove Package Patches

405

406

Remove package patches and revert to original versions.

407

408

```bash { .api }

409

/**

410

* Remove package patch

411

* Reverts package to unpatched state

412

*/

413

pnpm patch-remove <pkg> [options]

414

```

415

416

**Usage Examples:**

417

418

```bash

419

# Remove patch for package

420

pnpm patch-remove react@18.2.0

421

422

# Remove all patches

423

pnpm patch-remove --all

424

```

425

426

### Pack Packages

427

428

Create package tarballs for distribution and publishing.

429

430

```bash { .api }

431

/**

432

* Create package tarballs for distribution

433

* Creates .tgz files ready for publishing or sharing

434

*/

435

pnpm pack [options]

436

```

437

438

**Options:**

439

- `--pack-destination <dir>` - Specify output directory for tarball

440

- `--pack-gzip-level <level>` - Set compression level (0-9)

441

442

**Usage Examples:**

443

444

```bash

445

# Pack current package

446

pnpm pack

447

448

# Pack with custom destination

449

pnpm pack --pack-destination ./dist

450

451

# Pack with custom compression

452

pnpm pack --pack-gzip-level 9

453

```

454

455

### Publish Packages

456

457

Publish packages to the npm registry or private registries.

458

459

```bash { .api }

460

/**

461

* Publish packages to registry

462

* Uploads package to npm registry or private registry

463

*/

464

pnpm publish [tarball|folder] [options]

465

```

466

467

**Options:**

468

- `--tag <tag>` - Publish with specific tag (default: latest)

469

- `--access <public|restricted>` - Set package access level

470

- `--registry <url>` - Specify registry URL

471

- `--otp <token>` - One-time password for 2FA

472

- `--dry-run` - Show what would be published without publishing

473

- `--no-git-checks` - Skip git status checks

474

- `--recursive`, `-r` - Publish in all workspace packages

475

476

**Usage Examples:**

477

478

```bash

479

# Publish current package

480

pnpm publish

481

482

# Publish with tag

483

pnpm publish --tag beta

484

485

# Publish as public package

486

pnpm publish --access public

487

488

# Dry run to check what would be published

489

pnpm publish --dry-run

490

491

# Publish all workspace packages

492

pnpm publish --recursive

493

494

# Publish specific tarball

495

pnpm publish my-package-1.0.0.tgz

496

```