Skip to content

Commit

Permalink
Upgrade Vue to 2.7. Nuxt JS to latest v2. Swap kolibri-tools for koli…
Browse files Browse the repository at this point in the history
…bri-format.
  • Loading branch information
rtibbles committed Dec 4, 2024
1 parent dd31b54 commit 795da0c
Show file tree
Hide file tree
Showing 24 changed files with 3,283 additions and 4,272 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const esLintConfig = require('kolibri-tools/.eslintrc');
const esLintConfig = require('kolibri-format/.eslintrc');

// Vuetify's helper attributes use hyphens and they would
// not be recognized if auto-formatted to camel case
Expand All @@ -7,7 +7,7 @@ esLintConfig.rules['vue/attribute-hyphenation'] = 0;
// This rule conflicts with Nuxt page naming
esLintConfig.rules['kolibri/vue-filename-and-component-name-match'] = 0;

// This rule is currently disabled in kolibri-tools/.eslintrc
// This rule is currently disabled in kolibri-format/.eslintrc
esLintConfig.rules['vue/require-default-prop'] = 1;

// max-len rules are unhelpful for documentation
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/usekliveregion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

<script>
import { ref } from '@vue/composition-api';
import { ref } from 'vue';
import useKLiveRegion from '../../lib/composables/useKLiveRegion';
export default {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/usekresponsivewindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

<script>
import { computed } from '@vue/composition-api';
import { computed } from 'vue';
import useKResponsiveWindow from '../../lib/composables/useKResponsiveWindow';
export default {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/usekshow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

<script>
import { ref } from '@vue/composition-api';
import { ref } from 'vue';
import useKShow from '../../lib/composables/useKShow';
import PropsTable from '../common/DocsPageTemplate/jsdocs/PropsTable';
Expand Down
2 changes: 0 additions & 2 deletions docs/plugins/load-lib-components.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Vue from 'vue';
import VueCompositionAPI from '@vue/composition-api';
import VueIntl from 'vue-intl';
import KThemePlugin from '~~/lib/KThemePlugin';
import trackInputModality from '~~/lib/styles/trackInputModality';
Expand All @@ -9,6 +8,5 @@ import trackInputModality from '~~/lib/styles/trackInputModality';
// See `KThemePlugin` `$coreOutline` and `globalThemeState.inputModality`
trackInputModality({ disableFocusRingByDefault: false });

Vue.use(VueCompositionAPI);
Vue.use(KThemePlugin);
Vue.use(VueIntl);
2 changes: 0 additions & 2 deletions jest.conf/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'mock-match-media/jest-setup';
import Vue from 'vue';
import VueRouter from 'vue-router';
import VueIntl from 'vue-intl';
import VueCompositionAPI from '@vue/composition-api';
import KThemePlugin from '../lib/KThemePlugin';

global.beforeEach(() => {
Expand All @@ -30,7 +29,6 @@ global.afterEach(() => {

// Register Vue plugins and components
Vue.use(VueRouter);
Vue.use(VueCompositionAPI);
Vue.use(KThemePlugin);
Vue.use(VueIntl);

Expand Down
2 changes: 1 addition & 1 deletion lib/KDropdownMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<script>
import { computed } from '@vue/composition-api';
import { computed } from 'vue';
import UiMenu from './keen/UiMenu';
import UiPopover from './keen/UiPopover';
import useKContextMenu from './composables/_useKContextMenu';
Expand Down
2 changes: 1 addition & 1 deletion lib/KTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

<script>
import { ref, computed, watch } from '@vue/composition-api';
import { ref, computed, watch } from 'vue';
import useSorting, {
SORT_ORDER_ASC,
SORT_ORDER_DESC,
Expand Down
2 changes: 1 addition & 1 deletion lib/KTable/useSorting/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref } from '@vue/composition-api';
import { ref } from 'vue';
import useSorting, {
SORT_ORDER_ASC,
SORT_ORDER_DESC,
Expand Down
2 changes: 1 addition & 1 deletion lib/KTable/useSorting/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, computed } from '@vue/composition-api';
import { ref, computed } from 'vue';
import _ from 'lodash';

export const SORT_ORDER_ASC = 'asc';
Expand Down
2 changes: 1 addition & 1 deletion lib/cards/KCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

<script>
import { inject } from '@vue/composition-api';
import { inject } from 'vue';
const Orientations = {
HORIZONTAL: 'horizontal',
Expand Down
2 changes: 1 addition & 1 deletion lib/cards/KCardGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<script>
import { watch, ref, provide } from '@vue/composition-api';
import { watch, ref, provide } from 'vue';
import { LAYOUT_1_1_1, LAYOUT_1_2_2, LAYOUT_1_2_3 } from './gridBaseLayouts';
import useGridLayout from './useGridLayout';
Expand Down
4 changes: 2 additions & 2 deletions lib/cards/useGridLayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cloneDeep from 'lodash/cloneDeep';
import { watch, ref, toRefs } from '@vue/composition-api';
import { watch, ref, toRefs } from 'vue';

import useKResponsiveWindow from '../composables/useKResponsiveWindow';

Expand Down Expand Up @@ -60,7 +60,7 @@ export default function useGridLayout(props) {
([newBreakpoint]) => {
currentBreakpointConfig.value = getLayoutConfigForBreakpoint(props, newBreakpoint);
},
{ immediate: true, deep: true }
{ immediate: true, deep: true },
);

return { currentBreakpointConfig, windowBreakpoint };
Expand Down
7 changes: 3 additions & 4 deletions lib/cards/useGridLoading.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Vue from 'vue';
import { ref, watch, onMounted, toRefs, computed } from '@vue/composition-api';
import Vue, { ref, watch, onMounted, toRefs, computed } from 'vue';

import useGridLayout from './useGridLayout';
import { getBreakpointConfig } from './utils';
Expand Down Expand Up @@ -84,7 +83,7 @@ export default function useGridLoading(props) {
}, remainingLoadingTime);
}
},
{ immediate: true }
{ immediate: true },
);

// Used by `KCardGrid` to prevent jarring UX:
Expand Down Expand Up @@ -126,7 +125,7 @@ export default function useGridLoading(props) {
}
}
},
{ immediate: true, deep: true }
{ immediate: true, deep: true },
);

