Skip to content

Commit 27a5610

Browse files
committed
refactor: use compatibility v4 in playground
1 parent 055e5cd commit 27a5610

File tree

12 files changed

+153
-89
lines changed

12 files changed

+153
-89
lines changed

playground/app.vue renamed to playground/app/app.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import type { Product } from '~/types/product'
2+
import type { Product } from '~~/shared/types/product'
3+
import { createProduct, editProduct, deleteProduct } from '~~/shared/abilities'
34
45
const product: Product = {
56
id: 1,

playground/nuxt.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export default defineNuxtConfig({
22
modules: ['../src/module'],
33
authorization: {},
4+
future: {
5+
compatibilityVersion: 4,
6+
},
47
devtools: { enabled: true },
58
compatibilityDate: '2024-08-27',
69
})

playground/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"typecheck": "nuxi typecheck"
1010
},
1111
"dependencies": {
12-
"nuxt": "^3.13.2"
12+
"nuxt": "^3.13.2",
13+
"typescript": "^5.6.2",
14+
"vue": "^3.5.10",
15+
"vue-tsc": "^2.1.6"
1316
}
1417
}

playground/server/api/products/[id].patch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Product } from '~/types/product'
2-
import { editProduct } from '~/utils/abilities'
1+
import type { Product } from '~~/shared/types/product'
2+
import { editProduct } from '~~/shared/abilities'
33

44
export default defineEventHandler(async (event) => {
55
const product: Product = {

playground/server/api/products/index.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { listProducts } from '~/utils/abilities'
1+
import { listProducts } from '~~/shared/abilities'
22

33
export default defineEventHandler(async (event) => {
44
await authorize(event, listProducts)

playground/server/api/products/index.post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createProduct } from '~/utils/abilities'
1+
import { createProduct } from '~~/shared/abilities'
22

33
export default defineEventHandler(async (event) => {
44
await authorize(event, createProduct)

playground/server/plugins/authorization-reolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { User } from '~/types/user'
1+
import type { User } from '~~/shared/types/user'
22

33
export default defineNitroPlugin((nitroApp) => {
44
// https://github.com/nuxt/nuxt/issues/25710#issuecomment-1935622896

playground/utils/abilities.ts renamed to playground/shared/abilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Product } from '~/types/product'
2-
import type { User } from '~/types/user'
1+
import type { Product } from '~~/shared/types/product'
2+
import type { User } from '~~/shared/types/user'
33

44
export const listProducts = defineAbility({ allowGuest: true }, () => true)
55

playground/types/product.ts renamed to playground/shared/types/product.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { User } from '~/types/user'
1+
import type { User } from '~~/shared/types/user'
22

33
export type Product = {
44
id: number

0 commit comments

Comments
 (0)