Skip to content

Commit b9bf371

Browse files
authored
Merge pull request #8 from motea927/dev
Support Nuxt 3
2 parents 375eb07 + 1f8fc57 commit b9bf371

23 files changed

+5854
-963
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set node
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: 16.x
20+
node-version: 20.x
2121

2222
- name: Setup
2323
run: npm i -g @antfu/ni
@@ -33,7 +33,7 @@ jobs:
3333

3434
strategy:
3535
matrix:
36-
node: [16.x, 18.x]
36+
node: [20.x]
3737
os: [ubuntu-latest, windows-latest, macos-latest]
3838
fail-fast: false
3939

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,37 @@ export default defineConfig({
5454
})
5555
```
5656

57-
Example: [`playground/`](./playground/)
57+
<br></details>
58+
59+
<details>
60+
<summary>Nuxt</summary><br>
61+
62+
```ts
63+
// nuxt.config.ts
64+
export default defineNuxtConfig({
65+
modules: [
66+
[
67+
'unplugin-overlay-layout/nuxt',
68+
{
69+
layoutPreview: {
70+
style: {
71+
position: 'absolute',
72+
margin: 'auto',
73+
inset: '0',
74+
width: '13.34rem',
75+
height: '7.5rem'
76+
},
77+
imageUrl: 'https://picsum.photos/200/300'
78+
}
79+
}
80+
]
81+
]
82+
})
5883

84+
```
5985
<br></details>
6086

87+
6188
## Configuration
6289

6390
Options: [`Options/`](./src/types.ts)

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
"build:plugin": "tsup",
8888
"build:fix": "esno scripts/postbuild.ts",
8989
"build:all": "npm run build:popup && npm run build:plugin && cp -r src/overlay-layout dist",
90-
"dev:playground": "npm -C popup run dev & npm -C playground run dev",
90+
"dev:vite": "npm -C popup run dev & npm -C playground/vite run dev",
91+
"dev:nuxt3": "npm -C popup run dev & npm -C playground/nuxt3 run dev",
9192
"lint": "eslint . --config .eslintrc.cjs",
9293
"lint:fix": "eslint . --config .eslintrc.cjs && prettier --write -c .",
9394
"release": "npm run build:all && bumpp && npm publish",
@@ -123,7 +124,7 @@
123124
}
124125
},
125126
"dependencies": {
126-
"@vueuse/core": "^10.7.2",
127+
"@vueuse/core": "^10.9.0",
127128
"sirv": "^2.0.4",
128129
"unplugin": "^1.6.0"
129130
},
@@ -154,5 +155,8 @@
154155
"vite": "^5.0.5",
155156
"vitest": "^0.34.6",
156157
"webpack": "^5.89.0"
158+
},
159+
"resolutions": {
160+
"ufo": "^1.5.3"
157161
}
158162
}

playground/nuxt3/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

playground/nuxt3/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt 3 Minimal Starter
2+
3+
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4+
5+
## Setup
6+
7+
Make sure to install the dependencies:
8+
9+
```bash
10+
# npm
11+
npm install
12+
13+
# pnpm
14+
pnpm install
15+
16+
# yarn
17+
yarn install
18+
19+
# bun
20+
bun install
21+
```
22+
23+
## Development Server
24+
25+
Start the development server on `http://localhost:3000`:
26+
27+
```bash
28+
# npm
29+
npm run dev
30+
31+
# pnpm
32+
pnpm run dev
33+
34+
# yarn
35+
yarn dev
36+
37+
# bun
38+
bun run dev
39+
```
40+
41+
## Production
42+
43+
Build the application for production:
44+
45+
```bash
46+
# npm
47+
npm run build
48+
49+
# pnpm
50+
pnpm run build
51+
52+
# yarn
53+
yarn build
54+
55+
# bun
56+
bun run build
57+
```
58+
59+
Locally preview production build:
60+
61+
```bash
62+
# npm
63+
npm run preview
64+
65+
# pnpm
66+
pnpm run preview
67+
68+
# yarn
69+
yarn preview
70+
71+
# bun
72+
bun run preview
73+
```
74+
75+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

playground/nuxt3/app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div>
3+
<NuxtWelcome />
4+
</div>
5+
</template>

playground/nuxt3/nuxt.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import OverlayLayout from '../../src/nuxt'
2+
// https://nuxt.com/docs/api/configuration/nuxt-config
3+
export default defineNuxtConfig({
4+
devtools: { enabled: true },
5+
modules: [
6+
[
7+
OverlayLayout,
8+
{
9+
layoutPreview: {
10+
style: {
11+
position: 'absolute',
12+
margin: 'auto',
13+
inset: '0',
14+
width: '13.34rem',
15+
height: '7.5rem'
16+
},
17+
imageUrl: 'https://picsum.photos/200/300'
18+
}
19+
}
20+
]
21+
]
22+
})

playground/nuxt3/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "nuxt-app",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "nuxt build",
7+
"dev": "nuxt dev",
8+
"generate": "nuxt generate",
9+
"preview": "nuxt preview",
10+
"postinstall": "nuxt prepare"
11+
},
12+
"dependencies": {
13+
"nuxt": "^3.11.2",
14+
"vue": "^3.4.27",
15+
"vue-router": "^4.3.2"
16+
}
17+
}

playground/nuxt3/public/favicon.ico

4.19 KB
Binary file not shown.

playground/nuxt3/server/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../.nuxt/tsconfig.server.json"
3+
}

playground/nuxt3/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// https://nuxt.com/docs/guide/concepts/typescript
3+
"extends": "./.nuxt/tsconfig.json"
4+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

playground/vite.config.ts renamed to playground/vite/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite'
22

3-
import OverlayLayout from '../src/vite'
3+
import OverlayLayout from '../../src/vite'
44

55
export default defineConfig({
66
plugins: [

0 commit comments

Comments
 (0)