Skip to content

Commit 8d27fa6

Browse files
committed
feat: migrating from vuex to pinia
1 parent 3827d22 commit 8d27fa6

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# vue3-boilerplate
22

3-
A Vue 3 Starter Boilerplate with Vue Router 4, Vuex 4, Typescript 4, Webpack 5, Prettier and More.
3+
A Vue 3 Starter Boilerplate with Vue Router 4, Pinia 2, Typescript 4, Webpack 5, Prettier and More.
44

55
**And not using the Vue CLI.**
66

@@ -13,7 +13,7 @@ A Vue 3 Starter Boilerplate with Vue Router 4, Vuex 4, Typescript 4, Webpack 5,
1313
│ ├─ assets // assets such as images or font files.
1414
│ ├─ components // universal Vue components.
1515
│ ├─ router // view's routers config.
16-
│ ├─ store // Vuex store modules.
16+
│ ├─ stores // Pinia stores.
1717
│ ├─ typings // typescript .d.ts files.
1818
│ └─ views // pages.
1919
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"dependencies": {
1313
"@babel/runtime": "^7.17.8",
1414
"core-js": "^3.21.1",
15+
"pinia": "^2.0.12",
1516
"vue": "^3.2.31",
16-
"vue-router": "^4.0.14",
17-
"vuex": "^4.0.2"
17+
"vue-router": "^4.0.14"
1818
},
1919
"devDependencies": {
2020
"@babel/core": "^7.17.8",

service/config/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = {
7070
],
7171

7272
module: {
73-
noParse: /^(vue|vue-router|vuex|vuex-router-sync)$/,
73+
noParse: /^(vue|vue-router|pinia)$/,
7474

7575
rules: [
7676
{

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createApp } from 'vue'
22
import App from './App.vue'
33
import router from './router'
4-
import store from './store'
4+
import { createPinia } from 'pinia'
55

6-
createApp(App).use(router).use(store).mount('#app')
6+
createApp(App).use(router).use(createPinia()).mount('#app')

src/store/index.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/stores/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineStore } from 'pinia'
2+
3+
export const useMainStore = defineStore('main', {
4+
state: () => ({}),
5+
actions: {},
6+
})

yarn.lock

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,11 +1285,16 @@
12851285
"@vue/compiler-dom" "3.2.31"
12861286
"@vue/shared" "3.2.31"
12871287

1288-
"@vue/devtools-api@^6.0.0", "@vue/devtools-api@^6.0.0-beta.11":
1288+
"@vue/devtools-api@^6.0.0":
12891289
version "6.1.3"
12901290
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.1.3.tgz#a44c52e8fa6d22f84db3abdcdd0be5135b7dd7cf"
12911291
integrity sha512-79InfO2xHv+WHIrH1bHXQUiQD/wMls9qBk6WVwGCbdwP7/3zINtvqPNMtmSHXsIKjvUAHc8L0ouOj6ZQQRmcXg==
12921292

1293+
"@vue/devtools-api@^6.1.0":
1294+
version "6.1.4"
1295+
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.1.4.tgz#b4aec2f4b4599e11ba774a50c67fa378c9824e53"
1296+
integrity sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==
1297+
12931298
12941299
version "3.2.31"
12951300
resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.31.tgz#0f5b25c24e70edab2b613d5305c465b50fc00911"
@@ -3968,6 +3973,14 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3:
39683973
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
39693974
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
39703975

3976+
pinia@^2.0.12:
3977+
version "2.0.12"
3978+
resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.12.tgz#4c6f7f59cb41f56f20deee71c403e66d8d3c637d"
3979+
integrity sha512-tUeuYGFrLU5irmGyRAIxp35q1OTcZ8sKpGT4XkPeVcG35W4R6cfXDbCGexzmVqH5lTQJJTXXbNGutIu9yS5yew==
3980+
dependencies:
3981+
"@vue/devtools-api" "^6.1.0"
3982+
vue-demi "*"
3983+
39713984
pkg-dir@^4.1.0:
39723985
version "4.2.0"
39733986
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
@@ -5090,6 +5103,11 @@ vary@~1.1.2:
50905103
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
50915104
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
50925105

5106+
vue-demi@*:
5107+
version "0.12.5"
5108+
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.12.5.tgz#8eeed566a7d86eb090209a11723f887d28aeb2d1"
5109+
integrity sha512-BREuTgTYlUr0zw0EZn3hnhC3I6gPWv+Kwh4MCih6QcAeaTlaIX0DwOVN0wHej7hSvDPecz4jygy/idsgKfW58Q==
5110+
50935111
vue-eslint-parser@^8.0.1, vue-eslint-parser@^8.3.0:
50945112
version "8.3.0"
50955113
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-8.3.0.tgz#5d31129a1b3dd89c0069ca0a1c88f970c360bd0d"
@@ -5138,13 +5156,6 @@ vue@^3.2.31:
51385156
"@vue/server-renderer" "3.2.31"
51395157
"@vue/shared" "3.2.31"
51405158

5141-
vuex@^4.0.2:
5142-
version "4.0.2"
5143-
resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.2.tgz#f896dbd5bf2a0e963f00c67e9b610de749ccacc9"
5144-
integrity sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==
5145-
dependencies:
5146-
"@vue/devtools-api" "^6.0.0-beta.11"
5147-
51485159
watchpack@^2.3.1:
51495160
version "2.3.1"
51505161
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.3.1.tgz#4200d9447b401156eeca7767ee610f8809bc9d25"

0 commit comments

Comments
 (0)