Skip to content
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

chore(examples): migrate vue examples to vite #5961

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"packages/vue-instantsearch",
"packages/instantsearch.css"
],
"node": "16"
"node": "20"
}
8 changes: 1 addition & 7 deletions examples/vue/default-theme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ yarn install
### Compiles and hot-reloads for development

```
yarn run serve
yarn run dev
```

### Compiles and minifies for production

```
yarn run build
```

### Lints and fixes files

```
yarn run lint
```
23 changes: 23 additions & 0 deletions examples/vue/default-theme/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>default-theme</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.4.5/themes/algolia.min.css"
/>
</head>
<body>
<noscript>
<strong>
We're sorry but default-theme doesn't work properly without JavaScript
enabled. Please enable it to continue.
</strong>
</noscript>
<div id="app"></div>
<script type="module" src="./src/main.js"></script>
</body>
</html>
18 changes: 7 additions & 11 deletions examples/vue/default-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@
"version": "0.34.0",
"private": true,
"scripts": {
"serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
"website:examples": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build --dest ../../../website/examples/vue/default-theme"
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"website:examples": "vite build --outDir ../../../website/examples/vue/default-theme --base /examples/vue/default-theme"
},
"dependencies": {
"algoliasearch": "4.14.3",
"core-js": "2",
"instantsearch.js": "4.62.0",
"vue": "2.7.14",
"vue-instantsearch": "4.13.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "3.12.1",
"@vue/cli-service": "3.12.1",
"vite": "5.0.7",
"vite-plugin-commonjs": "0.10.0",
"@vitejs/plugin-vue2": "2.3.1",
"vue-template-compiler": "2.7.14"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
Expand Down
25 changes: 0 additions & 25 deletions examples/vue/default-theme/public/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions examples/vue/default-theme/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ import algoliasearch from 'algoliasearch/lite';
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
import { simple as simpleMapping } from 'instantsearch.js/es/lib/stateMappings';

import './App.css';

export default {
data() {
return {
Expand Down
3 changes: 2 additions & 1 deletion examples/vue/default-theme/src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from 'vue';
import InstantSearch from 'vue-instantsearch';
import InstantSearch from 'vue-instantsearch/vue2/es';

import './App.css';
import App from './App.vue';

Vue.use(InstantSearch);
Expand Down
7 changes: 7 additions & 0 deletions examples/vue/default-theme/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import vue from '@vitejs/plugin-vue2';
import { defineConfig } from 'vite';
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
plugins: [commonjs(), vue()],
});
6 changes: 0 additions & 6 deletions examples/vue/default-theme/vue.config.js

This file was deleted.

8 changes: 1 addition & 7 deletions examples/vue/e-commerce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ yarn install
### Compiles and hot-reloads for development

```
yarn run serve
yarn run dev
```

### Compiles and minifies for production

```
yarn run build
```

### Lints and fixes files

```
yarn run lint
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
/>
<meta name="theme-color" content="#e2a400" />

<link rel="shortcut icon" href="<%= BASE_URL %>favicon.png" />
<link rel="manifest" href="<%= BASE_URL %>manifest.webmanifest" />
<link rel="shortcut icon" href="/favicon.png" />
<link rel="manifest" href="/manifest.webmanifest" />

<link
rel="stylesheet"
Expand All @@ -29,5 +29,6 @@
<noscript>You need to enable JavaScript to run this app.</noscript>

<div id="app"></div>
<script type="module" src="./src/main.js"></script>
</body>
</html>
18 changes: 7 additions & 11 deletions examples/vue/e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
"version": "0.34.0",
"private": true,
"scripts": {
"serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
"website:examples": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build --dest ../../../website/examples/vue/e-commerce"
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"website:examples": "vite build --outDir ../../../website/examples/vue/e-commerce --base /examples/vue/e-commerce"
},
"dependencies": {
"algoliasearch": "4.14.3",
"core-js": "2",
"instantsearch.js": "4.62.0",
"vue": "2.7.14",
"vue-instantsearch": "4.13.1",
"vue-slider-component": "3.0.32"
},
"devDependencies": {
"@vue/cli-plugin-babel": "3.12.1",
"@vue/cli-service": "3.12.1",
"vite": "5.0.7",
"vite-plugin-commonjs": "0.10.0",
"@vitejs/plugin-vue2": "2.3.1",
"vue-template-compiler": "2.7.14"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
Expand Down
5 changes: 0 additions & 5 deletions examples/vue/e-commerce/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ import { formatNumber } from './utils';
import ClearRefinements from './widgets/ClearRefinements.vue';
import NoResults from './widgets/NoResults.vue';

import './Theme.css';
import './App.css';
import './App.mobile.css';
import './widgets/PriceSlider.css';

export default {
components: {
VueSlider,
Expand Down
4 changes: 4 additions & 0 deletions examples/vue/e-commerce/src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Vue from 'vue';
import InstantSearch from 'vue-instantsearch';

import './Theme.css';
import './App.css';
import './App.mobile.css';
import './widgets/PriceSlider.css';
import App from './App.vue';

Vue.use(InstantSearch);
Expand Down
7 changes: 7 additions & 0 deletions examples/vue/e-commerce/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import vue from '@vitejs/plugin-vue2';
import { defineConfig } from 'vite';
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
plugins: [commonjs(), vue()],
});
6 changes: 0 additions & 6 deletions examples/vue/e-commerce/vue.config.js

This file was deleted.

22 changes: 11 additions & 11 deletions examples/vue/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

_This project was generated with [create-instantsearch-app](https://github.com/algolia/instantsearch/tree/master/packages/create-instantsearch-app) by [Algolia](https://algolia.com)._

## Get started
## Project setup

To run this project locally, install the dependencies and run the local server:

```sh
npm install
npm start
```
yarn install
```

Alternatively, you may use [Yarn](https://http://yarnpkg.com/):
### Compiles and hot-reloads for development

```sh
yarn
yarn start
```
yarn run dev
```

Open http://localhost:3000 to see your app.
### Compiles and minifies for production

```
yarn run build
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.png" />
<link rel="icon" href="/favicon.png" />
<!--
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-styles
Expand All @@ -23,6 +23,6 @@
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="module" src="./src/main.js"></script>
</body>
</html>
16 changes: 6 additions & 10 deletions examples/vue/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@
"version": "1.0.20",
"private": true,
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve --port 3000",
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build"
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"algoliasearch": "4.14.3",
"core-js": "2",
"instantsearch.js": "4.62.0",
"vue": "2.7.14",
"vue-instantsearch": "4.13.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "3.12.1",
"@vue/cli-service": "3.12.1",
"vite": "5.0.7",
"vite-plugin-commonjs": "0.10.0",
"@vitejs/plugin-vue2": "2.3.1",
"vue-template-compiler": "2.7.14"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
Expand Down
7 changes: 7 additions & 0 deletions examples/vue/getting-started/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import vue from '@vitejs/plugin-vue2';
import { defineConfig } from 'vite';
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
plugins: [commonjs(), vue()],
});
5 changes: 0 additions & 5 deletions examples/vue/getting-started/vue.config.js

This file was deleted.

8 changes: 1 addition & 7 deletions examples/vue/media/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ yarn install
### Compiles and hot-reloads for development

```
yarn run serve
yarn run dev
```

### Compiles and minifies for production

```
yarn run build
```

### Lints and fixes files

```
yarn run lint
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.1.0/themes/algolia-min.css"
/>
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<title>media</title>
</head>

Expand All @@ -28,6 +28,6 @@
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="module" src="./src/main.js"></script>
</body>
</html>