Skip to content

Commit

Permalink
Merge pull request #8 from motea927/dev
Browse files Browse the repository at this point in the history
Support Nuxt 3
  • Loading branch information
motea927 authored May 31, 2024
2 parents 375eb07 + 1f8fc57 commit b9bf371
Show file tree
Hide file tree
Showing 23 changed files with 5,854 additions and 963 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x

- name: Setup
run: npm i -g @antfu/ni
Expand All @@ -33,7 +33,7 @@ jobs:

strategy:
matrix:
node: [16.x, 18.x]
node: [20.x]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

Expand Down
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,37 @@ export default defineConfig({
})
```

Example: [`playground/`](./playground/)
<br></details>

<details>
<summary>Nuxt</summary><br>

```ts
// nuxt.config.ts
export default defineNuxtConfig({
modules: [
[
'unplugin-overlay-layout/nuxt',
{
layoutPreview: {
style: {
position: 'absolute',
margin: 'auto',
inset: '0',
width: '13.34rem',
height: '7.5rem'
},
imageUrl: 'https://picsum.photos/200/300'
}
}
]
]
})

```
<br></details>


## Configuration

Options: [`Options/`](./src/types.ts)
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"build:plugin": "tsup",
"build:fix": "esno scripts/postbuild.ts",
"build:all": "npm run build:popup && npm run build:plugin && cp -r src/overlay-layout dist",
"dev:playground": "npm -C popup run dev & npm -C playground run dev",
"dev:vite": "npm -C popup run dev & npm -C playground/vite run dev",
"dev:nuxt3": "npm -C popup run dev & npm -C playground/nuxt3 run dev",
"lint": "eslint . --config .eslintrc.cjs",
"lint:fix": "eslint . --config .eslintrc.cjs && prettier --write -c .",
"release": "npm run build:all && bumpp && npm publish",
Expand Down Expand Up @@ -123,7 +124,7 @@
}
},
"dependencies": {
"@vueuse/core": "^10.7.2",
"@vueuse/core": "^10.9.0",
"sirv": "^2.0.4",
"unplugin": "^1.6.0"
},
Expand Down Expand Up @@ -154,5 +155,8 @@
"vite": "^5.0.5",
"vitest": "^0.34.6",
"webpack": "^5.89.0"
},
"resolutions": {
"ufo": "^1.5.3"
}
}
24 changes: 24 additions & 0 deletions playground/nuxt3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
75 changes: 75 additions & 0 deletions playground/nuxt3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
5 changes: 5 additions & 0 deletions playground/nuxt3/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<NuxtWelcome />
</div>
</template>
22 changes: 22 additions & 0 deletions playground/nuxt3/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import OverlayLayout from '../../src/nuxt'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
[
OverlayLayout,
{
layoutPreview: {
style: {
position: 'absolute',
margin: 'auto',
inset: '0',
width: '13.34rem',
height: '7.5rem'
},
imageUrl: 'https://picsum.photos/200/300'
}
}
]
]
})
17 changes: 17 additions & 0 deletions playground/nuxt3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"nuxt": "^3.11.2",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
}
}
Binary file added playground/nuxt3/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions playground/nuxt3/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}
4 changes: 4 additions & 0 deletions playground/nuxt3/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite'

import OverlayLayout from '../src/vite'
import OverlayLayout from '../../src/vite'

export default defineConfig({
plugins: [
Expand Down
Loading

0 comments on commit b9bf371

Please sign in to comment.