#How does one go about creating a nestjs package?

5 messages · Page 1 of 1 (latest)

visual laurel
#

What resources would I need to go about creating a nestjs package? Are there any boilerplates worth using?

latent vortex
#

I need to get around to writing a schematic for this, or at least something in our docs 😅

What I like to do is use nest new to generate the typescript, jest, prettier, and eslint configs, along with the src directory and then removing everything from src.

Create an index.ts in the src that will be your main export as dist/index and that's the package's public API.

Get rid of the start and start:dev/start:debug commands as you don't need them for packages, and write integration tests in your test directory.

Make sure to move @nestjs/* packages to devDedpendencies as necessary and mark them as peerDependencies if they are needed at runtime (commonly @nestjs/core and @nestjs/common)

visual laurel
#

This is helpful thank you 🙂

latent vortex
lime sorrel
#

Just came to ask the same question. This would be awesome in the docs 🙂