Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aliksend/code-generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aliksend/code-generator

Code generator

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Code generator

One place to run all generators.

Idea

All of us know how to generate typedoc for your typescript code or swagger for nestjs' controllers, graphql schema from nexus declaraion or ts declarations for database tables using kanel. But how to run all this generators at once? You can use this package to do it.

For example to generate database schema using kanel you can do ./src/foo/_generator.ts

import { deferGenerator } from '@aliksend/code-generator'
import { processDatabase } from "kanel";

deferGenerator(async () => {
  await processDatabase({
    // config
  });
})

And run npx @aliksend/code-generator to run it. It will import all _generator.ts and runs all deferred (async) generators.

Modular services

When you want to create service with modules (for example one module for http server, other for database connection) when each module lives in separated directory, you need to declare "public" interface for every module. Best place to do it - index.ts file in directory. deferGenerator allows to do it - you can just return map of imports and list of declarations to put to your index.ts file. For example you can parse your swagger.yaml and produce interfaces to call declared methods with specified typings. You can run deferGenerator as many times as you want for your module and code-generator will generate index.ts file with all imports and declarations from all generators.

Keywords

FAQs

Package last updated on 15 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc