Migrate to Vue CLI v5

This commit is contained in:
silverpill 2022-05-18 14:33:06 +00:00
parent dee1cfa691
commit 461319a343
12 changed files with 11610 additions and 23367 deletions

View file

@ -6,7 +6,7 @@ module.exports = {
extends: [ extends: [
"plugin:vue/vue3-essential", "plugin:vue/vue3-essential",
"@vue/standard", "@vue/standard",
"@vue/typescript/recommended", "@vue/typescript",
], ],
parserOptions: { parserOptions: {
ecmaVersion: 2020, ecmaVersion: 2020,

35062
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -34,31 +34,27 @@
"@types/mocha": "^5.2.4", "@types/mocha": "^5.2.4",
"@types/sinon": "^10.0.4", "@types/sinon": "^10.0.4",
"@types/sinon-chai": "^3.2.5", "@types/sinon-chai": "^3.2.5",
"@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^4.18.0", "@typescript-eslint/parser": "^5.25.0",
"@vue/cli-plugin-eslint": "~4.5.16", "@vue/cli-plugin-eslint": "~5.0.4",
"@vue/cli-plugin-router": "~4.5.16", "@vue/cli-plugin-router": "~5.0.4",
"@vue/cli-plugin-typescript": "~4.5.16", "@vue/cli-plugin-typescript": "~5.0.4",
"@vue/cli-plugin-unit-mocha": "~4.5.16", "@vue/cli-plugin-unit-mocha": "~5.0.4",
"@vue/cli-service": "~4.5.16", "@vue/cli-service": "~5.0.4",
"@vue/compiler-sfc": "^3.2.23", "@vue/compiler-sfc": "^3.2.23",
"@vue/eslint-config-standard": "^5.1.2", "@vue/eslint-config-standard": "^6.1.0",
"@vue/eslint-config-typescript": "^7.0.0", "@vue/eslint-config-typescript": "^8.0.0",
"@vue/test-utils": "^2.0.0-0", "@vue/test-utils": "^2.0.0-0",
"chai": "^4.1.2", "chai": "^4.1.2",
"eslint": "^6.7.2", "eslint": "^7.32.0",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-vue": "^7.20.0",
"eslint-plugin-node": "^11.1.0", "sass": "~1.32.13",
"eslint-plugin-promise": "^4.2.1", "sass-loader": "^10.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"sinon": "^11.1.2", "sinon": "^11.1.2",
"sinon-chai": "^3.7.0", "sinon-chai": "^3.7.0",
"stylelint": "^13.13.1", "stylelint": "^13.13.1",
"stylelint-config-sass-guidelines": "^8.0.0", "stylelint-config-sass-guidelines": "^8.0.0",
"typescript": "~4.1.5" "typescript": "~4.5.5"
}, },
"lavamoat": { "lavamoat": {
"allowScripts": { "allowScripts": {
@ -67,7 +63,6 @@
"core-js": false, "core-js": false,
"nodent-runtime": false, "nodent-runtime": false,
"ejs": false, "ejs": false,
"node-sass": true,
"fsevents": false, "fsevents": false,
"@vue/cli-plugin-eslint>yorkie": false, "@vue/cli-plugin-eslint>yorkie": false,
"@vue/cli-plugin-unit-mocha>mochapack>@babel/runtime-corejs2>core-js": false, "@vue/cli-plugin-unit-mocha>mochapack>@babel/runtime-corejs2>core-js": false,
@ -75,7 +70,8 @@
"@vue/cli-service>webpack-bundle-analyzer>ejs": false, "@vue/cli-service>webpack-bundle-analyzer>ejs": false,
"@vue/cli-plugin-unit-mocha>mochapack>chokidar>fsevents": false, "@vue/cli-plugin-unit-mocha>mochapack>chokidar>fsevents": false,
"@vue/cli-service>webpack-dev-server>chokidar>fsevents": false, "@vue/cli-service>webpack-dev-server>chokidar>fsevents": false,
"sass-loader>webpack>watchpack>watchpack-chokidar2>chokidar>fsevents": false "sass-loader>webpack>watchpack>watchpack-chokidar2>chokidar>fsevents": false,
"sass-loader>node-sass": true
} }
} }
} }

