npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

epip-generate

v1.3.36

Published

epip-generate is a powerful package designed to automate the creation of backend services from API definitions using swagger.json. It generates all DTOs, services, and even backend validations automatically, streamlining your development process.

Downloads

613

Readme

🌱epip-generate

epip-generate is a powerful package designed to automate the creation of backend services from API definitions using swagger.json. It generates all DTOs, services, and even backend validations automatically, streamlining your development process.

Installation

Install the package as a development dependency using npm:

npm i epip-generate -D

Usage

There are two ways to implement epip-generate in your project:

  1. Using Scripts in package.json You can integrate epip-generate by adding a script to your package.json:
{
  "scripts": {
    "make:api": "epip-generate vue -o ./src/repository -p to -h https://api.test.hemscap.com/v1/api/swagger.json -in @core/interceptor -e VITE_APP_URL -s 2 -ti 300000 && npm run format"
  },
  "dependencies": { 
    // your dependencies here 
  },
  "devDependencies": {
    "epip-generate": "latest"
    // your dev dependencies here 
  }
}
  1. Using Vite Plugin You can also use epip-generate as a Vite plugin. Update your vite.config.ts file as follows:
import { defineConfig } from 'vite';
import { EpipGenerateVitePlugin } from 'epip-generate';

export default defineConfig({
  plugins: [
    EpipGenerateVitePlugin({
      type: 'vue',
      destinationPath: process.env.VITE_EPIP_DESC_PATH as string,
      plugins: ['to'],
      swaggerPath: process.env.VITE_EPIP_SWAGGER as string,
      interceptorPath: process.env.VITE_EPIP_INTERCEPTOR_PATH as string,
      baseUrlEnvironmentKey: process.env.VITE_EPIP_ENV_KEY as string,
      numberOfBackPathModels: 2,
      axiosTimeoutMillisecond: 300000
    })
  ]
});

epip-generate Configuration

The epip-generate package offers several configuration options:

  1. type: "vue" | "angular" | "react"
  • vue: Generates services using axios.

  • angular: Intended to generate services using rxjs (currently not implemented).

  • react: Intended to generate services using hooks (currently not implemented)\

  1. destinationPath: The path where the generated files will be stored.

  2. plugins: Array<"to" | "class-dto">

  • to: Uses await-to-js to handle axios responses.
  • class-dto: Generates DTOs as classes, enabling automatic validation. You can update validation rules for fields using the validationProperty method in the class, useful for libraries like Quasar.
  1. swaggerPath: The path to your swagger.json file.

  2. interceptorPath: The path to a file that exports the following three methods:

export const onRequest = async function (config: any) {
  // your code...
  return config;
};

export const onResponse = function (response: any) {
  // your code...
  return response.data;
};

export const onResponseError = function (response: AxiosError) {
  // your code...
  throw response;
};
  1. baseUrlEnvironmentKey: The environment variable key that contains the base URL for your APIs.

  2. numberOfBackPathModels: The number of directories to traverse back for path resolution in the model.ts file.

  3. axiosTimeoutMillisecond: The timeout value for axios requests, in milliseconds.

License

MIT

Authors