A generic library template starter for brand new libraries.
Features | Description |
---|---|
🚀 Quick Setup | Initialize your library with a single command using pnpm setup:template |
📦 Modern Build System | Built with tsup for fast, modern builds supporting ESM and CJS |
🔄 Automatic Releases | Optional automated publishing and version management with changesets |
🔍 PR Preview | Optional package preview builds for every PR and commit with pkg.pr.new |
🎯 TypeScript Ready | Full TypeScript support with strict type checking |
🧹 Code Quality | ESLint and Prettier pre-configured for code quality |
⚛️ React Support | React support with proper peer dependencies React 19 + React Compiler ready |
🔒 Type Safety | Strict TypeScript configuration for better type safety |
This template has sample data by default. So run the setup script as soon as you fork & clone.
pnpm setup:template
This will fill package information and install deps for you. Remember to commit.
If you enable PR & commit package preview you need to install PKG.PR.NEW on the target repository.
author: joyco.studio
publishConfig.access: public
version: 0.0.0
license: ISC
If you DON't need react as a peer dependency you NEED to delete it.
# 1. Remove both the devDependencies and peerDependencies
pnpm remove @types/react react
Then manually remove the peerDependencies section from package.json
and also check eslint.config.js
, tsconfig.json
.
This template comes with two GitHub Actions workflows (currently disabled for convenience):
-
Release Workflow (
.github/workflows/release.yml.disabled
): Automates the release process using Changesets. When enabled, it will automatically create release pull requests and publish to npm when changes are pushed to the main branch. -
Publish Any Commit (
.github/workflows/publish-any-commit.yml.disabled
): A utility workflow that can build and publish packages for any commit or pull request.
To enable these workflows, simply remove the .disabled
extension from the workflow files in the .github/workflows/
directory. We recommend enabling them to automate your package's release process.
This library uses Changesets to manage versions and publish releases. Here's how to use it:
When you make changes that need to be released:
pnpm changeset
This will prompt you to:
- Select which packages you want to include in the changeset
- Choose whether it's a major/minor/patch bump
- Provide a summary of the changes
To create a new version and update the changelog:
# 1. Create new versions of packages
pnpm version:package
# 2. Release (builds and publishes to npm)
pnpm release
Remember to commit all changes after creating a release.