FeaturedIT topics

JavaScript tutorial: Build and publish NPM packages in a pinch

There have been a handful of times when I thought it would be nice to publish a JavaScript library on NPM. It was either a small library I kept using in different projects or a command-line tool I thought was useful enough to share with coworkers. But every time I started researching the process of building and publishing packages to NPM, I would invariably become overwhelmed.

After going down the rabbit holes of best practices and support I realized that my afternoon project just cascaded into the evening, and then into the night. If I did make any headway, I was never sure of it. I was constantly asking myself, “Am I really doing this right?”

When a former coworker asked if I had ever used @pika/pack, a new tool designed to do all of the heavy lifting for building and publishing NPM packages, I jumped at the opportunity. This past week I took @pika/pack for a test run by creating and publishing a simple CLI tool.

What is @pika/pack?

The NPM ecosystem is gigantic, and the quality of packages you can find runs the full gamut of quality and usability. Packages that look well-used can give you headaches if you don’t use modern language features or vice-versa, and working with NPM packages within languages like TypeScript can be a world of hurt if the typings aren’t present. @pika/pack is a tool that helps package developers build and publish optimized builds for the web, Node.js, TypeScript, WebAssembly, and more, using pluggable pipelines and simple configuration. You can read the project developers’ full introduction and see code samples here.

Related Articles

Back to top button