View file

@ -210,7 +210,7 @@ export default class PostEditor extends Vue {
postData, postData,
this.attachment, this.attachment,
) )
} catch (error) { } catch (error: any) {
this.errorMessage = error.message this.errorMessage = error.message
return return
} }

View file

@ -17,7 +17,7 @@
<script setup lang="ts"> <script setup lang="ts">
/* eslint-disable no-undef */ /* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-unused-vars */
import type { Post as PostObject } from "@/api/posts" import type { Post as PostObject } from "@/api/posts"
import Post from "@/components/Post.vue" import Post from "@/components/Post.vue"

View file

@ -10,7 +10,7 @@
<script setup lang="ts"> <script setup lang="ts">
/* eslint-disable no-undef */ /* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-unused-vars */
import { Profile } from "@/api/users" import { Profile } from "@/api/users"
import Avatar from "@/components/Avatar.vue" import Avatar from "@/components/Avatar.vue"
import { useInstanceInfo } from "@/store/instance" import { useInstanceInfo } from "@/store/instance"

View file

@ -117,7 +117,7 @@ export default class LandingPage extends Vue {
invite_code: this.inviteCode, invite_code: this.inviteCode,
}) })
authToken = await getAccessToken(message, signature) authToken = await getAccessToken(message, signature)
} catch (error) { } catch (error: any) {
this.isLoading = false this.isLoading = false
this.registrationErrorMessage = error.message this.registrationErrorMessage = error.message
return return
@ -149,7 +149,7 @@ export default class LandingPage extends Vue {
try { try {
authToken = await getAccessToken(message, signature) authToken = await getAccessToken(message, signature)
user = await getCurrentUser(authToken) user = await getCurrentUser(authToken)
} catch (error) { } catch (error: any) {
this.loginErrorMessage = error.message this.loginErrorMessage = error.message
return return
} }

View file

@ -74,7 +74,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-unused-vars */
import { ref, onMounted } from "vue" import { ref, onMounted } from "vue"
import { PAGE_SIZE } from "@/api/common" import { PAGE_SIZE } from "@/api/common"
import { updateNotificationMarker } from "@/api/markers" import { updateNotificationMarker } from "@/api/markers"

View file

@ -59,7 +59,7 @@ export default class PostDetail extends Vue {
async mounted() { async mounted() {
try { try {
this.thread = await this.loader this.thread = await this.loader
} catch (error) { } catch (error: any) {
if (error.message === "post not found") { if (error.message === "post not found") {
// Show "not found" text // Show "not found" text
return return

View file

@ -66,7 +66,7 @@ export default class SearchResultList extends Vue {
) )
this.profiles = results.accounts this.profiles = results.accounts
this.posts = results.statuses this.posts = results.statuses
} catch (error) { } catch (error: any) {
this.errorMessage = error.message this.errorMessage = error.message
} }
this.isLoading = false this.isLoading = false

View file

@ -1,13 +1,16 @@
import { expect } from "chai" import { expect } from "chai"
import { shallowMount } from "@vue/test-utils" import { shallowMount } from "@vue/test-utils"
import Avatar from "@/components/Avatar.vue" // Import doesn't work because of sass-loader (SassError: Can't find stylesheet to import)
// import Avatar from "@/components/Avatar.vue"
describe("Avatar.vue", () => { describe("Avatar.vue", () => {
// Not working due to Vue bug https://github.com/vuejs/vue-next/issues/3590 // Not working due to Vue bug https://github.com/vuejs/vue-next/issues/3590
/*
it.skip("Renders component", () => { it.skip("Renders component", () => {
const profile = { avatar: "https://test.com" } const profile = { avatar: "https://test.com" }
const wrapper = shallowMount(Avatar as any, { props: { profile } }) const wrapper = shallowMount(Avatar as any, { props: { profile } })
expect(wrapper.text()).to.include("") expect(wrapper.text()).to.include("")
}) })
*/
}) })