@zero-version/tsc-link.cli
v9.9.14
Published
Update a TypeScript package's tsconfig.json with paths to other packages in a monorepo.
Downloads
25
Maintainers
Readme
Update a TypeScript package's tsconfig.json with paths to other packages in a monorepo.
Usage
Usage: tsc-link [options]
Update a TypeScript package's tsconfig.json with paths to other packages in a monorepo.
Options:
-d, --projectDir <dir> The project directory (default: `process.cwd()`)
-w, --wildcard-path <path> wildcard path (default: "src/*")
-f, --index-file-path <path> index file path (default: "src/index.ts")
-o, --option <option> option (choices: "index-only", "wildcard-only", "both", default: "index-only")
-p, --preserve preserve existing path settings
-V, --version output the version number
-h, --help display help for command
Example
Given the following monorepo structure where project-b
has a dependency on project-a
:
packages/
├── project-a/
│ ├── src/
│ │ ├── ClassA.ts
│ │ ├── IInterfaceA.ts
│ │ └── index.ts
│ ├── package.json
│ └── tsconfig.json
└── project-b/
├── src/
│ ├── ClassB.ts
│ └── index.ts
├── package.json
└── tsconfig.json
Running tsc-link
with default options will set the paths in the tsconfig.json for project-b
to the following:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"project-a": ["../project-a/src/index.ts"],
"project-a/*": ["../project-a/src/*"]
}
}
}
Support ☕
Are you using a package I've developed and finding it useful? Or have you looked at one of my repositories and learnt something new? If so, please consider buying me a coffee. Thanks!