My opinionated JavaScript package template repository - zero config, start immediately
Tags: npm, javascript, github, node
Published: 2023-08-08 14:59:03

I still rely on a decent package template repository when it comes to create new packages fast. I just don't want to fiddle around but simply start coding, run lint/tests, build and publish. Therefore I created my own opinionated template repository that just works.

<small>
Photo by <a href="https://unsplash.com/@kseegars?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Kadarius Seegars</a> on <a href="https://unsplash.com/photos/DevJkLB3hWE?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
</small>

## TL;DR show me the repository

{% github https://github.com/jankapunkt/npm-package-template %}

## Tools / stack

* 🗪 [Babel](https://babeljs.io/) for transpiling
* 🪄 [Standard](https://standardjs.com/) for linting
* ⚗️ [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com) for testing
* 🔍 [c8](https://github.com/bcoe/c8) for code coverage
* 📚 [JSDoc](https://jsdoc.app/) for documentation and [jsdoc-to-markdown](https://www.npmjs.com/package/jsdoc-to-markdown) to create docs as markdown files
* ⚡ [GitHub actions](https://github.com/features/actions) for continuous integration
* 📦 [Rollup](https://rollupjs.org) for bundling

All tools are defined as **`dev-dependencies`**!

## GitHub community standards

The template repository has all relevant GitHub community standards implemented. I just want to change details and then have it all ready for being released:

- Description
- README
- Code of conduct
- Contributing guidelines
- License
- Security policy
- Issue templates
- Pull request template

## Use the tools

The repository comes with a default set of tools via npm scripts. From my perspective this covers most necessary steps when creating/updating a package.

| command         | description                                       | output     |
|-----------------|---------------------------------------------------|------------|
| `lint`          | runs the linter in read-mode                      |            |
| `lint:fix`      | runs the linter; fixes minor issues automatically |            |
| `test`          | runs the tests once                               |            |
| `test:watch`    | runs the tests; re-runs them on code changes      |            |
| `test:coverage` | runs the tests once and creates a coverage report | `coverage` |
| `docs`          | creates API documentation                         | `docs`     |
| `build`         | builds the bundles for several target platforms   | `dist`     |

## Getting started

If you think this is the right template for you then simply [create a new repository with this repository as template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)
or fork the repository and clone it to your local machine.

{% github https://github.com/jankapunkt/npm-package-template %}

## About me

I regularly publish articles here on dev.to about **JavaScript** and specifically about **Meteor Js**.

You can also find (and contact) me on [GitHub](https://github.com/jankapunkt/), [Twitter](https://twitter.com/kuester_jan) and [LinkedIn](https://www.linkedin.com/in/jan-kuester/).

If you like what you are reading and want to support me, you can [sponsor me on GitHub](https://github.com/jankapunkt) or [send me a tip via PayPal](https://paypal.me/kuesterjan).