TS-Hajime: Effortlessly Bootstrap Typescript NPM Libraries
2 min readOct 14, 2024
I made a library that can easily bootstrap your TypeScript library with better DX tools. It focuses on minimal setup and visual clarity.
Features:
- Sensible defaults.
- Built with DX tools like
pkgroll
,tsx
,tsup
,vitest
, andclieye
. - Preconfigured
tsconfig
,eslint
,vitest
,prettier
,package.json
, and.gitignore
files. - Ready-to-use GitHub Actions, pre-commit hooks, and npm scripts.
- Examples and tests included for both library code and
npx
commands. - Write
npx
commands directly in TypeScript. - Outputs both ESM and CJS modules.
- (VSCode)Pre-configured with file nesting, auto-prettify on save, and a specified TypeScript TSDK path.
- Exposed configurations allow for complete customization to fit your needs.
To get started:
- Run the command below to bootstrap your project:
npx ts-hajime your-app-name-here
Here’s what your project structure will look like:
2. Replace all occurrences of my-app
with your app’s name and my-description
with a description.
Key commands:
- Build:
npm run build
- Test:
npm test
- Lint & Fix:
npm run lint
- Type Check:
npm run tsc
(Note: Type checking is automatically done in GitHub Actions as part of the build step withpkgroll
.) - Try
npx
Command Locally:npm run npx something
(Modify thenpx
script inpackage.json
to suit your project requirements.)
Remember to star it if you like it!