Template repository to create Internal library and private NPM package.
This template comes with two pre-configured github workflows to make your life easier:
- publish.yml :
- Increments the package revision
- Builds the package using the
bun run build
- Publishes it to the NPM Registry
- Commits the build and new version to
main
- Triggers a release
- release.yml :
- Bundles the build directory (
/lib
) in a zip file based on the current version - Authors a new github release
- Bundles the build directory (
Bun comes with typescript support out of the box.
Some basic utility types are also included.
- Config validator
- Logger
-
Fork this repository or select it as a starting template when creating a new repository.
-
Go to your new repository's secrets settings and add the following values.
NPM_TOKEN
: Personal access token generated in your account settings.
- Clone and navigate to your new repository.
git clone <my repository>
cd <my repository name>
- Edit
package.json
with your package information.
# nano
nano package.json
# neovim
nvim package.json
# vscode
code package.json
# webstorm
webstorm package.json
name
: your package's namedescription
: your package descriptionauthor
: your name and npm emailhomepage
: your repository's URLrepository.url
: your repository's URLscripts.build
: a script to build your package before publishing it
- Start writing your package ! 🚀
Make sure to replace this README.md
file with documentation about your package.
Once you're satisfied with the current state of your package and have committed it to / merged it onto the main
branch, you'll want to publish it.
To publish your package to the NPM registry:
- Navigate to the Actions tab of your repository
- Select
NPM Publish
in the side menu - Click on
Run workflow
in the dark blue banner - Wait for it to finish
Note: Upon successful publishing to NPM, the Relase create
workflow will automatically run.