Skip to content

Commit b400160

Browse files
authored
feat!: nuxt 3 compatibility (#59)
1 parent fd72587 commit b400160

22 files changed

+8053
-3478
lines changed

.github/workflows/ci.yml

+10-29
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,17 @@ on:
1010

1111
jobs:
1212
ci:
13-
runs-on: ${{ matrix.os }}
14-
15-
strategy:
16-
matrix:
17-
os: [ubuntu-latest]
18-
node: [14]
19-
13+
runs-on: ubuntu-latest
2014
steps:
15+
- uses: actions/checkout@v3
16+
- run: corepack enable
2117
- uses: actions/setup-node@v3
2218
with:
23-
node-version: ${{ matrix.node }}
24-
25-
- name: checkout
26-
uses: actions/checkout@v3
27-
28-
- name: cache node_modules
29-
uses: actions/cache@v3
30-
with:
31-
path: node_modules
32-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
33-
34-
- name: Install dependencies
35-
if: steps.cache.outputs.cache-hit != 'true'
36-
run: yarn
37-
38-
- name: Lint
39-
run: yarn lint
40-
41-
# - name: Test
42-
# run: yarn jest
19+
node-version: 16
20+
cache: "pnpm"
21+
- run: pnpm install
22+
- run: pnpm dev:prepare
23+
- run: pnpm lint
24+
- run: pnpm build
25+
- run: pnpm dev:build
4326

44-
# - name: Coverage
45-
# uses: codecov/codecov-action@v1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
*.log*
33
dist
44
.nuxt
5+
.output

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
strict-peer-dependencies=false
2+
shamefully-hoist=true

.nuxtrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
typescript.includeWorkspace=true
2+
imports.autoImport=false

package.json

+18-19
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,36 @@
1818
"repository": "nuxt-modules/web-vitals",
1919
"license": "MIT",
2020
"exports": {
21-
".": "./dist/index.js",
22-
"./*": "./*",
23-
"./dist/runtime/*": "./dist/runtime/*.mjs"
21+
".": "./dist/module.mjs",
22+
"./*": "./*"
2423
},
25-
"main": "./dist/index.js",
26-
"types": "./dist/index.d.ts",
24+
"main": "./dist/module.cjs",
25+
"types": "./dist/module.d.ts",
2726
"files": [
2827
"dist"
2928
],
3029
"scripts": {
31-
"build": "siroc build",
32-
"dev": "nuxt playground",
30+
"build": "nuxt build-module",
31+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
32+
"dev": "nuxt dev playground",
33+
"dev:build": "nuxt build playground",
3334
"lint": "eslint --ext .ts .",
34-
"prepublishOnly": "yarn build",
35-
"release": "yarn test && standard-version && npm publish && git push --follow-tags",
36-
"test": "yarn lint"
35+
"release": "pnpm test && standard-version && npm publish && git push --follow-tags",
36+
"test": "pnpm lint"
3737
},
3838
"dependencies": {
39+
"@nuxt/kit": "^3.0.0",
3940
"defu": "^6.1.1",
41+
"pathe": "^1.0.0",
4042
"ufo": "^1.0.0",
4143
"web-vitals": "^3.1.0"
4244
},
4345
"devDependencies": {
44-
"@nuxt/types": "latest",
45-
"@nuxtjs/eslint-config-typescript": "latest",
46-
"babel-eslint": "latest",
47-
"eslint": "latest",
48-
"nuxt-edge": "latest",
49-
"nuxt-swc": "latest",
50-
"siroc": "latest",
51-
"standard-version": "latest",
52-
"typescript": "latest"
46+
"@nuxt/module-builder": "^0.2.1",
47+
"@nuxtjs/eslint-config-typescript": "^12.0.0",
48+
"eslint": "^8.28.0",
49+
"nuxt": "^3.0.0",
50+
"standard-version": "^9.5.0",
51+
"typescript": "^4.9.3"
5352
}
5453
}
File renamed without changes.

playground-nuxt2/nuxt.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
buildModules: [
3+
require('..')
4+
],
5+
webVitals: {
6+
debug: true
7+
}
8+
// googleAnalytics: {
9+
// id: 'hello'
10+
// }
11+
}

playground-nuxt2/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "nuxt dev",
5+
"build": "nuxt build"
6+
},
7+
"devDependencies": {
8+
"nuxt": "^2.15.8"
9+
}
10+
}

playground-nuxt2/pages/about.vue

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<template>
2+
<div>
3+
<h1>About page</h1>
4+
<NuxtLink to="/">
5+
Home
6+
</NuxtLink>
7+
</div>
8+
</template>

playground-nuxt2/pages/index.vue

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<template>
2+
<div>
3+
<h1>Nuxt Vitals</h1>
4+
<NuxtLink to="/about">
5+
About page
6+
</NuxtLink>
7+
</div>
8+
</template>

0 commit comments

Comments
 (0)