return {
Expand Down
10 changes: 1 addition & 9 deletions lib/composables/_useKContextMenu.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import './composition-api.js'; //Due to @vue/composition-api shortcomings, add plugin prior to use in kolibri, studio and tests

import {
ref,
computed,
onMounted,
onBeforeUnmount,
getCurrentInstance,
} from '@vue/composition-api';
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';

const activeMenu = ref(null);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineComponent } from '@vue/composition-api';
import { defineComponent } from 'vue';
import { mount } from '@vue/test-utils';
import useKWindowDimensions from '../';

Expand Down
3 changes: 1 addition & 2 deletions lib/composables/_useKWindowDimensions/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../composition-api'; //Due to @vue/composition-api shortcomings, add plugin prior to use in kolibri, studio and tests
import { onMounted, onUnmounted, ref } from '@vue/composition-api';
import { onMounted, onUnmounted, ref } from 'vue';
import { throttle } from 'frame-throttle';
import { isNuxtServerSideRendering } from '../../utils';

Expand Down
4 changes: 0 additions & 4 deletions lib/composables/composition-api.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/composables/useKResponsiveElement.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { throttle } from 'frame-throttle';
import { onMounted, onBeforeUnmount, ref, getCurrentInstance } from '@vue/composition-api';
import { onMounted, onBeforeUnmount, ref, getCurrentInstance } from 'vue';

let _resizeObserver;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setMedia } from 'mock-match-media';
import { defineComponent } from '@vue/composition-api';
import { defineComponent } from 'vue';
import { mount } from '@vue/test-utils';
import useKResponsiveWindow from '../';
import { resizeWindow, testAfterResize } from '../../../../jest.conf/testUtils';
Expand Down
2 changes: 1 addition & 1 deletion lib/composables/useKResponsiveWindow/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, onBeforeUnmount, onMounted, ref, watch } from '@vue/composition-api';
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import useKWindowDimensions, { windowWidth, windowHeight } from '../_useKWindowDimensions';
import { isNuxtServerSideRendering } from '../../utils';
import MediaQuery from './MediaQuery';
Expand Down
2 changes: 1 addition & 1 deletion lib/composables/useKShow/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref } from '@vue/composition-api';
import { ref } from 'vue';
import has from 'lodash/has';

