Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

feat(vue 3): migrate from Vue.default.version to a fallback #847

Merged
merged 5 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@
},
"dependencies": {
"algoliasearch-helper": "^3.1.0",
"instantsearch.js": "^4.20.0"
"instantsearch.js": "^4.20.0",
"vue-demi": "npm:@eunjae-lee/[email protected]"
},
"peerDependencies": {
"algoliasearch": ">= 3.32.0 < 5",
"vue": "^2.6.0",
"vue": "^2.6.0 || >=3.0.0-rc.0",
"vue-server-renderer": "^2.6.11"
},
"devDependencies": {
Expand Down Expand Up @@ -114,11 +115,11 @@
"bundlesize": [
{
"path": "./dist/vue-instantsearch.js",
"maxSize": "52.75 kB"
"maxSize": "53.00 kB"
},
{
"path": "./dist/vue-instantsearch.common.js",
"maxSize": "16.25 kB"
"maxSize": "16.50 kB"
}
],
"resolutions": {
Expand Down
4 changes: 2 additions & 2 deletions src/util/createInstantSearchComponent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSuitMixin } from '../mixins/suit';
import { version } from '../../package.json'; // rollup does pick only what needed from json
import { _objectSpread } from './polyfills';
import Vue from 'vue';
import { getVueVersion } from './getVueVersion';

export const createInstantSearchComponent = component =>
_objectSpread(
Expand Down Expand Up @@ -54,7 +54,7 @@ export const createInstantSearchComponent = component =>
created() {
const searchClient = this.instantSearchInstance.client;
if (typeof searchClient.addAlgoliaAgent === 'function') {
searchClient.addAlgoliaAgent(`Vue (${Vue.version})`);
searchClient.addAlgoliaAgent(`Vue (${getVueVersion()})`);
searchClient.addAlgoliaAgent(`Vue InstantSearch (${version})`);
}
},
Expand Down
9 changes: 9 additions & 0 deletions src/util/getVueVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { isVue3, version, Vue2 } from 'vue-demi';

export function getVueVersion() {
if (isVue3) {
return version;
} else {
return Vue2.version;
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15556,6 +15556,11 @@ vue-class-component@^7.0.1:
resolved "https://registry.yarnpkg.com/vue-class-component/-/vue-class-component-7.0.1.tgz#7af2225c600667c7042b60712eefdf41dfc6de63"
integrity sha512-YIihdl7YmceEOjSwcxLhCXCNA3TKC2FStuMcjtuzhUAgw5x5d1T5gZTmVQHGyOaQsaKffL4GlZzYN3dlMYl53w==

"vue-demi@npm:@eunjae-lee/[email protected]":
version "0.9.2"
resolved "https://registry.yarnpkg.com/@eunjae-lee/vue-demi/-/vue-demi-0.9.2.tgz#234bb04c3cd0a5c85894cf8f2ac9a9bdb183d315"
integrity sha512-6q6RPme8/ZXscocbnMGc/xC+cKDgKLL36OaT15y0wBt/iIfXFrircucBatCIustAxSNtxTMRXHqEri3nS/pw4w==

vue-eslint-parser@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1"
Expand Down