Template for @nkp/ npm packages.
This tempalte uses pnpm as a package manager instead of npm or yarn.
Pnpm improves local development by symbolically linking dependencies and speeding up the installation process.
Comes with:
- Language: TypeScript & JavaScript
- Linting: Eslint
- Testing: Jest
- Support TypeScript test files
- Support e2e and unit tests
- Easy to configure for DOM testing
- Building: Rollup
- Builds commonjs
- Builds ES Modules (targets package.json#module)
- Package consumers using build tools such as
rollup
andwebpack
target package.json#module, the ES Module export of the package, for tree shaking. Tree shaking generates smaller packages and reduces build times.
- Package consumers using build tools such as
- CI: GitHub actions
- Builds, tests and publishes to
npm
when a new release is created on GitHub.
- Builds, tests and publishes to
- Clone the repository
git clone [email protected]:NickKelly1/nkp-template.git
- (optional): use GitHub's
template
feature.
- Install dependencies and run tests
- If using nvm, run
nvm use
to set the NodeJS version - run
npm install
- run
npm test
- If using nvm, run
- Find and replace placeholders in the project
- ---PACKAGE-DESCRIPTION---
- ---NPM-PACKAGE-IDENTIFIER---
- ---NPM-PACKAGE-ORG-NAME---
- ---NPM-PACKAGE-NAME---
- ---GITHUB-URL---
- ---GITHUB-ORG-NAME---
- ---GITHUB-PROJECT-NAME---
- ---DESCRIPTION-TEXT---
- ---USAGE-TEXT---
- Remove stubs and reset the repos state
- Remove the contents of
src/index.ts
- set the testEnvironment in `jest.config.ts
- Remove
src/examples
- Remove the contents of
- Add an NPM_TOKEN to the repository for CI
- Using npmjs, generate a CI token
- Add the token to this GitHub repositories secrets as "NPM_TOKEN"
- Set up the README.MD
---DESCRIPTION-TEXT---
@---NPM-PACKAGE-ORG-NAME---/---NPM-PACKAGE-NAME---
exports both CommonJS and ES modules.
npm install @---NPM-PACKAGE-ORG-NAME---/---NPM-PACKAGE-NAME---
yarn add @---NPM-PACKAGE-ORG-NAME---/---NPM-PACKAGE-NAME---
pnpm add @---NPM-PACKAGE-ORG-NAME---/---NPM-PACKAGE-NAME---
To a release a new version:
- Update the version number in package.json
- Push the new version to the
master
branch on GitHub - Create a
new release
on GitHub for the latest version
This will trigger a GitHub action that tests and publishes the npm package.