Important
Pastry is archived. Start new libraries from keel, which uses pnpm, tsdown, Adamantite, and Packref.
Pastry is a simple template for open-source packages that use Bun.
-
Select Use this template on GitHub.
-
Clone your new repository.
-
Install the dependencies:
bun install
-
Set the package information:
bun run init
The init command updates package.json, README.md, LICENSE, knip.config.ts, and
tsconfig.json. It removes template documentation, pending changesets, the init command, and
@clack/prompts. It empties CONTEXT.md. Run it only one time.
Write the package source in src. Write tests next to the source or in src/__tests__.
Use these commands:
bun run dev # Build when a source file changes.
bun run build # Build the package in dist.
bun run test # Run the tests.
bun run check # Check lint rules and TypeScript types.
bun run format # Format the files.
bun run analyze # Find unused files and dependencies.- Bun runs scripts and tests.
- Bunup builds the package.
- Adamantite checks and formats the code.
- Changesets manages versions and changelogs.
- GitHub Actions checks, tests, builds, and publishes the package.
- Dependabot updates Bun dependencies and GitHub Actions.
Create a changeset for a change that affects package users:
bun changesetCommit the changeset with the code. The release workflow creates a release pull request. After you merge that pull request, the workflow publishes the package to npm.
Configure npm trusted publishing before the first release. In npm, connect the package to
this GitHub repository and to .github/workflows/release.yml.
See Migrate a project.
Pastry uses the MIT License.