/**
Expand Down
24 changes: 7 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@
"license": "MIT",
"author": "Learning Equality",
"scripts": {
"dev": "npm-run-all --parallel dev-only _lint-watch-fix _api-watch pregenerate",
"dev": "concurrently yarn:dev-only yarn:_api-watch yarn:pregenerate",
"generate": "yarn run pregenerate && nuxt generate",
"lint": "kolibri-tools lint --pattern '**/*.{js,vue,scss,less,css}' --ignore '**/node_modules/**,**/.nuxt/**,**/dist/**,**/lib/KIcon/precompiled-icons/**,**/lib/keen/**,**/docs/environment.js,**/docs/jsdocs.js'",
"lint": "kolibri-format --pattern '**/*.{js,vue,scss,less,css}' --ignore '**/node_modules/**' '**/.nuxt/**' '**/dist/**' '**/lib/KIcon/precompiled-icons/**' '**/lib/keen/**' '**/docs/environment.js' '**/docs/jsdocs.js'",
"lint-fix": "yarn lint -w",
"lint-watch": "yarn lint -m",
"pregenerate": "node utils/pregenerate.js",
"dev-only": "nuxt --port 4000",
"precompile-svgs": "node utils/precompileSvgs/index.js && yarn run pregenerate",
"precompile-custom-svgs": "node utils/precompileSvgs/index.js --custom && yarn run pregenerate",
"_lint-watch-fix": "yarn lint -w -m",
"test": "jest --config=jest.conf/index.js",
"_api-watch": "chokidar \"**/lib/**\" -c \"node utils/extractApi.js\""
},
"files": [
"lib"
],
"dependencies": {
"@vue/composition-api": "1.7.2",
"aphrodite": "https://github.com/learningequality/aphrodite/",
"autosize": "3.0.21",
"color": "3.2.1",
Expand All @@ -39,6 +36,7 @@
"popper.js": "1.16.1",
"purecss": "2.2.0",
"tippy.js": "4.3.5",
"vue": "2",
"vue-intl": "3.1.0",
"vue2-teleport": "1.1.4",
"xstate": "4.38.3"
Expand All @@ -51,19 +49,20 @@
"babel-jest": "^29.7.0",
"browserslist-config-kolibri": "0.16.0-dev.7",
"chokidar-cli": "^3.0.0",
"concurrently": "^9.1.0",
"consola": "^2.15.3",
"eslint-import-resolver-nuxt": "^1.0.1",
"globby": "^6.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-serializer-vue": "^3.1.0",
"kolibri-tools": "0.16.1-dev.1",
"kolibri-format": "^1.0.0",
"lockr": "^0.8.4",
"material-design-icons": "^3.0.1",
"mock-match-media": "^0.4.3",
"node-sass": "^9.0.0",
"normalize.css": "^8.0.1",
"npm-run-all": "^4.1.5",
"nuxt": "2.15.8",
"nuxt": "2.18.1",
"prismjs": "^1.27.0",
"raw-loader": "0.5.1",
"sass-loader": "^10.5.2",
Expand All @@ -78,15 +77,6 @@
"vue-template-compiler": "2.6.14",
"xml-loader": "^1.2.1"
},
"resolutions": {
"@babel/preset-env": "7.14.1",
"postcss": "8.4.38",
"postcss-loader": "3.0.0",
"css-loader": "4.3.0",
"vue": "2.6.14",
"vue-server-renderer": "2.6.14",
"vue-loader": "15.9.7"
},
"browserslist": [
"extends browserslist-config-kolibri"
]
Expand Down
Loading

0 comments on commit 795da0c

Please sign in to comment.