Next.js Discord

Discord Forum

NPM Packages

Unanswered
Pavement ant posted this in #help-forum
Open in Discord
Pavement antOP
What is the Industry Standard way for creating npm packages?

4 Replies

The current industry-standard approach is: treat your npm package like a small product with a stable public API, typed output, automated tests, CI/CD publishing, and supply-chain-safe release practices
Pavement antOP
Thank you. Let me look into this. Do you have any resources you can recommend?
I have been checking out tsdown to get an overview of how packages are built.
@Pavement ant Thank you. Let me look into this. Do you have any resources you can recommend? I have been checking out tsdown to get an overview of how packages are built.
Yeah, tsdown is a good place to start if you want to understand the modern build flow.

A few resources I’d recommend:

- npm docs on "package.json", especially "exports", "files", "main", "types"
- Node.js docs on ESM vs CommonJS and package entry points
- TypeScript docs on publishing declaration files
- Changesets docs for versioning and releases
- Looking through well-maintained packages on GitHub and checking their "package.json", build scripts, and release workflows

The biggest things to get familiar with are "exports", how type declarations are generated, what actually gets published to npm, and how release/versioning is handled. Once those click, the tooling choices like tsdown, tsup, Rollup, etc. make a lot more sense.
Pavement antOP
Aah nice nice. Thank you for your help. Will reach out with feedback and any questions should I have any