Skip to content

Commit b132fdf

Browse files
ricardogobbosouzapi0
authored andcommitted
chore: update module
1 parent 3ae23eb commit b132fdf

File tree

10 files changed

+3030
-2210
lines changed

10 files changed

+3030
-2210
lines changed

.eslintrc.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
module.exports = {
2-
root: true,
3-
parserOptions: {
4-
parser: 'babel-eslint',
5-
sourceType: 'module'
6-
},
72
extends: [
83
'@nuxtjs'
94
]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Nuxt Community - Pooya Parsa <pooya@pi0.ir>
3+
Copyright (c) Nuxt Community
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131

3232
## Setup
3333

34-
1. Add the `@nuxtjs/proxy` dependency with `yarn` or `npm` to your project
34+
1. Add `@nuxtjs/proxy` dependency to your project
35+
36+
```bash
37+
yarn add @nuxtjs/proxy # or npm install @nuxtjs/proxy
38+
```
39+
3540
2. Add `@nuxtjs/proxy` to the `modules` section of `nuxt.config.js`
36-
3. Configure it:
3741

3842
```js
3943
{
@@ -110,7 +114,7 @@ Keys are [context](https://github.com/chimurai/http-proxy-middleware#context-mat
110114

111115
[MIT License](./LICENSE)
112116

113-
Copyright (c) Nuxt Community - Pooya Parsa <pooya@pi0.ir>
117+
Copyright (c) Nuxt Community
114118

115119
<!-- Badges -->
116120
[npm-version-src]: https://img.shields.io/npm/dt/@nuxtjs/proxy.svg?style=flat-square

babel.config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

jest.config.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,5 @@ module.exports = {
44
collectCoverageFrom: [
55
'lib/**/*.js',
66
'!lib/plugin.js'
7-
],
8-
moduleNameMapper: {
9-
'^~/(.*)$': '<rootDir>/lib/$1',
10-
'^~~$': '<rootDir>',
11-
'^@@$': '<rootDir>',
12-
'^@/(.*)$': '<rootDir>/lib/$1'
13-
},
14-
transform: {
15-
'^.+\\.js$': 'babel-jest'
16-
}
7+
]
178
}

lib/module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const logger = require('./logger')
44
// Redirect info ~> debug
55
logger.info = logger.debug
66

7-
function proxyModule(options) {
7+
function proxyModule (options) {
88
if (!this.options.proxy) {
99
// No proxy defined
1010
logger.warn('No proxy defined on top level.')

package.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,24 @@
1313
},
1414
"scripts": {
1515
"dev": "nuxt test/fixture",
16-
"lint": "eslint lib test",
16+
"lint": "eslint --ext .js,.vue lib test",
1717
"test": "yarn lint && jest",
1818
"release": "yarn test && standard-version && git push --follow-tags && npm publish"
1919
},
2020
"files": [
2121
"lib"
2222
],
2323
"dependencies": {
24-
"consola": "^2.5.6",
24+
"consola": "^2.9.0",
2525
"http-proxy-middleware": "^0.19.1"
2626
},
2727
"devDependencies": {
28-
"@babel/core": "latest",
29-
"@babel/preset-env": "latest",
3028
"@commitlint/cli": "latest",
3129
"@commitlint/config-conventional": "latest",
3230
"@nuxtjs/eslint-config": "latest",
33-
"babel-eslint": "latest",
34-
"babel-jest": "latest",
3531
"codecov": "latest",
3632
"eslint": "latest",
37-
"eslint-config-standard": "latest",
38-
"eslint-plugin-import": "latest",
39-
"eslint-plugin-jest": "latest",
40-
"eslint-plugin-node": "latest",
41-
"eslint-plugin-promise": "latest",
42-
"eslint-plugin-standard": "latest",
43-
"eslint-plugin-vue": "latest",
33+
"get-port": "latest",
4434
"husky": "latest",
4535
"jest": "latest",
4636
"nuxt-edge": "latest",

test/fixture/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
path: '/api',
3-
handler(req, res) {
3+
handler (req, res) {
44
res.end('url:' + req.url)
55
}
66
}

test/module.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@ jest.setTimeout(60000)
22

33
const { Nuxt, Generator, Builder } = require('nuxt-edge')
44
const request = require('request-promise-native')
5-
const logger = require('@/logger')
5+
const getPort = require('get-port')
6+
7+
const logger = require('../lib/logger')
8+
logger.mockTypes(() => jest.fn())
69

710
const config = require('./fixture/nuxt.config')
811
config.dev = false
912

10-
let nuxt
11-
12-
logger.mockTypes(() => jest.fn())
13+
let nuxt, port
1314

14-
const url = path => `http://localhost:3000${path}`
15+
const url = path => `http://localhost:${port}${path}`
1516
const get = path => request(url(path))
1617

1718
const setupNuxt = async (config) => {
1819
const nuxt = new Nuxt(config)
1920
await nuxt.ready()
20-
await nuxt.listen(3000)
21+
port = await getPort()
22+
await nuxt.listen(port)
2123

2224
return nuxt
2325
}

0 commit comments

Comments
 (0)