A minimal starter kit designed to build and publish a npm package with ease.
- Typescript for writing our code and keeping it type-safe
- Turborepo for increased performance and faster builds
- @arethetypeswrong/cli for checking our exports
- tsup for compiling our TypeScript code into CJS and ESM
- Vitest for running our tests
- GitHub Actions for running our CI process
- Changesets for versioning and publishing our package
- Biome for formatting
- pnpm as fast, efficient package-manager
- Git for version control
- Fork the repository
- Clone the repository
git clone https://github.com/<your_github_username>/npm-starter-kit.git
- Navigate to the directory
cd npm-package-stack
- Make sure you edit the below properties in the
package.json
file- name
- version
- description
- homepage
- repository
- keywords
- author
- license
- Install dependencies
pnpm install
- For more scripts refer to
package.json
file
Make sure you have Node.js and pnpm installed in your machine
pnpm build
- compiles the typescript code usingtsup
withtsup.config.ts
file as configurationpnpm lint
- lints the project usingtsc
pnpm check-exports
- checks if allexports
from the package are correctpnpm run ci
- runs the CI process for GitHub actionspnpm format
- formats the project using biomepnpm format:check
- check if all files in the project are formatted correctlypnpm test
- test the project usingvitest
pnpm dev
- test the project usingvitest
in watch modepnpm local-release
- runchangeset version
and publish the package to npm usingpnpm run release
pnpm release
- run thepublish-package
script using turbopnpm publish-package
- publish the package to npm usingchangeset publish
# GitHub
.
├── src
│ ├── functions.ts
│ ├── index.ts
│ └── types.ts
├── .gitignore
├── .npmignore
├── biome.json
├── package.json
├── pnpm-lock.yaml
├── README.md
├── tsconfig.json
├── tsup.config.ts
└── turbo.json
# Npm
.
├── dist
│ ├── index.d.mts
│ ├── index.d.ts
│ ├── index.js
│ └── index.mjs
├── CHANGELOG.md
├── LICENSE
├── README.md
└── package.json
If you found this project helpful or enjoyed using it, please consider giving it a ⭐️ on GitHub! It helps others find the project and motivates us to keep improving.