Skip to content

Upgrade to Vue 3, and upgrade other dependencies #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
882cfa4
Vue migration: somewhat working except router links
AjaiKN May 9, 2021
465e6f6
Fix router-links
AjaiKN May 9, 2021
52f73bb
Replace deprecated >>> with v-deep
AjaiKN May 9, 2021
1adb3c5
Fix router-link styling
AjaiKN May 9, 2021
3315249
Vue 3 eslint
AjaiKN May 9, 2021
78bda17
Migrate: transition class names
AjaiKN May 9, 2021
4b4b711
Declare emits option
AjaiKN May 9, 2021
03100f1
Upgrade vue-slicklist
AjaiKN May 9, 2021
98c2ab8
migratioN: Make watch deep (not sure whether this was a problem)
AjaiKN May 9, 2021
1eb04ed
Don't use watch compat behavior
AjaiKN May 9, 2021
ee538a4
Compat: use modelValue & update:modelValue instead of value & input
AjaiKN May 9, 2021
33a9b32
Use Vue 3 mode on our components except INSTANCE_EVENT_HOOKS
AjaiKN May 9, 2021
230a520
Move class and id properties
AjaiKN May 9, 2021
089aa97
Comment out vue-snack stuff
AjaiKN May 9, 2021
b84cdc0
Remove unneeded type cast
AjaiKN May 9, 2021
20d34a7
Replace vue-meta with <teleport to="head">
AjaiKN May 9, 2021
d428107
Revert "Comment out vue-snack stuff"
AjaiKN May 9, 2021
b437a54
Disable INSTANCE_EVENT_HOOKS migrator for our components
AjaiKN May 9, 2021
a4d1545
Use vue-snack-notify and switch to full Vue 3
AjaiKN May 22, 2021
e8e748b
Fix problems with buttons and forms
AjaiKN May 22, 2021
b6664b4
Upgrade to Vue CLI 5
AjaiKN May 22, 2021
08b207f
Remove unnecessary flag for Vue CLI 5
AjaiKN May 22, 2021
d3a27d3
Update browserslist
AjaiKN May 22, 2021
81a13b5
Don't support IE because Vue 3 doesn't support IE
AjaiKN May 22, 2021
56df370
Specify node version
AjaiKN May 22, 2021
e7d7601
Upgrade service worker for Workbox 6
AjaiKN May 22, 2021
8d336dd
Fix favicon (remove new faviconSVG)
AjaiKN May 22, 2021
e553f3a
Add todo
AjaiKN May 22, 2021
6dc3608
Upgrade vue-snack-notify
AjaiKN May 22, 2021
724afa0
Mostly fix page transitions
AjaiKN May 22, 2021
5b7c7d1
Don't do transition on initial render
AjaiKN May 22, 2021
b0b6acd
Upgrade vue-snack-notify
AjaiKN May 22, 2021
7c5845e
Upgrade deps
AjaiKN Jun 3, 2021
3257f2e
Lint
AjaiKN Jun 3, 2021
07c8b57
Add Vuex typings
AjaiKN Jun 3, 2021
e8631d6
Remove unneeded file
AjaiKN Jun 3, 2021
b2f6dfc
Hacky fix for scroll to active link not working
AjaiKN Jun 3, 2021
dc5684f
Remove unneeded TODO
AjaiKN Jun 3, 2021
7255015
Remove unneeded TODO
AjaiKN Jun 3, 2021
7df6cf8
Fix migration TODO
AjaiKN Jun 3, 2021
8dce14f
Upgrade to latest TypeScript
AjaiKN Jun 3, 2021
ad0d8d5
Fix TypeScript errors in Walnut model
AjaiKN Jun 3, 2021
fddfc74
Create new WalnutHallway class to keep hallway creation consistent
AjaiKN Jun 3, 2021
0c76425
Remove Vuex and use plain Vue Composition API
AjaiKN Jun 3, 2021
b5196c3
Merge branch 'master' into vue3
AjaiKN Jun 3, 2021
45fec55
Remove unneeded TODO
AjaiKN Jun 3, 2021
95ab0c3
Update yarn.lock
AjaiKN Jun 3, 2021
cf03c6d
Merge pull request #160 from WalnutProgramming/remove-vuex
AjaiKN Jun 3, 2021
1d61c6b
Upgrade room-finder to remove unnecessary transpilation and polyfills
AjaiKN Jun 5, 2021
df4d352
Upgrade room-finder
AjaiKN Jun 5, 2021
fd9e796
Remove unnecessary router-link-exact-active class
AjaiKN Jun 10, 2021
7d86875
Remove unnecessary script tags
AjaiKN Jun 10, 2021
71f7671
Remove vue-snack stuff
AjaiKN Jun 10, 2021
f4cd57e
Remove unused eslint-disables
AjaiKN Jun 10, 2021
0e637c8
Fix type warning
AjaiKN Jun 10, 2021
7fee84f
Upgrade dependencies
AjaiKN Jan 6, 2024
ecabcef
`yarn test:unit` working
AjaiKN Jan 6, 2024
72b696c
Copy dependencies & stuff from new Vue CLI project (`vue create`)
AjaiKN Jan 6, 2024
b382b30
Change vscode setting
AjaiKN Jan 6, 2024
f66ca89
Change something from `vue create`
AjaiKN Jan 6, 2024
dfac7fe
Upgrade node
AjaiKN Jan 6, 2024
f0d3cf1
Change browserslist
AjaiKN Jan 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.10.0
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 12
- 20.10.0
before_install:
- npm install -g yarn
git:
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"editor.formatOnSave": true,
"eslint.validate": ["vue", "html", "javascript", "typescript"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
110 changes: 56 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --modern",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint",
@@ -13,56 +13,70 @@
"tests": "yarn test"
},
"dependencies": {
"core-js": "^3.4.3",
"register-service-worker": "^1.6.2",
"room-finder": "0.3.0",
"vue": "^2.6.10",
"vue-meta": "^2.3.1",
"vue-router": "^3.1.3",
"vue-slicksort": "^1.1.3",
"vue-snack": "^0.1.4",
"vuex": "^3.1.2"
"room-finder": "0.4.2",
"vue-slicksort": "^2.0.0-alpha.5",
"vue-snack-notify": "^0.0.7",
"core-js": "^3.8.3",
"register-service-worker": "^1.7.2",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@types/jest": "^26.0.21",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-plugin-e2e-cypress": "~4.5.13",
"@vue/cli-plugin-eslint": "~4.5.13",
"@vue/cli-plugin-pwa": "~4.5.13",
"@vue/cli-plugin-router": "~4.5.13",
"@vue/cli-plugin-typescript": "~4.5.13",
"@vue/cli-plugin-unit-jest": "~4.5.13",
"@vue/cli-plugin-vuex": "~4.5.13",
"@vue/cli-service": "~4.5.13",
"@vue/eslint-config-airbnb": "^5.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^1.1.3",
"eslint": "^7.22.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^7.7.0",
"prettier": "^2.2.1",
"typescript": "~4.1.5",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.41.4"
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-e2e-cypress": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-pwa": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"@vue/test-utils": "^2.0.0-0",
"@vue/vue3-jest": "^27.0.0-alpha.1",
"babel-jest": "^27.0.6",
"cypress": "^9.7.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.0.5",
"prettier": "^2.4.1",
"ts-jest": "^27.0.4",
"typescript": "~4.5.5"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"@vue/airbnb",
"plugin:vue/recommended",
"@vue/prettier",
"@vue/typescript"
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
"plugin:prettier/recommended"
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser"
"ecmaVersion": 2020
},
"rules": {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": "off",
"import/prefer-default-export": "off",
"class-methods-use-this": "off",
"max-classes-per-file": "off",
"import/extensions": "off",
"import/no-unresolved": "off",
"vuejs-accessibility/click-events-have-key-events": "off",
"vue/html-button-has-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off"
},
"overrides": [
{
@@ -74,24 +88,12 @@
"jest": true
}
}
],
"rules": {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "warn",
"import/prefer-default-export": "off",
"class-methods-use-this": "off",
"max-classes-per-file": "off"
}
]
},
"prettier": {
"trailingComma": "es5"
},
"browserslist": [
"last 2 versions",
"firefox esr",
"not dead",
"> 0.5% in US",
"ie 10",
"cover 95% in US"
">0.5% in US, >1%, last 2 versions, Firefox ESR, last 4 iOS major versions, cover 85% in US, not dead"
]
}
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title>Walnut.Direct - Walnut Hills Directions</title>

