Skip to content

Commit

Permalink
chore: upgrade deps (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
BuptStEve authored Aug 7, 2019
1 parent 759a618 commit 18d243d
Show file tree
Hide file tree
Showing 8 changed files with 14,796 additions and 37 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const presets = [
[
'@babel/preset-env',
{ targets: { 'node': 'current' } },
{ targets: { node: 'current' } },
],
]
const plugins = [
Expand Down
14,758 changes: 14,758 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tua-api",
"version": "1.3.3",
"version": "1.3.4",
"description": "🏗 A common tool helps converting configs to api functions",
"main": "dist/TuaApi.cjs.js",
"module": "dist/TuaApi.esm.js",
Expand Down Expand Up @@ -62,46 +62,46 @@
"package.json"
],
"dependencies": {
"axios": "^0.18.0",
"axios": "^0.19.0",
"fetch-jsonp": "^1.1.3",
"koa-compose": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/core": "^7.5.5",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@types/jest": "^24.0.12",
"axios-mock-adapter": "^1.16.0",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@types/jest": "^24.0.17",
"axios-mock-adapter": "^1.17.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.7.1",
"codecov": "^3.3.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"gh-pages": "^2.0.1",
"husky": "^1.3.1",
"jest": "^24.7.1",
"lint-staged": "^8.1.5",
"gh-pages": "^2.1.0",
"husky": "^3.0.2",
"jest": "^24.8.0",
"lint-staged": "^9.2.1",
"rimraf": "^2.6.3",
"rollup": "^1.10.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-eslint": "^5.1.0",
"rollup": "^1.19.4",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2",
"typescript": "^3.4.5",
"vuepress": "^1.0.0-alpha.39"
"typescript": "^3.5.3",
"vuepress": "^1.0.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const external = ['axios', 'fetch-jsonp']

export default [{
input,
output: [ output.cjs, output.esm ],
output: [output.cjs, output.esm],
plugins,
external,
}, {
Expand Down
2 changes: 1 addition & 1 deletion src/middlewareFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const formatResDataMiddleware = (ctx, next) => next().then(() => {
if (!jsonData) return Promise.reject(Error(ERROR_STRINGS.noData))

if (Array.isArray(jsonData)) {
const [ code, data, msg ] = jsonData
const [code, data, msg] = jsonData
ctx.res.data = { code: +code, data, msg }
} else {
ctx.res.data = { ...jsonData, code: +jsonData.code }
Expand Down
7 changes: 4 additions & 3 deletions test/__tests__/axios.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('fake get requests', () => {
})

test('required param', async () => {
const data = [ 0, 'array data' ]
const data = [0, 'array data']
mock.onGet(reqGOPUrl + `?param1=1217&param2=steve&param3=young`).reply(200, data)
const resData = await fakeGetApi.op({ param3: 'young' }, { reqType: 'axios' })

Expand Down Expand Up @@ -125,14 +125,15 @@ describe('fake post requests', () => {
})

test('array-data', async () => {
const data = [ 0, 'array data' ]
const data = [0, 'array data']
mock.onPost(reqOPUrl).reply(200, data)
const resData = await fakePostApi.op({ param3: 'steve' })

expect(resData).toEqual({ code: 0, data: 'array data' })
})

test('form-data', async () => {
mock.resetHistory()
mock.onPost(reqOHUrl).reply(200, {})
const formData = new FormData()
formData.append('a', 'a')
Expand All @@ -146,6 +147,6 @@ describe('fake post requests', () => {
} = mock.history.post[0]

expect(data).toBe(formData)
expect(transformRequest[0].name).toBe('transformRequest')
expect(transformRequest).toBe(null)
})
})
2 changes: 1 addition & 1 deletion test/__tests__/jsonp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.mock('fetch-jsonp')
*/
const fetchJsonp = require('fetch-jsonp')

const data = [ 0, 'array data' ]
const data = [0, 'array data']
const returnVal = { code: 0, data: 'array data' }

describe('mock data', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/wx.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fakeWx from '@examples/apis-mp/fake-wx'
import { mockApi, fakeWxApi } from '@examples/apis-mp/'

const testObjData = { code: 0, data: 'object data' }
const testArrData = [ 0, 'array data' ]
const testArrData = [0, 'array data']

describe('mock data', () => {
beforeEach(() => {
Expand Down

0 comments on commit 18d243d

Please sign in to comment.