CLI plugin
@repobuddy/typescript is a plugin for the buddy CLI from the repobuddy package. Once the
plugin is listed in the repobuddy config, buddy ts gains two commands. The commands are in beta.
| Command | Purpose |
|---|---|
buddy ts build <type> |
Run tsc -p tsconfig.<type>.json, then mark cjs and tslib output as CommonJS |
buddy ts copy-cjs-package-json <dir> [cwd] |
Copy package.cjs.json into <cwd>/<dir>/package.json. Alias: cpj |
Enable the plugin
Section titled “Enable the plugin”-
Install both packages:
Terminal window pnpm add -D repobuddy @repobuddy/typescript -
List the plugin in a
.repobuddy.jsonfile at the project root:{"plugins": ["@repobuddy/typescript"]}Or add a
repobuddyproperty topackage.json:{"repobuddy": {"plugins": ["@repobuddy/typescript"]}} -
Check that the commands load:
Terminal window pnpm exec buddy ts --helpUsage: repobuddy ts <command>Commands:build, copy-cjs-package-json (cpj)
How the plugin loads
Section titled “How the plugin loads”- The package’s only JavaScript export is an
activate(cli)function. It registers one command group,ts, that holdsbuildandcopy-cjs-package-json. - The
buddyCLI reads therepobuddyconfig throughclibuilder. It searches from the current directory up to the filesystem root for a config file (such as.repobuddy.json,repobuddy.json,.repobuddyrc,.repobuddy.yml, or.repobuddy.js). If none exists, it uses therepobuddyproperty of the nearestpackage.json. - For each name in
plugins, the CLI resolves the module from the current directory and imports it. The package must be installed in the project you runbuddyfrom. buddy --show-configprints which config the CLI found and its content.
Errors
Section titled “Errors”- If the plugin cannot be resolved,
buddyprintsUnable to load plugin from @repobuddy/typescriptandnot a valid plugin @repobuddy/typescript, then runs without thetscommands. - If no config lists the plugin,
buddy tsdoes not exist.