Skip to content

Commit 4734f5e

Browse files
committed
Update package and readme ready for publishing
1 parent 10c9909 commit 4734f5e

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

README.md

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ It allows you to leverage the advanced reactivity features of Vue whilst retaini
1010

1111
With Vue Class Store there's no refactoring data into components or abstracting into modules, writing mutations or mapping getters; you simply write and instantiate classes then work with them directly.
1212

13-
Stores can be used locally or globally, outside or inside components, or even nested in other stores and are fully compatible with the Vue ecosystem because they are transparently converted into `Vue` instances.
13+
Stores can be used locally or globally, outside or inside components, nested in other stores and are fully compatible with the Vue ecosystem (including Nuxt) because they are transparently converted into `Vue` instances.
1414

15-
Working with stores in both the IDE and DevTools is easy as they are *just* classes, which means source maps, debugging and breakpoints work like you expect!
15+
Working with stores in both the IDE and DevTools is easy as they are *just* classes, which means source maps, debugging and breakpoints work like you expect:
1616

1717
![devtools](https://raw.githubusercontent.com/davestewart/vue-class-store/master/dev/devtools.png)
1818

@@ -30,7 +30,7 @@ npm i vue-class-store
3030
yarn add vue-class-store
3131
```
3232

33-
In your main project file, install the extension:
33+
In your main project file, install the plugin:
3434

3535
```javascript
3636
import Vue from 'vue'
@@ -79,7 +79,7 @@ export class Store {
7979
}
8080
```
8181

82-
When the class is instantiated, the decorator will convert the class to a new Vue instance and return it.
82+
When the class is instantiated, the decorator will convert it to a new Vue instance and return it.
8383

8484
### Instantiation
8585

@@ -210,17 +210,45 @@ export default {
210210
}
211211
```
212212

213+
## Nuxt
214+
215+
Because all data is passed by the constructor, Vue Class Store just works with SSR.
216+
217+
To set up, add a plugin file and config option:
218+
219+
```
220+
// plugins/vue-class-store.js
221+
import Vue from 'vue'
222+
import VueStore from 'vue-class-store'
223+
224+
Vue.use(VueStore.install)
225+
```
226+
227+
```
228+
// nuxt.config.js
229+
plugins: [
230+
'~/plugins/vue-class-store',
231+
],
232+
```
233+
213234
## Demo
214235

215-
The demo folder compares various state management approaches; check `demo/src/examples/*` :
236+
### Vue
216237

217-
- [Basic Class Store](./src/demo/examples/class-store)
218-
- [Inline Class Store](./src/demo/examples/class-store-inline)
219-
- [Class Store with Inheritance](./src/demo/examples/class-store-inheritance)
220-
- [Global Class Store](./src/demo/examples/class-store-global)
221-
- [Vue Component](./src/demo/examples/vue-component)
222-
- [Vue Model](./src/demo/examples/vue-model)
223-
- [Vuex](./src/demo/examples/vuex)
238+
The demo folder compares various state management approaches; check `demo/src/examples/*` .
239+
240+
Class Store:
241+
242+
- [Basic Class Store](./demo/src/examples/class-store)
243+
- [Inline Class Store](./demo/src/examples/class-store-inline)
244+
- [Class Store with Inheritance](./demo/src/examples/class-store-inheritance)
245+
- [Global Class Store](./demo/src/examples/class-store-global)
246+
247+
Alternatives:
248+
249+
- [Vue Component](./demo/src/examples/vue-component)
250+
- [Vue Model](./demo/src/examples/vue-model)
251+
- [Vuex](./demo/src/examples/vuex)
224252

225253
To run the demo, clone the repo and run the `demo` script:
226254

@@ -230,3 +258,19 @@ cd vue-class-store/demo
230258
npm install
231259
npm run demo
232260
```
261+
262+
### Nuxt
263+
264+
Nuxt has its own demo here:
265+
266+
- https://github.com/davestewart/nuxt-class-store
267+
268+
## Development
269+
270+
The package has various scripts:
271+
272+
- `npm run dev` - build and watch for development
273+
- `npm run build` - build for production
274+
275+
- `npm run demo` - run the demo
276+

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-class-store",
3-
"description": "Zero-boilerplate class-based stores for Vue",
4-
"version": "1.0.0-beta-5",
3+
"description": "Fully-reactive, zero-boilerplate class-based stores for Vue",
4+
"version": "1.0.0-beta-6",
55
"author": "Dave Stewart",
66
"license": "ISC",
77
"main": "dist/vue-class-store.js",
@@ -17,6 +17,7 @@
1717
"scripts": {
1818
"dev": "rollup -c build/rollup.js -w",
1919
"build": "rollup -c build/rollup.js",
20+
"demo": "cd demo && npm run demo",
2021
"stats": "node dev/stats.js",
2122
"test": "echo \"Error: no test specified\" && exit 1"
2223
},

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function makeOptions(model: R): ComponentOptions<any> {
2020
const descriptors = Object.getOwnPropertyDescriptors(prototype)
2121

2222
// options
23+
const name = prototype.constructor.name
2324
const data: R = {}
2425
const computed: R = {}
2526
const methods: R = {}
@@ -57,7 +58,7 @@ export function makeOptions(model: R): ComponentOptions<any> {
5758

5859
// return
5960
return {
60-
name: prototype.constructor.name,
61+
name,
6162
extends: extendsOptions,
6263
computed,
6364
methods,

0 commit comments

Comments
 (0)