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/README.md +10 -10
- package/dist/chunk-5YXY7GCE.js +280 -0
- package/dist/{chunk-SKKHIIUE.js → chunk-NFK24PSA.js} +8 -5
- package/dist/cli.cjs +80 -101943
- package/dist/cli.js +2 -3
- package/dist/{generate-IJGTBA2I.js → generate-IQIB2PJD.js} +2 -3
- package/dist/index.cjs +186 -102087
- package/dist/index.js +2 -3
- package/package.json +5 -4
- package/templates/axios.ejs +2 -2
- package/dist/acorn-O63CA7L4.js +0 -3047
- package/dist/angular-U44OZXUW.js +0 -2794
- package/dist/babel-VWJW3TNP.js +0 -6946
- package/dist/chunk-6OIOYGN7.js +0 -17
- package/dist/chunk-K46PCBCF.js +0 -22981
- package/dist/estree-OIZOUIW7.js +0 -4374
- package/dist/flow-TDKVTHFE.js +0 -26897
- package/dist/glimmer-AWQE7API.js +0 -2847
- package/dist/graphql-IJWEVF4G.js +0 -1247
- package/dist/html-7SW5PDZO.js +0 -2716
- package/dist/markdown-2BNVGUT3.js +0 -3484
- package/dist/meriyah-L52O7E6A.js +0 -2474
- package/dist/postcss-AOWY4ITF.js +0 -5057
- package/dist/typescript-ANND5E4Y.js +0 -13104
- package/dist/yaml-MB3PL3NY.js +0 -4223
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
transformTypeValue,
|
|
21
21
|
transformUrl,
|
|
22
22
|
transformVerb
|
|
23
|
-
} from "./chunk-
|
|
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-
|
|
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.
|
|
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
|
}
|
package/templates/axios.ejs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<% if (ts && !typesOnly) { %> import {
|
|
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) { %>:
|
|
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 %>',
|