Skip to content

Commit

Permalink
chore(examples): migrate react-scripts and vue/cli examples to vite (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dhayab authored Jul 9, 2024
1 parent 148b677 commit 9641523
Show file tree
Hide file tree
Showing 34 changed files with 419 additions and 5,608 deletions.
1 change: 0 additions & 1 deletion examples/react-17/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/react-17/.env.example

This file was deleted.

56 changes: 21 additions & 35 deletions examples/react-17/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,32 @@
# Getting Started with Create React App
# Autocomplete with React 17 example

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This example shows how to integrate Autocomplete with React 17.

## Available Scripts
## Demo

In the project directory, you can run:
[Access the demo](https://codesandbox.io/s/github/algolia/autocomplete/tree/next/examples/react-17)

### `yarn start`
## How to run this example locally

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
### 1. Clone this repository

The page will reload if you make edits.\
You will also see any lint errors in the console.
```sh
git clone git@github.com:algolia/autocomplete.git
```

### `yarn test`
### 2. Install the dependencies and run the server

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
```sh
yarn
yarn workspace @algolia/autocomplete-example-react-17 start
```

### `yarn build`
Alternatively, you may use npm:

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
```sh
cd examples/react-17
npm install
npm start
```

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
Open <http://localhost:3000> to see your app.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />

<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<title>React 17 | Autocomplete</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
39 changes: 19 additions & 20 deletions examples/react-17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
"description": "Autocomplete example with React 17",
"version": "1.17.2",
"private": true,
"scripts": {
"dev": "vite",
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@algolia/autocomplete-core": "1.17.2",
"@algolia/autocomplete-preset-algolia": "1.17.2",
"@algolia/autocomplete-theme-classic": "1.17.2",
"@algolia/client-search": "4.16.0",
"algoliasearch": "4.16.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.3"
"react-dom": "17.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"devDependencies": {
"@algolia/client-search": "4.16.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react": "1.0.7",
"typescript": "^4.4.2",
"vite": "2.8.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"keywords": [
"algolia",
"autocomplete",
"react"
]
}
Empty file.
1 change: 0 additions & 1 deletion examples/react-17/src/react-app-env.d.ts

This file was deleted.

7 changes: 7 additions & 0 deletions examples/react-17/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
4 changes: 2 additions & 2 deletions examples/react-instantsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ git clone git@github.com:algolia/autocomplete.git

```sh
yarn
yarn workspace @algolia/autocomplete-example-react-instantsearch-hooks dev
yarn workspace @algolia/autocomplete-example-react-instantsearch dev
```

Alternatively, you may use npm:

```sh
cd examples/react-instantsearch-hooks
cd examples/react-instantsearch
npm install
npm run dev
```
Expand Down
1 change: 0 additions & 1 deletion examples/react/.env

This file was deleted.

1 change: 0 additions & 1 deletion examples/react/.env.example

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>React | Autocomplete</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
33 changes: 12 additions & 21 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"private": true,
"license": "MIT",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
"dev": "vite",
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@algolia/autocomplete-js": "1.17.2",
Expand All @@ -19,24 +21,13 @@
"@algolia/client-search": "4.16.0",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"react-scripts": "4.0.3",
"typescript": "^4.4.2"
"@vitejs/plugin-react": "1.0.7",
"typescript": "^4.4.2",
"vite": "2.8.0"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"keywords": [
"algolia",
"autocomplete",
"react"
]
}
1 change: 0 additions & 1 deletion examples/react/src/react-app-env.d.ts

This file was deleted.

7 changes: 7 additions & 0 deletions examples/react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
1 change: 0 additions & 1 deletion examples/slack-with-emojis-and-commands/.env.example

This file was deleted.

15 changes: 15 additions & 0 deletions examples/slack-with-emojis-and-commands/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>Slack with emojis and slash commands | Autocomplete</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
30 changes: 11 additions & 19 deletions examples/slack-with-emojis-and-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,31 @@
"private": true,
"license": "MIT",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite",
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@algolia/autocomplete-core": "1.17.2",
"@algolia/autocomplete-preset-algolia": "1.17.2",
"algoliasearch": "4.16.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.3",
"textarea-caret": "3.1.0"
},
"devDependencies": {
"@algolia/client-search": "4.16.0",
"@types/textarea-caret": "3.0.1"
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/textarea-caret": "3.0.1",
"@vitejs/plugin-react": "1.0.7",
"typescript": "^4.4.2",
"vite": "2.8.0"
},
"keywords": [
"algolia",
"autocomplete",
"javascript"
],
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
]
}
Empty file.

This file was deleted.

7 changes: 7 additions & 0 deletions examples/slack-with-emojis-and-commands/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
1 change: 0 additions & 1 deletion examples/twitter-compose-with-typeahead/.env.example

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />

<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<title>Twitter compose box with mentions typeahead | Autocomplete</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading

0 comments on commit 9641523

Please sign in to comment.