swagger-to-axios 1.0.4 → 1.0.5

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/lib/index.js CHANGED
@@ -9,7 +9,7 @@ import { writeFile, urlToName, urlToLinkParams } from './utils/index.js';
9
9
  */
10
10
  const createApiFiles = async (swaggerList = [], config = {}) => {
11
11
  try {
12
- const { includeBaseURL = true, cliType = 'VueCli', envHostName = 'VUE_APP_HOST', envProtocolName = 'VUE_APP_PROTOCOL', https = false, outputFolder = './apis', improtAxiosPath, typeScript = false, urlInOptions = true, } = config;
12
+ const { includeBaseURL = true, cliType = 'VueCli', envHostName = cliType === 'VueCli' ? 'VUE_APP_HOST' : 'VITE_APP_HOST', envProtocolName = cliType === 'VueCli' ? 'VUE_APP_PROTOCOL' : 'VITE_APP_PROTOCOL', https = false, outputFolder = './apis', improtAxiosPath, typeScript = false, urlInOptions = true, } = config;
13
13
  const swagger = {
14
14
  path: outputFolder,
15
15
  list: [],
@@ -22,7 +22,7 @@ export const upperFirstCase = (str) => str.charAt(0).toUpperCase() + str.slice(1
22
22
  /** 链接变成名称 */
23
23
  export const urlToName = (str) => str
24
24
  .split('/')
25
- .reduce((accumulator, currentValue) => upperFirstCase(accumulator) + upperFirstCase(currentValue.replace('{', '').replace('}', '')));
25
+ .reduce((accumulator, currentValue) => upperFirstCase(accumulator) + upperFirstCase(currentValue.replace(/{/g, '').replace(/}/g, '')));
26
26
  /**
27
27
  * 链接变成带参链接(/record/{recordID}/{userID} GET 变成 /record/${params.recordID}/${params.userID})
28
28
  * @param {string} url 链接名
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-to-axios",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "将swagger转换成axios可用的api文件",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
15
15
  "lint": "tslint -p tsconfig.json",
16
16
  "pub": "npm version patch && npm publish",
17
- "test": "node test"
17
+ "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config ./jest.config.js"
18
18
  },
19
19
  "author": "FreezeNow",
20
20
  "keywords": [
@@ -32,7 +32,8 @@
32
32
  "devDependencies": {
33
33
  "@types/js-yaml": "^4.0.3",
34
34
  "@types/node": "^16.9.1",
35
- "eslint-plugin-tsdoc": "^无可奉告",
35
+ "eslint-plugin-tsdoc": "^0.2.17",
36
+ "jest": "^29.5.0",
36
37
  "prettier": "^2.4.0",
37
38
  "tslint": "^6.1.3",
38
39
  "tslint-config-prettier": "^1.18.0"