Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

293
Views
How to make a cli typescript library that can generate whole files like NestJs?

I have been using Nestjs a lot lately and have started to create my own libraries for things I work with a lot; however, I still can not figure out how to make a library that works on the CLI and create new files like using "nest g resource ....". I looked through the GitHub repository, but I still haven't found my answer. :(

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using the generate command of the CLI you can generate a new Nest element. Under the hood it uses Angular Schematics to do so. When you generate a command, controller, service...etc. you are scaffolding it using an Angular Schematic. These schematics are provided in a separate package, also referred to as a collection. NestJS provides its schematics in the @nestjs/schematics package.

The nest generate or nest g command is basically just an alias to run an Angular Schematic. By default NestJS defaults to its own schematics. If you want to build your own you need to create your own package (collection). Then you can refer to this collection from the Nest CLI.

nest generate my-schematic --collection @my/collection

Alternatively you can just use your own schematics directly from the Angular CLI.

ng generate my-schematic:collection:my-schematic-name
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!