DEV Community

Cover image for Fast & minimalist Node utility package template (Vite 5.x)
Brian Ng
Brian Ng

Posted on

Fast & minimalist Node utility package template (Vite 5.x)

Looking back at an old tutorial article

If you came from the NPM package development with Vite tutorial article, we've learned how to create a custom (node) NPM package and publish it to NPM.

And the previous Github example vite-vanilla-ts-module, demonstrated a few extra bits:

  1. Setting up custom rollup plugins to help simplify the module build.
  2. Using typedoc to easily create API documentation material, to help code authors know what library features are available and understanding how to use your offered modules, utilities etc in your npm package.
  3. Understanding how we can add cool (and useful) features, such as adding a CLI progress bar when your package is being built, and adding c8 code coverage visualisation report.

A newly created minimalist npm package template!

Now, we have a new and minimalist NPM package development template, the template design begins from Vite 5.x (currently meant to serve Node 18.x / 20.x, and beyond).

What makes this template "minimalist"?

Configuration freedom - This template does not have husky, prettier & eslint, as you have the choice of configuring them - especially if you're inclined towards biomejs than prettier. For example, if you have a monorepo setup, you may want to configure husky differently, and manage your formatting & linting with libraries like biomejs.

Simple tsconfig.json file - And this template should be suitable for monorepo migration work - it is also why the tsconfig.json file is "vanilla" or "bland". For example, nx scaffolding of packages by default generates tsconfig.lib.json, tsconfig.base.json etc thus tailor your tsconfig.json file in your package workspace to your liking.

Thank you for showing your support!

If you find this article (and the old tutorial article NPM package development with Vite) useful, please show your support. And big thank you for those who did, I am just glad these articles helped you save many minutes!

FYI, if you're using AWS Lambdas, Node 20.x is now supported!

AWS Lambda adds support for Node.js 20

Check the Github template out at vite-vanilla-ts-template, and read the README.md file for more information. And I hope this template gives you a strong learning start in building & publishing awesome NPM packages for the open-source community.

Top comments (0)