From 8e2669788b69c09a29672c62ee1f1b212c995fff Mon Sep 17 00:00:00 2001 From: YangQi Date: Sat, 29 Jul 2023 19:59:34 +0800 Subject: [PATCH] chore: migrate from Vuex to Pinia (#236) --- package-lock.json | 69 +++++-- package.json | 6 +- .../EditorHeader/ResetDialog.vue | 5 +- .../CodemirrorEditor/EditorHeader/index.vue | 8 +- .../CodemirrorEditor/InsertFormDialog.vue | 8 +- src/components/RunLoading.vue | 5 +- src/main.js | 23 ++- src/store/index.js | 194 ------------------ src/stores/index.js | 190 +++++++++++++++++ src/views/CodemirrorEditor.vue | 9 +- 10 files changed, 284 insertions(+), 233 deletions(-) delete mode 100644 src/store/index.js create mode 100644 src/stores/index.js diff --git a/package-lock.json b/package-lock.json index dd1fcbb..30d9fc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,17 +21,15 @@ "marked": "^4.0.18", "minio": "7.0.33", "node-fetch": "^3.2.10", + "pinia": "^2.1.6", "prettify": "^0.1.7", "qiniu-js": "^3.4.1", "uuid": "^8.3.2", - "vue": "^2.7.14", - "vuex": "^3.6.2" + "vue": "^2.7.14" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.5.19", "@vue/cli-plugin-eslint": "^4.5.19", - "@vue/cli-plugin-router": "^4.5.19", - "@vue/cli-plugin-vuex": "^4.5.12", "@vue/cli-service": "^4.5.15", "@vue/eslint-config-prettier": "^6.0.0", "async-validator": "^4.0.7", @@ -3881,6 +3879,11 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, + "node_modules/@vue/devtools-api": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" + }, "node_modules/@vue/eslint-config-prettier": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz", @@ -21901,6 +21904,56 @@ "node": ">=6" } }, + "node_modules/pinia": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.6.tgz", + "integrity": "sha512-bIU6QuE5qZviMmct5XwCesXelb5VavdOWKWaB17ggk++NUwQWWbP5YnsONTk3b752QkW9sACiR81rorpeOMSvQ==", + "dependencies": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.3.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/vue-demi": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", + "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -27019,14 +27072,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/vuex": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", - "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", - "peerDependencies": { - "vue": "^2.0.0" - } - }, "node_modules/watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", diff --git a/package.json b/package.json index 1dfe86f..23e9ae1 100644 --- a/package.json +++ b/package.json @@ -26,17 +26,15 @@ "marked": "^4.0.18", "minio": "7.0.33", "node-fetch": "^3.2.10", + "pinia": "^2.1.6", "prettify": "^0.1.7", "qiniu-js": "^3.4.1", "uuid": "^8.3.2", - "vue": "^2.7.14", - "vuex": "^3.6.2" + "vue": "^2.7.14" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.5.19", "@vue/cli-plugin-eslint": "^4.5.19", - "@vue/cli-plugin-router": "^4.5.19", - "@vue/cli-plugin-vuex": "^4.5.12", "@vue/cli-service": "^4.5.15", "@vue/eslint-config-prettier": "^6.0.0", "async-validator": "^4.0.7", diff --git a/src/components/CodemirrorEditor/EditorHeader/ResetDialog.vue b/src/components/CodemirrorEditor/EditorHeader/ResetDialog.vue index d33e0be..74b47a6 100644 --- a/src/components/CodemirrorEditor/EditorHeader/ResetDialog.vue +++ b/src/components/CodemirrorEditor/EditorHeader/ResetDialog.vue @@ -19,7 +19,8 @@ diff --git a/src/components/RunLoading.vue b/src/components/RunLoading.vue index 2437059..8a5f11b 100644 --- a/src/components/RunLoading.vue +++ b/src/components/RunLoading.vue @@ -12,7 +12,8 @@