1.3.39 • Published 7 months ago

epip-generate v1.3.39

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
7 months ago

🌱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

1.3.39

7 months ago

1.3.37

7 months ago

1.3.38

7 months ago

1.3.36

10 months ago

1.3.31

11 months ago

1.3.32

11 months ago

1.3.28

11 months ago

1.3.29

11 months ago

1.3.27

11 months ago

1.3.24

12 months ago

1.3.25

12 months ago

1.3.23

12 months ago

1.3.26

12 months ago

1.3.19

12 months ago

1.3.20

12 months ago

1.3.21

12 months ago

1.3.22

12 months ago

1.2.134

12 months ago

1.2.133

12 months ago

1.2.136

12 months ago

1.2.135

12 months ago

1.2.138

12 months ago

1.2.137

12 months ago

1.2.139

12 months ago

1.2.130

12 months ago

1.2.132

12 months ago

1.2.131

12 months ago

1.2.141

12 months ago

1.2.140

12 months ago

1.2.142

12 months ago

1.3.9

12 months ago

1.3.8

12 months ago

1.3.10

12 months ago

1.3.13

12 months ago

1.3.14

12 months ago

1.3.11

12 months ago

1.3.12

12 months ago

1.3.17

12 months ago

1.3.18

12 months ago

1.3.15

12 months ago

1.3.16

12 months ago

1.3.7

12 months ago

1.3.6

12 months ago

1.3.5

12 months ago

1.3.4

12 months ago

1.3.2

12 months ago

1.3.1

12 months ago

1.2.125

12 months ago

1.2.127

12 months ago

1.2.126

12 months ago

1.2.129

12 months ago

1.2.128

12 months ago

1.2.123

12 months ago

1.2.122

12 months ago

1.2.124

12 months ago

1.2.115

1 year ago

1.2.118

12 months ago

1.2.117

12 months ago

1.2.121

12 months ago

1.2.120

12 months ago

1.2.119

12 months ago

1.2.112

1 year ago

1.2.114

1 year ago

1.2.113

1 year ago

1.2.111

1 year ago

1.2.108

1 year ago

1.2.110

1 year ago

1.2.109

1 year ago

1.2.107

1 year ago

1.2.105

1 year ago

1.2.106

1 year ago

1.2.101

1 year ago

1.2.100

1 year ago

1.2.103

1 year ago

1.2.102

1 year ago

1.2.104

1 year ago

1.2.98

1 year ago

1.2.99

1 year ago

1.2.93

1 year ago

1.2.96

1 year ago

1.2.97

1 year ago

1.2.94

1 year ago

1.2.95

1 year ago

1.2.85

1 year ago

1.2.86

1 year ago

1.2.84

1 year ago

1.2.89

1 year ago

1.2.87

1 year ago

1.2.88

1 year ago

1.2.92

1 year ago

1.2.90

1 year ago

1.2.91

1 year ago

1.2.81

2 years ago

1.2.82

2 years ago

1.2.83

2 years ago

1.2.78

2 years ago

1.2.79

2 years ago

1.2.74

2 years ago

1.2.75

2 years ago

1.2.63

2 years ago

1.2.64

2 years ago

1.2.61

2 years ago

1.2.62

2 years ago

1.2.67

2 years ago

1.2.65

2 years ago

1.2.66

2 years ago

1.2.69

2 years ago

1.2.70

2 years ago

1.2.71

2 years ago

1.2.73

2 years ago

1.2.60

2 years ago

1.2.41

2 years ago

1.2.40

2 years ago

1.2.45

2 years ago

1.2.46

2 years ago

1.2.43

2 years ago

1.2.44

2 years ago

1.2.49

2 years ago

1.2.47

2 years ago

1.2.48

2 years ago

1.2.29

2 years ago

1.2.52

2 years ago

1.2.30

2 years ago

1.2.53

2 years ago

1.2.51

2 years ago

1.2.56

2 years ago

1.2.34

2 years ago

1.2.57

2 years ago

1.2.54

2 years ago

1.2.32

2 years ago

1.2.55

2 years ago

1.2.38

2 years ago

1.2.39

2 years ago

1.2.58

2 years ago

1.2.36

2 years ago

1.2.59

2 years ago

1.2.37

2 years ago

1.2.28

2 years ago

1.2.31

2 years ago

1.2.27

2 years ago

1.2.26

2 years ago