Skip to content

Commit

Permalink
Replace nuxt-class-component to nuxt-property-decorator (#2168)
Browse files Browse the repository at this point in the history
* replace nuxt-class-component to nuxt-property-decorator

* fix package-lock.json

* fix remark docs

Co-authored-by: mshcherbak <[email protected]>
  • Loading branch information
dragoonzx and mshcherbak authored Apr 18, 2021
1 parent fe9d599 commit 7713121
Show file tree
Hide file tree
Showing 9 changed files with 7,049 additions and 10,154 deletions.
2 changes: 1 addition & 1 deletion template/client/components/ActionBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</template>

<script lang="ts">
import Component, { mixins } from 'nuxt-class-component'
import { Component, mixins } from 'nuxt-property-decorator'
import { RawCommentType } from '~/logic/comments/models'
import TypedStoreMixin from '~/mixins/typed-store'
Expand Down
2 changes: 1 addition & 1 deletion template/client/components/AppLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</template>

<script lang="ts">
import Component from 'nuxt-class-component'
import { Component } from 'nuxt-property-decorator'
import Vue from 'vue'
// @vue/component
Expand Down
2 changes: 1 addition & 1 deletion template/client/components/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</template>

<script lang="ts">
import Component, { mixins } from 'nuxt-class-component'
import { Component, mixins } from 'nuxt-property-decorator'
import { Prop } from 'vue-property-decorator'
import { CommentType } from '~/logic/comments/types'
Expand Down
2 changes: 1 addition & 1 deletion template/client/mixins/typed-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from 'nuxt-class-component'
import { Component } from 'nuxt-property-decorator'
import Vue from 'vue'
import { useStore } from 'vuex-simple'

Expand Down
2 changes: 1 addition & 1 deletion template/client/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</template>

<script lang="ts">
import Component, { mixins } from 'nuxt-class-component'
import { Component, mixins } from 'nuxt-property-decorator'
import { Store } from 'vuex'
import { useStore } from 'vuex-simple'
Expand Down
3 changes: 1 addition & 2 deletions template/docs/template/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ that are required for our app. Like:

## Supporting packages

We use [`nuxt-class-component`](https://github.com/nuxt-community/nuxt-class-component)
and [`nuxt-property-decorator`](https://github.com/nuxt-community/nuxt-property-decorator)
We use [`nuxt-property-decorator`](https://github.com/nuxt-community/nuxt-property-decorator)
to make our `Vue` components type-safe.

We also use [`vuex-class`](https://github.com/ktsn/vuex-class)
Expand Down
16 changes: 6 additions & 10 deletions template/docs/template/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ Here you can have a brief overview of what is going on inside `Nuxt`:

We do not recommend to switch to raw `Vue`, unless you 100% sure.

## nuxt-class-component
## nuxt-property-decorator

First of all, we use `class`es to define components.
We do it with the help of several libraries:

1. [`nuxt-class-component`][nuxt-class-component] - pretty much the same as
[`vue-class-component`][vue-class-component], but with `nuxt` specific
callbacks defined
1. [`nuxt-property-decorator`][nuxt-property-decorator] - pretty much the same
as [`vue-class-component`][vue-class-component], but with `nuxt` specific
callbacks defined & allows defining some useful properties using decorators

2. [`nuxt-property-decorator`][nuxt-property-decorator] that allows defining
some useful properties using decorators

3. [`vuex-class`][vuex-class] that allows defining bindings to `vuex`
2. [`vuex-class`][vuex-class] that allows defining bindings to `vuex`

This way we can achieve *some* level of type safety. It is not 100% safe.
But it is something.
Expand Down Expand Up @@ -95,7 +92,7 @@ And used:

```ts
import Vue from 'vue'
import Component from 'nuxt-class-component'
import { Component } from 'nuxt-property-decorator'
import { useStore } from 'vuex-simple'

// Import your store:
Expand Down Expand Up @@ -170,7 +167,6 @@ import { Container } from 'vue-typedi'
import tokens from '~/logic/tokens'
```

[nuxt-class-component]: https://github.com/nuxt-community/nuxt-class-component
[vue-class-component]: https://github.com/vuejs/vue-class-component
[nuxt-property-decorator]: https://github.com/nuxt-community/nuxt-property-decorator
[vuex-class]: https://github.com/ktsn/vuex-class/
Expand Down
Loading

0 comments on commit 7713121

Please sign in to comment.