Closed iangregsondev closed 5 years ago
I think you can run nest g library mylibrary
in =^ 5.6.0 version
Just tested it! That's exactly what I needed - thanks @ltciro
Would be nice to be able to get this documented here https://docs.nestjs.com/cli/usages - as I didn't know it existed.
Maybe leaving this open to update the documentation?
See #189
Is there any way to create a standalone library?
@adriano-di-giovanni for standalone libraries (publishable to NPM), you can simply create a new Nest project and remove the main.ts
file :)
Thanks, @kamilmysliwiec I'm currently using tsdx.
Sorry for necrobumping but I don’t think that opening a new issue would be better idea.
I think that with the rise of build caching tools like Nx and Turborepo an option to generate a standalone library would be nice.
Current behavior
Would be nice to be able to create a library using the cli.. NG CLI does something similar but you need to run it inside an already created application and thus creates a subdirectory called projects with the library inside.
What I would I suggest is not required to run inside an already nest created app but to be completely independent. As something like this https://github.com/nestjs/typeorm
That way, we can publish these to NPM and it has its own git repository.
Right now what I am doing is creating a new nest app and stripping out the majority of things like nodemon as its a library and not needed. e2e tests as it's not needed. main.ts as it's not needed.
removing npm scripts for e2e tests, start and other related scripts.. Basically just leaving the test, build, lint etc
So I am able to do this manually but it would be nice if the cli had a generate / new command for this.