barrel-rider-sidecar2
v2.0.1
Published
create index sidecar files for typescript
Downloads
26
Readme
barrel-rider-sidecar
Create Index Files for Typescript
(This helps ensure that input names are consistent and makes it so you don't have to manually create barrel files or named export objects. This makes classless and functional programming smoother.)
Based roughly on https://github.com/sw-yx/barrelbot
Usage
Run against a source directory:
yarn start --src srcWatch mode:
yarn start --watch --src srcMultiple source roots are supported:
yarn start --src src toolsView all available options:
yarn start --helpBehavior
- Scans
.tsand.tsxfiles and writes sibling-sidecar.tsfiles - Skips
index.*,.d.ts, test files, files insidenode_modules, and temporary" copy"files - Removes stale generated sidecars when
--removeis provided - Removes sidecar files and exits without scanning when
--removeOnlyis provided - Leaves files alone when they begin with
// barrel-rider:ignoreor// sidecar:ignore
Testing
Testing is manual, and also serves as examples of when the sidecar files are generated.
Run the normal manual test flow with:
yarn testThis generates sidecar files in the test directory and then verifies:
- every source file without
ignoreMein its name has a matching-sidecar.ts - every source file with
ignoreMein its name does not have a matching-sidecar.ts
Reset the test environment and exercise the --removeOnly cleanup flow with:
yarn clean-testThis removes sidecar files from the test directory and then verifies that no generated -sidecar files remain.
For a fuller manual confidence pass, run:
yarn smoke-testThis runs clean-test, test, and build in sequence.
VS Code
You may want to hide generated sidecar files in your IDE. For VSCode:
"files.exclude": {
"**/*-sidecar.ts": true
}