Skip to content

Commit 4c8574f

Browse files
committed
feat(actions): add lint action with pnpm
1 parent d919416 commit 4c8574f

File tree

9 files changed

+5385
-4791
lines changed

9 files changed

+5385
-4791
lines changed

.github/workflows/main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Main
2+
on:
3+
push:
4+
branches: ['main']
5+
pull_request: [opened, synchronized]
6+
7+
jobs:
8+
lint:
9+
name: Lint codebase
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
20+
- uses: pnpm/action-setup@v2
21+
name: Install pnpm
22+
with:
23+
version: 7
24+
run_install: false
25+
26+
- name: Get pnpm store directory
27+
id: pnpm-cache
28+
shell: bash
29+
run: |
30+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
31+
32+
- uses: actions/cache@v3
33+
name: Setup pnpm cache
34+
with:
35+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
36+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
37+
restore-keys: |
38+
${{ runner.os }}-pnpm-store-
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Lint
44+
run: pnpm lint

README.md

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# nextjs-basic-auth-middleware
22

3-
> :warning: Please upgrade to v2 if you use Next.js middleware version, v1 is broken. SSR Middleware for Next <=11 is still available on v1.
3+
44

55
Adds basic auth support to Next.js projects using the official middleware approach (with a `middleware` file).
66
Options can be set on the basic auth middleware and overridden using environment variables.
77

8+
## Compatibility table
9+
10+
| Next.js version | Plugin version |
11+
| --------------- | -------------- |
12+
| Next.js 13 | 3.x |
13+
| Next.js 12 | 2.x |
14+
| Next.js 10,11 | 1.x |
15+
16+
817
## Installation
918

1019
Run either of the following commands to add the package, based on your package manager of choice:
@@ -57,10 +66,6 @@ You can also use the `nextBasicAuthMiddleware` function to check basic auth in a
5766
> :warning: The middleware will still return a 401 and will quit processing the rest of the middleware. Add this middleware after any required work.
5867
5968

60-
### Original SSR approach
61-
62-
Please check `1.0.0` if you want to use this, this is no longer available in version >=2
63-
6469
### Setting environment variables
6570
If you want to override credentials you can use the `BASIC_AUTH_CREDENTIALS` environment variable:
6671

@@ -93,23 +98,4 @@ field | description | type
9398
`password`| The password | `string`
9499

95100

96-
## Local Development
97-
98-
Below is a list of commands you will probably find useful.
99-
100-
### `npm start` or `yarn start`
101-
102-
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for your convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.
103-
104-
Your library will be rebuilt if you make edits.
105-
106-
### `npm run build` or `yarn build`
107-
108-
Bundles the package to the `dist` folder.
109-
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).
110-
111-
### `npm test` or `yarn test`
112-
113-
Runs the test watcher (Jest) in an interactive mode.
114-
By default, runs tests related to files changed since the last commit.
115101

examples/basic/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createNextAuthMiddleware } from 'nextjs-basic-auth-middleware'
22

33
export const middleware = createNextAuthMiddleware({
4-
users: [{ name: 'test', password: 'testing' }],
4+
users: [{ name: 'test', password: 'test' }],
55
})
66

77
export const config = {

examples/basic/next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
i18n: {
4+
locales: ['es', 'en'],
5+
defaultLocale: 'es',
6+
},
37
reactStrictMode: true,
48
swcMinify: true,
59
}

examples/basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"next": "12.3.0",
12+
"next": "13.2.3",
1313
"react": "18.2.0",
1414
"react-dom": "18.2.0",
1515
"nextjs-basic-auth-middleware": "latest"

0 commit comments

Comments
 (0)