<!-- font -->
<link
119 changes: 71 additions & 48 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -3,11 +3,19 @@
<header>
<nav>
<ul>
<router-link tag="li" to="/" exact>
<a> Home </a>
<router-link v-slot="{ navigate, href, isActive }" to="/" custom>
<li :class="isActive && 'router-link-active'">
<a :href="href" @click="navigate"> Home </a>
</li>
</router-link>
<router-link tag="li" to="/myschedule">
<a> My Schedule </a>
<router-link
v-slot="{ navigate, href, isActive }"
to="/myschedule"
custom
>
<li :class="isActive && 'router-link-active'">
<a :href="href" @click="navigate"> My Schedule </a>
</li>
</router-link>
<li>
<a
@@ -21,80 +29,95 @@
>Floor Map</a
>
</li>
<router-link tag="li" to="/settings">
<a> Settings </a>
<router-link
v-slot="{ navigate, href, isActive }"
to="/settings"
custom
>
<li :class="isActive && 'router-link-active'">
<a :href="href" @click="navigate"> Settings </a>
</li>
</router-link>
<router-link tag="li" to="/about">
<a> About </a>
<router-link v-slot="{ navigate, href, isActive }" to="/about" custom>
<li :class="isActive && 'router-link-active'">
<a :href="href" @click="navigate"> About </a>
</li>
</router-link>
<router-link tag="li" to="/feedback">
<a> Feedback </a>
<router-link
v-slot="{ navigate, href, isActive }"
to="/feedback"
custom
>
<li :class="isActive && 'router-link-active'">
<a :href="href" @click="navigate"> Feedback </a>
</li>
</router-link>
</ul>
</nav>
</header>

