Generate a new Bun module in seconds!
This is a generator repository for creating new Bun modules. It provides a starter template with all the scaffolding you need to build and publish Bun modules.
Click "Use this template" on GitHub or clone it:
git clone https://github.com/zenobi-us/bun-module.git my-module
cd my-module./setup.shThe generator will ask for:
- Module name - kebab-case identifier (e.g.,
my-awesome-module) - Description - What your module does
- Author name - Your name
- Author email - Your email
- Repository URL - GitHub repo URL
- GitHub org/username - For workflow configuration
cd my-module
bun install
mise run buildAfter running the generator, you'll have:
- ✅ TypeScript setup with modern tooling
- ✅ ESLint + Prettier configuration
- ✅ GitHub Actions workflows (build, lint, release)
- ✅ Bun module scaffolding
- ✅ Ready-to-use test setup
- ✅ Clean git history with initial commit
The generator cleans itself up - no template files or setup script left behind!
# Generate a new module (interactive prompts)
./setup.sh generate
# Show help
./setup.sh help
# Show version
./setup.sh versionYou can skip prompts by setting environment variables with the BUNMODULE_ prefix:
# Provide all values via environment variables
BUNMODULE_MODULENAME="my-awesome-module" \
BUNMODULE_DESCRIPTION="An awesome Bun module" \
BUNMODULE_AUTHORNAME="John Doe" \
BUNMODULE_AUTHOREMAIL="john@example.com" \
BUNMODULE_REPOSITORYURL="https://github.com/username/my-awesome-module" \
BUNMODULE_GITHUBORG="username" \
./setup.sh generateAvailable Environment Variables:
BUNMODULE_MODULENAME- Module name (kebab-case)BUNMODULE_DESCRIPTION- Module descriptionBUNMODULE_AUTHORNAME- Author nameBUNMODULE_AUTHOREMAIL- Author emailBUNMODULE_REPOSITORYURL- Repository URLBUNMODULE_GITHUBORG- GitHub organization/username
This is useful for:
- CI/CD pipelines
- Automated module generation
- Scripted workflows
Generated modules have this structure:
my-module/
├── src/
│ ├── index.ts # Module entry point
│ └── something/else.ts # All the things!
├── .github/
│ └── workflows/ # CI/CD workflows
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript config
└── README.md # Your module's documentation
bun install # Install dependencies
mise run setup # Initial setup
mise run build # Build the module
mise run test # Run tests
mise run lint # Lint code
mise run lint:fix # Fix linting issues
mise run format # Format code with Prettier
mise run pkgjsonlint # Lint package.json
mise run prepare # Prepare for release
mise run publish # Publish the module
mise run version # Manage versionSee RELEASE.md for publishing and release management details.
TL;DR: Push single commits to main with conventional commit format. Release-please will accumulate changes in a release PR. When this release PR is merged, a new minor version is released and published to npm. Until then, all other commits on main result in patch builds being published.
MIT
Need help?
- Check the Bun documentation
- Open an issue on GitHub
- Review the template documentation