Hey there! Starting a new JS/TS package?
Whether it's a library, a plugin, an integration, a CLI, or anything else in the world:
- Write it in TypeScript for best reliability and development experience.
- Use the battle-tested Yarn for dependency management.
- Test quickly and easily with Jest (plus
ts-jest
for TypeScript support).- Adhere to PostHog Style™️ by formatting code with Prettier and ensuring best practices with ESLint – or actually, don't do it: let pre-commit hooks handle this for you.
- Have GitHub Actions run all of the above when working on pull requests. Plus have them take care of publishing releases on npm and GitHub whenever the version is incremented.
Start out using this template and hit the ground quickly with all of the above from the get-go.
- Update fields
name
,description
,keywords
,respository
,bugs
andhomepage
inpackage.json
.- Make sure that you have Yarn installed and run
yarn
to install dependencies.
Note: fileyarn.lock
will be created. Commit this.- Write your package, starting with
src/index.ts
!When publishing on GitHub, add an automation-type npm access token as GitHub secret
NPM_TOKEN
in order for auto-release to work.
Now, erase the notes above and fill this README with something actually relevant! Don't forget to update the npm badge too.
We're here to help you with anything PostHog!