<transition :name="transitionName">
<router-view id="main-stuff" class="child-view"></router-view>
</transition>
<router-view v-slot="{ Component }">
<transition :name="transitionName">
<component :is="Component" id="main-stuff" class="child-view" />
</transition>
</router-view>

<TheRoomsDataList />
</div>

<teleport to="head"> </teleport>
</template>

<script lang="ts">
import Vue from "vue";
import { defineComponent } from "vue";

import TheRoomsDataList from "@/components/TheRoomsDataList.vue";
import router from "@/router/index";

export default Vue.extend({
export default defineComponent({
router,
components: { TheRoomsDataList },
data() {
return {
transitionName: "fade",
transitionName: "",
};
},
watch: {
$route(to, from) {
if (
"media" in window &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches
) {
this.transitionName = "fade";
} else if (from.path === "/" && to.path === "/directions") {
this.transitionName = "slide-left";
} else if (from.path === "/directions" && to.path === "/") {
this.transitionName = "slide-right";
} else {
this.transitionName = "fade";
}
$route: {
handler(to, from) {
if (from?.matched?.length === 0) {
// Don't do transition on initial render
this.transitionName = "";
} else if (
"media" in window &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches
) {
this.transitionName = "fade";
} else if (from.path === "/" && to.path === "/directions") {
this.transitionName = "slide-left";
} else if (from.path === "/directions" && to.path === "/") {
this.transitionName = "slide-right";
} else {
this.transitionName = "fade";
}
},
deep: true,
},
},
mounted() {
async mounted() {
// TODO: very hacky. Wait 20 milliseconds before scrolling to the
// active link because for some reason, it isn't marked as active
// for a while.
await new Promise((resolve) => {
setTimeout(() => resolve, 20);
});
const currentRouteNavItem = document.querySelector(
"header li.router-link-active a"
);
if (currentRouteNavItem != null) {
currentRouteNavItem.scrollIntoView({ inline: "center" });
}
},
metaInfo: {
// if no subcomponents specify a metaInfo.title, this title will be used
title: "Walnut Hills Directions",
// all titles will be injected into this template
titleTemplate: `Walnut.Direct - %s`,

meta: [
{
vmid: "description",
name: "description",
content:
"Straightforward directions between rooms in Walnut Hills High School. Created by the Walnut Hills Programming Club.",
},
],
},
});
</script>

@@ -155,7 +178,7 @@ header li.router-link-active a {
transition: opacity 0.5s ease;
}

.fade-enter,
.fade-enter-from,
.fade-leave-active {
opacity: 0;
}
@@ -168,13 +191,13 @@ header li.router-link-active a {
/*padding: 1vw;*/
transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);
}
.slide-left-enter,
.slide-left-enter-from,
.slide-right-leave-active {
opacity: 0;
transform: translate(30px, 0);
}
.slide-left-leave-active,
.slide-right-enter {
.slide-right-enter-from {
opacity: 0;
transform: translate(-30px, 0);
}
10 changes: 6 additions & 4 deletions src/components/RoomInput.vue
Original file line number Diff line number Diff line change
@@ -5,20 +5,22 @@
:name="name"
placeholder="type or select"
autocomplete="off"
:value="value"
:value="modelValue"
list="roomsList"
@input="$emit('input', $event.target.value)"
@input="$emit('update:modelValue', $event.target.value)"
@change="$emit('change', $event.target.value)"
/>
</template>

<script lang="ts">
import Vue from "vue";
import { defineComponent } from "vue";

export default Vue.extend({
export default defineComponent({
props: {
modelValue: { type: String, required: true },
name: { type: String, required: true },
},
emits: ["update:modelValue", "change"],
data() {
return { value: "" };
},
Loading