Skip to content

Commit

Permalink
fix(#77): current build not working for nuxt2
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDredd committed Jul 11, 2022
1 parent 375b6e5 commit 0b77360
Show file tree
Hide file tree
Showing 13 changed files with 14,466 additions and 43 deletions.
6 changes: 4 additions & 2 deletions docs/content/5.nuxt/1.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ description: ''
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
buildModules: ['@pinia/nuxt'],
modules: ['@pinia-orm/nuxt'],
modules: [
'@pinia/nuxt',
'@pinia-orm/nuxt'
],
// See https://github.com/nuxt/framework/issues/2371
nitro: {
externals: {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"packageManager": "pnpm@7.5.0",
"workspaces": {
"packages": [
"packages/*",
"playgrounds/*"
"packages/*"
]
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
},
"peerDependencies": {
"@pinia/nuxt": "^0.1.9",
"pinia": "^2.0.14"
"pinia": "^2.0.14",
"pinia-orm": "~0.10.0"
},
"dependencies": {
"@nuxt/kit": "^3.0.0-rc.4",
"pinia-orm": "~0.10.0"
"@nuxt/kit": "^3.0.0-rc.4"
},
"devDependencies": {
"@nuxt/module-builder": "latest",
Expand Down
4 changes: 2 additions & 2 deletions packages/pinia-orm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"email": "gregor@codedredd.de"
},
"funding": "https://github.com/sponsors/codedredd",
"main": "dist/index.cjs",
"main": "dist/index.js",
"jsdelivr": "dist/index.global.js",
"unpkg": "dist/index.global.js",
"module": "dist/index.mjs",
Expand All @@ -34,7 +34,7 @@
"README.md"
],
"scripts": {
"build": "rimraf dist && tsup src/index.ts --dts --format cjs,esm,iife",
"build": "tsup src/index.ts --dts --clean --format cjs,esm,iife",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . -l pinia-orm -r 1",
"coverage": "vue-demi-switch 3 && vitest --run --coverage",
"size": "size-limit",
Expand Down
2 changes: 1 addition & 1 deletion packages/pinia-orm/src/interpreter/Interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { normalize } from 'normalizr'
import { isArray } from '../support/Utils'
import type { Element, NormalizedData } from '../data/Data'
import type { Model } from '../model/Model'
import { Schema } from '@/schema/Schema'
import { Schema } from '../schema/Schema'

export class Interpreter {
/**
Expand Down
5 changes: 1 addition & 4 deletions playgrounds/nuxt2comp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"core-js": "^3.19.3",
"nuxt": "^2.15.8",
"pinia": "^2.0.14",
"pinia-orm": "^0.9.2",
"pinia-orm": "^0.10.0",
"vue": "^2.7.3",
"vue-server-renderer": "^2.7.3",
"vue-template-compiler": "^2.7.3",
Expand All @@ -39,8 +39,5 @@
"nuxt-windicss": "^2.4.2",
"postcss": "^8.4.14",
"prettier": "^2.7.1"
},
"installConfig": {
"hoistingLimits": "dependencies"
}
}
5 changes: 2 additions & 3 deletions playgrounds/nuxt2comp/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

<script lang="ts">
import { defineComponent } from '@nuxtjs/composition-api'
import { useRepo, useDataStore } from 'pinia-orm'
import { useRepo } from 'pinia-orm'
import User from '~/models/User'
import { useORMStore } from '~/stores/useORMStore'
export default defineComponent({
name: 'IndexPage',
setup() {
const userRepo = useRepo(User, useORMStore)
const userRepo = useRepo(User)
userRepo.save([
{
id: 1,
Expand Down
10,046 changes: 10,046 additions & 0 deletions playgrounds/nuxt2comp/yarn.lock

Large diffs are not rendered by default.

42 changes: 22 additions & 20 deletions playgrounds/nuxt3/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
<div>Nuxt module playground!</div>
</template>

<script setup>
<script setup lang="ts">
import User from './models/User'
import { useRepo } from 'pinia-orm'
onBeforeMount(() => {
const userRepo = useRepo(User)
const users = userRepo.save([
{
id: 1,
email: 'test@test.de',
name: 'test',
todos: [
{
id: 1,
title: 'Hoho',
},
{
id: 2,
title: 'Blub',
},
],
},
])
console.log(userRepo.with('todos').get())
})
const userRepo = useRepo(User)
const users = userRepo.save([
{
id: 1,
email: 'test@test.de',
name: 'test',
todos: [
{
id: 1,
title: 'Hoho',
},
{
id: 2,
title: 'Blub',
},
],
},
])
console.log(userRepo.with('todos').get())
</script>
6 changes: 4 additions & 2 deletions playgrounds/nuxt3/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
buildModules: ['@pinia/nuxt'],
modules: ['@pinia-orm/nuxt'],
modules: [
'@pinia/nuxt',
'@pinia-orm/nuxt'
],
// See https://github.com/nuxt/framework/issues/2371
nitro: {
externals: {
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/nuxt3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@pinia/nuxt": "^0.1.9",
"nuxt": "^3.0.0-rc.4",
"pinia": "^2.0.14",
"pinia-orm": "^0.9.2"
"pinia-orm": "^0.10.0"
}
}
Loading

0 comments on commit 0b77360

Please sign in to comment.