Generated SSH key with ssh-keygen -t ed25519 -C "[email protected]" -f your_package_name
-
Get the public key with:
cat your_package_name.pub
You will get an output like this:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC ...
-
Get the private key with:
cat your_package_name
You will get an output like this:
-----BEGIN OPENSSH PRIVATE KEY----- ... -----END OPENSSH PRIVATE KEY-----
-
Generate a GPG key with
gpg --full-generate-key
and follow the prompts to create a key suitable for signing commits and tags whithout passphrase. -
Get the public key with:
gpg --armor --export [email protected]
You will get an output like this:
-----BEGIN PGP PUBLIC KEY BLOCK----- ... -----END PGP PUBLIC KEY BLOCK-----
And then copy the output and put in yourh github account settings -> SSH and GPG keys -> New GPG key.
-
Get the private key (for github-action) with:
gpg --armor --export-secret-keys [email protected]
You will get an output like this:
-----BEGIN PGP PRIVATE KEY BLOCK----- ... -----END PGP PRIVATE KEY BLOCK-----
Create a deploy key in your repository example SSH_KEY
and put the public key generated in step 1.1.1.
All environment variables are used in the workflow!
Add the following environment variables to your repository settings:
KEY_SSH
: The private SSH key for accessing the repository. (Generated in step 1.1.1)KEY_GPG
: The GPG private key for signing commits and tags for git (Generated in step 1.1.2)GIT_EMAIL
: Your email address associated with the GPG key.NPM_TOKEN
: Your npm token for publishing packages.
- Add Ruleset for
main
anddevelop
branches. - Add tag
need-triage
for issues. - Add your settings..
Run the interactive setup script to configure your package:
./npm-template-setup
This script will prompt you for:
- Package name: e.g.,
@your-scope/your-package-name
oryour-package-name
- Description: A brief description of your package
- Author name: Your name
- License holder: Usually the same as author name
- Contact email: Your contact email (updates README, CODE_OF_CONDUCT, etc.)
- Keywords: Comma-separated keywords to help others find your package
The script automatically updates:
package.json
with your package informationLICENSE
file with current year and license holderCODE_OF_CONDUCT.md
with your contact emailCONTRIBUTING.md
with your contact emailREADME.md
template placeholders- GitHub issue templates
After running the script, manually configure the exports
field in package.json
to define your package entry points:
"exports": {
".": "./dist/index.js",
"./types": "./dist/types/index.js"
}
Just change entrypoints
in builder.ts
to your entry point file. (e.g., source/index.ts
).
Update the README.md file with relevant information about your package.
Template for creating new npm packages with Bun.
Package Template provides a starting point for building and publishing npm packages. Customize this section with a description of your package's purpose and features.
bun add @your-scope/your-package-name
import { YourExportedFunction } from '@your-scope/your-package-name'
// Example usage
YourExportedFunction()
You can find the complete API reference documentation for YourPackageName
at:
Distributed under the MIT License. See LICENSE for more information.
- Mail: [email protected]
- Github: Project link