0

I need some help, by creating a publishable nestjs library with nx. I've read a lot of documentations, but nothing helps.

I wrote a nestjs library in a NX monorepository. Now i want to publish only this library on NPM, but i dont know how.

On official NX documentation i found a flag named "--publishable". The only problem is you can't use it together with a NestJs library. If you enter a command like this:

ng g @nrwl/nest:library mylib --publishable 

you will get an error:

Unknown Option: "--publishable".

So with a NestJs library this flag doesnt work.

Now i want to create a package.json on my own and this is the point i dont know how. I have to build this library and then i have to publish it on npm. This process is killing me...

Im using the latest version of NX!

I will be very happy about a solution.

Lukas
  • 155
  • 1
  • 2
  • 7

1 Answers1

0
  1. ng g lib your_lib --publishable

  2. ng build your_lib

  3. change the contents of your_lib_.module to reflect that of a nestJs.module

  4. npm login

  5. npm publish inside the dir of your_lib_name

    I hope this helps

Community
  • 1
  • 1
leonlafa
  • 308
  • 2
  • 8