api-farmer 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  transformTypeValue,
21
21
  transformUrl,
22
22
  transformVerb
23
- } from "./chunk-K46PCBCF.js";
23
+ } from "./chunk-5YXY7GCE.js";
24
24
  import {
25
25
  createStatusCodesByStrategy,
26
26
  getCliVersion,
@@ -29,8 +29,7 @@ import {
29
29
  isRequiredRequestBody,
30
30
  readSchema,
31
31
  readTemplateFile
32
- } from "./chunk-SKKHIIUE.js";
33
- import "./chunk-6OIOYGN7.js";
32
+ } from "./chunk-NFK24PSA.js";
34
33
 
35
34
  // src/index.ts
36
35
  import { default as default2 } from "pluralize";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-farmer",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "API module generation tool based on Openapi3/Swagger2.",
5
5
  "keywords": [
6
6
  "cli",
@@ -59,7 +59,8 @@
59
59
  "rslog": "^1.2.3",
60
60
  "swagger2openapi": "^7.0.8",
61
61
  "unconfig": "^0.6.0",
62
- "yaml": "^2.7.0"
62
+ "yaml": "^2.7.0",
63
+ "prettier": "^3.4.2"
63
64
  },
64
65
  "devDependencies": {
65
66
  "@configurajs/eslint": "^0.1.0",
@@ -71,7 +72,6 @@
71
72
  "@varlet/release": "^0.3.1",
72
73
  "eslint": "^9.17.0",
73
74
  "nano-staged": "0.8.0",
74
- "prettier": "^3.4.2",
75
75
  "rimraf": "^6.0.1",
76
76
  "simple-git-hooks": "^2.11.1",
77
77
  "tsup": "8.3.5",
@@ -89,6 +89,7 @@
89
89
  "dev": "tsup src/index.ts src/cli.ts --format esm,cjs --watch --dts --shims",
90
90
  "format": "prettier --write .",
91
91
  "lint": "eslint . --fix",
92
- "release": "pnpm build && vr release"
92
+ "release": "pnpm build && vr release",
93
+ "gen": "pnpm --dir ./fixtures/axios gen & pnpm --dir ./fixtures/axle gen"
93
94
  }
94
95
  }
@@ -1,10 +1,10 @@
1
- <% if (ts && !typesOnly) { %> import { type AxiosRequestConfig } from 'axios' <% } %>
1
+ <% if (ts && !typesOnly) { %> import type { RequestConfig } from '@/request' <% } %>
2
2
  <% if (!typesOnly) { %> import { request } from '@/request' <% } %>
3
3
  <% if (ts) { %> import { type paths } from './<%- typesFilename %>' <% } %>
4
4
 
5
5
  <% if (!typesOnly) { %>
6
6
  <% apiModule.payloads.forEach(payload => { %> -%>
7
- export const <%- payload.fn %> = (config<% if (ts) { %>: AxiosRequestConfig<<%- payload.typeRequestBody %>> <% } %>)
7
+ export const <%- payload.fn %> = (config<% if (ts) { %>: RequestConfig<<%- payload.typeRequestBody %>> <% } %> = {})
8
8
  => request<% if (ts) { %><any, <%- payload.typeResponseBody %>><% } %>({
9
9
  url: '<%- payload.url %>',
10
10
  method: '<%- payload.method %>',