@jdietrichdev/simple-package v1.0.9
simple-package
Template repsitory for creating a deployable NPM package
Getting Started
Guide for getting this template repository set up for usage with your own NPM package
Repo Setup
- Use this template repository to create a new repository
- Clone the new repository to your machine
- Update the name of the package in
package.json
to reflect the name you would like for your library - Run
npm install
in the terminal, this will:- Install all necessary dependencies
- Set up Husky hooks to validate commit messages
Additional Configuration Updates (optional)
- Build configuration using the
tsconfig.*.json
filestsconfig.base.json
- General build configuration (rules, files, etc)tsconfig.cjs.json
- Configuration for building package for CommonJS modulestsconfig.esm.json
- Configuration for building package for ECMAScript modules
- ESLint configuration using the
.eslintrc
and.prettierrc
files - Unit test configuration
- Update
.mocharc.json
to update configuration for Mocha - Remove
.mochrc.json
and configure another testing framework
- Update
- Release configuration using
release.config.js
- Commitlint configuration (used for validating commit messages) using
commitlint.config.js
- Husky configuration
Create NPM Token
In order for the release step to run successfully, you must create a token in NPM that will allow you to publish the package as part of your release pipeline.
- If you haven't already, create an NPM account
- Ensure that 2FA is only required for authentication
- Create a new
Automation
access token and copy the value of the token - Create a new Actions secret in your repo named
NPM_TOKEN
that contains the token you copied from NPM
Once this has been completed, you should be able to run the release workflow and deploy your package to NPM successfully
Commit Message Formatting
semantic-release
uses commit messages to determine if a release is necessary when the pipeline is run.
Therefore, the commit messages need to have a specific structure so that the release process can determine if a new release is required.
The formatting of the commit must follow:
<type>(optional scope): summary
Type
Used to determine if a release is necessary, must be one of the following values:
Type | Description | Release |
---|---|---|
build | Changes that affect the build system or external dependencies | No Release |
chore | Automated changes to project | No Release |
ci | Changes to CI configuration files and scripts | No Release |
docs | Changes to documentation | No Release |
feat | Implementation of a new feature | Minor/Feature Release |
fix | Changes that fix bugs | Patch/Fix Release |
perf | Changes to improve performance | Major/Breaking Release |
refactor | Code change that does not fix a bug or add a feature | No Release |
test | Adding or updating tests | No Release |
Updates can be made to what types trigger releases in
release.config.js
Scope (optional)
Name of the component affected
Summary
Brief description of the update made