Skip to content

Commit

Permalink
Merge branch 'master' into handle-websocket-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nwalters512 committed Oct 10, 2024
2 parents adbc7ab + 3d6134b commit c3081ac
Show file tree
Hide file tree
Showing 73 changed files with 5,543 additions and 3,107 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
# Matches the exact files
[{package.json}]
indent_size = 2
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.js

This file was deleted.

42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
Expand All @@ -37,13 +37,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
Expand All @@ -67,16 +67,16 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
Expand All @@ -99,13 +99,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
Expand All @@ -129,8 +129,8 @@ jobs:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@v2
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v6
with:
# Github token used to fetch the list of changed files in the commit.
# Default: ${{ github.token }}
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: publish to npmjs
on:
release:
types: [prereleased, released]
jobs:
build-and-publish:
# prevents this action from running on forks
if: github.repository == 'chimurai/http-proxy-middleware'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install

- name: Publish to NPM (beta)
if: 'github.event.release.prerelease'
run: npm publish --provenance --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to NPM (stable)
if: '!github.event.release.prerelease'
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 0 additions & 11 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ tasks:
yarn build
yarn test --maxWorkers=30%
github:
# https://www.gitpod.io/docs/prebuilds/#configure-prebuilds
prebuilds:
master: true
branches: true
pullRequests: true
pullRequestsFromForks: true
addCheck: true
addComment: false
addBadge: true

vscode:
extensions:
- bierner.markdown-preview-github-styles
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
provenance=true
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"deno.enable": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"markdown.extension.toc.levels": "2..3"
}
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# Changelog

## next
## [v3.0.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.3)

- fix(pathFilter): handle errors

## [v3.0.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.2)

- refactor(dependency): replace is-plain-obj with is-plain-object ([#1031](https://github.com/chimurai/http-proxy-middleware/pull/1031))
- chore(package): upgrade to eslint v9 ([#1032](https://github.com/chimurai/http-proxy-middleware/pull/1032))
- fix(logger-plugin): handle undefined protocol and hostname ([#1036](https://github.com/chimurai/http-proxy-middleware/pull/1036))

## [v3.0.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.1)

- fix(type): fix RequestHandler return type ([#980](https://github.com/chimurai/http-proxy-middleware/pull/980))
- refactor(errors): improve pathFilter error message ([#987](https://github.com/chimurai/http-proxy-middleware/pull/987))
- fix(logger-plugin): fix missing target port ([#989](https://github.com/chimurai/http-proxy-middleware/pull/989))
- ci(package): npm package provenance ([#991](https://github.com/chimurai/http-proxy-middleware/pull/1015))
- fix(logger-plugin): log target port when router option is used ([#1001](https://github.com/chimurai/http-proxy-middleware/pull/1001))
- refactor: fix circular dependencies ([#1010](https://github.com/chimurai/http-proxy-middleware/pull/1010))
- fix(fix-request-body): support '+json' content-type suffix ([#1015](https://github.com/chimurai/http-proxy-middleware/pull/1015))

## [v3.0.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.0)

This release contains some breaking changes.

Please read the V3 discussion <https://github.com/chimurai/http-proxy-middleware/discussions/768>
or follow the [MIGRATION.md](https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md) guide.

- feat(typescript): type improvements ([#882](https://github.com/chimurai/http-proxy-middleware/pull/882))
- chore(deps): update micromatch to 4.0.5
Expand Down
36 changes: 26 additions & 10 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Migration guide

- [v3 changes and discussions](#v3-changes-and-discussions)
- [v2 to v3 adapter](#v2-to-v3-adapter)
- [`legacyCreateProxyMiddleware`](#legacycreateproxymiddleware)
- [v3 breaking changes](#v3-breaking-changes)
Expand All @@ -10,12 +11,20 @@
- [Removed `logProvider` and `logLevel` options](#removed-logprovider-and-loglevel-options)
- [Refactored proxy events](#refactored-proxy-events)

## v3 changes and discussions

See list of changes in V3:

<https://github.com/chimurai/http-proxy-middleware/discussions/768>

## v2 to v3 adapter

### `legacyCreateProxyMiddleware`

Use the adapter to use v3 with minimal changes to your v2 implementation.

💡 When you use `legacyCreateProxyMiddleware` it will print out console messages in run-time to guide you on how to migrate legacy configurations.

NOTE: `legacyCreateProxyMiddleware` will be removed in a future version.

```js
Expand Down Expand Up @@ -46,6 +55,8 @@ legacyCreateProxyMiddleware(...);

### Removed `req.url` patching

When proxy is mounted on a path, this path should be provided in the target.

```js
// before
app.use('/user', proxy({ target: 'http://www.example.org' }));
Expand All @@ -64,10 +75,13 @@ It was common to rewrite the `basePath` with the `pathRewrite` option:

```js
// before
app.use('/user', proxy({
target: 'http://www.example.org'
pathRewrite: { '^/user': '/secret' }
}));
app.use(
'/user',
proxy({
target: 'http://www.example.org',
pathRewrite: { '^/user': '/secret' },
}),
);

// after
app.use('/user', proxy({ target: 'http://www.example.org/secret' }));
Expand All @@ -77,10 +91,12 @@ When proxy is mounted at the root, `pathRewrite` should still work as in v2.

```js
// not affected
app.use(proxy({
target: 'http://www.example.org'
pathRewrite: { '^/user': '/secret' }
}));
app.use(
proxy({
target: 'http://www.example.org',
pathRewrite: { '^/user': '/secret' },
}),
);
```

### Removed "shorthand" usage
Expand All @@ -89,10 +105,10 @@ Specify the `target` option.

```js
// before
createProxyMiddleware('http:/www.example.org');
createProxyMiddleware('http://www.example.org');

// after
createProxyMiddleware({ target: 'http:/www.example.org' });
createProxyMiddleware({ target: 'http://www.example.org' });
```

### Removed `context` argument
Expand Down
Loading

0 comments on commit c3081ac

Please sign in to comment.