TypeScript driver
Provides TypeScript support by dynamically generating a
tsconfig.json
config file.
If using workspaces, the driver will assume and use project references, by injecting
references
into the root config automatically, and separating compiler options into atsconfig.options.json
file.
#
Requirements- TypeScript ^4.0.0
#
EventsCan be listened to on the TypeScriptDriver
instance.
Event | Arguments | Description |
---|---|---|
onCreateProjectConfigFile | path: Path, config: TypeScriptConfig, isTests: boolean | Called before a workspace package config file is written when using project references. |
#
InstallationIn your configuration module, install the driver and TypeScript.
- Yarn
- NPM
Create a file at configs/typescript.ts
(or js
) in which to house your TypeScript configuration.
#
IntegrationIn your consuming project, enable the driver by adding typescript
to your drivers
config.
#
Commandssync-project-refs
#
Managing project references
manually can be tedious, and honestly, quite hard. Beemo mitigates this by automating the creation
of tsconfig.json
files, with correct project references (based on package dependencies), in every
workspace package.
Run the following command in your project root to make use of this.
By default, the config will compile a src
folder into a lib
folder, while including a local and
global types
folder. A tests
folder will receive a custom config file, which type checks the
folder but does not compile. A represenation of this is as follows:
To customize this process, the following options are available.
buildFolder
(string
) - Name of output directory relative to package root. Defaults tolib
.declarationOnly
(boolean
) - Only emit declaration files for all packages instead of source files. Defaults tofalse
.globalTypes
(boolean
) - Include global types defined in the root (usually cwd). Defaults tofalse
.srcFolder
(string
) - Name of source directory relative to package root. Defaults tosrc
.testsFolder
(string
) - Name of tests directory relative to package root. Defaults totests
.typesFolder
(string
) - Name of local and global types directory. Defaults totypes
.
If your tests are co-located with your source files, the tests specific
tsconfig.json
file will be skipped.