@repobuddy/typescript
@repobuddy/typescript ships tsconfig presets that you extend, and a plugin that adds ts commands to the
buddy CLI.
Install
Section titled “Install”# npmnpm install -D @repobuddy/typescript
# yarnyarn add -D @repobuddy/typescript
# pnpmpnpm add -D @repobuddy/typescript
# rushrush add -p --dev @repobuddy/typescriptThe package does not declare TypeScript as a peer dependency. Install the TypeScript version your project needs.
Choose an entry
Section titled “Choose an entry”| You want to | Use |
|---|---|
| Configure a package in a monorepo with one line | tsconfig/monorepo |
The same settings, without an extends array |
tsconfig/legacy/monorepo |
| Pick settings one category at a time | Building blocks |
| Mark a build output folder as CommonJS | nodejs/package.cjs.json |
Run tsc for a CommonJS build and add that marker |
buddy ts build |
| Add the marker after your own build step | buddy ts copy-cjs-package-json |
Guides
Section titled “Guides”Support
Section titled “Support”| Area | Support |
|---|---|
| TypeScript | No peer range is declared. The repository builds the package with TypeScript 7 (devDependencies: typescript ^7.0.0). |
extends arrays |
tsconfig/monorepo and emit/buddy use an extends array, which TypeScript 5.0 added. tsconfig/legacy/monorepo inlines the same options for older versions and for tools that cannot follow an array. |
| Legacy module files | modules/commonjs-legacy and modules/es2020-legacy are for older TypeScript. Both fail on TypeScript 6 and 7. See Modules. |
| Module format | The JavaScript entry (the CLI plugin) is ESM only: the . export has an import condition and no require condition. The tsconfig and nodejs/* files are plain JSON. |
| CLI host | The ts commands run inside the buddy CLI from the repobuddy package. |
| Monorepo and single package | The presets work for either. tsconfig/monorepo turns on composite for project references. |
Checked against TypeScript 6.0.3 and 7.0.2: every tsconfig file compiles except the three listed under Known failures.
Not supported
Section titled “Not supported”- No
buddy ts initorbuddy ts upcommand. The plugin registers onlybuildandcopy-cjs-package-json. - No CommonJS entry for the plugin.
require('@repobuddy/typescript')fails. buddy ts builddoes not take a custom tsconfig path, extratscflags, or a watch mode. It always runstsc -p tsconfig.<type>.json.buddy ts builddoes not printtscoutput on success.- No preset sets
lib,types,outDir, orrootDir. Set them in your owntsconfig.json.