Conventions
Projects that use ts
should adhere to / assume the following conventions:
Source Files & Build Artifacts
Source files should be contained in the directory indicated in compilerOptions.baseUrl
in tsconfig.json
. Build artifacts will be written to compilerOptions.outDir
in tsconfig.json
.
tsconfig.json
determines where source files should be located and where build artifacts will be written to:
The dist
directory should be added to the project's .gitignore
file:
To ensure your package is published correctly, the following should be set in package.json
:
Commit Messages
Change logs will be written to a file in the project root named CHANGELOG.md
.
Path Mapping & Relative Imports
Path mapping is set up such that src
is treated as a root. For example, to import a file at src/lib/utils.ts
from anywhere in your project, your import specifier would be:
Tests
Test files should end in .spec.ts
or .test.ts
and should reside in the src
directory alongside source files.
Last updated