Skip to content

Commit fbb52a4

Browse files
chore: move middleware support into separate package (#1520)
* chore: move middleware support into separate package * chore: add build command * ci: update release please to publish more packages Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 40cb8a9 commit fbb52a4

File tree

16 files changed

+87
-32
lines changed

16 files changed

+87
-32
lines changed

.github/workflows/release-please.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ jobs:
2828
if: ${{ steps.release.outputs.releases_created }}
2929
- name: Install dependencies
3030
run: CI=1 npm ci
31-
working-directory: plugin
32-
if: ${{ steps.release.outputs.releases_created }}
33-
- run: npm publish
34-
working-directory: plugin
3531
if: ${{ steps.release.outputs.releases_created }}
32+
- run: npm publish packages/runtime/
33+
if: ${{ steps.release.outputs['packages/runtime--version'] }}
34+
env:
35+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
36+
- run: npm publish packages/next/
37+
if: ${{ steps.release.outputs['packages/next--version'] }}
3638
env:
3739
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3840
- uses: netlify/submit-build-plugin-action@v1
39-
if: ${{ steps.release.outputs.releases_created }}
41+
if: ${{ steps.release.outputs['packages/runtime--version'] }}
4042
with:
4143
github-token: ${{ steps.get-token.outputs.token }}
42-
package-json-dir: plugin
44+
package-json-dir: packages/runtime

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ Temporary Items
146146
.netlify
147147
demos/default/.next
148148
.parcel-cache
149-
packages/runtime/lib
150-
packages/runtime/dist-types
149+
packages/*/lib
151150

152151
# Cypress
153152
cypress/screenshots

demos/middleware/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse } from 'next/server'
22
import type { NextRequest } from 'next/server'
33

4-
import { MiddlewareRequest } from '@netlify/plugin-nextjs/middleware'
4+
import { MiddlewareRequest } from '@netlify/next'
55

66
export async function middleware(req: NextRequest) {
77
let response

demos/middleware/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@netlify/plugin-nextjs": "*",
13+
"@netlify/next": "*",
1314
"next": "^12.2.0",
1415
"react": "18.0.0",
1516
"react-dom": "18.0.0"

package-lock.json

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"format:check-fix:prettier": "run-e format:check:prettier format:fix:prettier",
1515
"format:check:prettier": "cross-env-shell prettier --check $npm_package_config_prettier",
1616
"format:fix:prettier": "cross-env-shell prettier --write $npm_package_config_prettier",
17-
"build": "npm run -w @netlify/plugin-nextjs build",
17+
"build": "npm run build -w packages/next -w packages/runtime",
1818
"postinstall": "run-s build install-husky",
1919
"install-husky": "if-env CI=1 || husky install node_modules/@netlify/eslint-config-node/.husky",
2020
"test": "run-s build:demo test:jest",

packages/next/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@netlify/next",
3+
"version": "0.0.1",
4+
"description": "Enhanced Next.js features on Netlify",
5+
"main": "lib/index.js",
6+
"files": [
7+
"lib/**/*"
8+
],
9+
"devDependencies": {
10+
"@types/node": "^17.0.25",
11+
"next": "^12.2.0",
12+
"npm-run-all": "^4.1.5",
13+
"typescript": "^4.6.3"
14+
},
15+
"scripts": {
16+
"prepublishOnly": "run-s clean build",
17+
"clean": "rimraf lib",
18+
"build": "tsc",
19+
"watch": "tsc --watch",
20+
"prepare": "npm run build"
21+
},
22+
"peerDependencies": {
23+
"next": ">=12.2.0"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "git+https://github.com/netlify/netlify-plugin-nextjs.git"
28+
},
29+
"author": "",
30+
"license": "MIT",
31+
"bugs": {
32+
"url": "https://github.com/netlify/netlify-plugin-nextjs/issues"
33+
},
34+
"homepage": "https://github.com/netlify/netlify-plugin-nextjs#readme",
35+
"engines": {
36+
"node": ">=12.0.0"
37+
}
38+
}

packages/next/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './middleware'

0 commit comments

Comments
 (0)