Skip to content

Commit d360855

Browse files
authored
fix: use vite instead of parcel in the examples (#2329)
Parcel would delete some random file like identity because it though it was not used, vite is smarter. Also remove unused imports
1 parent 93578a4 commit d360855

27 files changed

+2641
-5118
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Some examples of valid commit messages (used as first lines):
5959

6060
To run this project, you will need:
6161

62-
- Node.js ≥ 16[nvm](https://github.com/creationix/nvm#install-script) is recommended
62+
- Node.js ≥ 18[nvm](https://github.com/nvm-sh/nvm#install-script) is recommended
6363
- [Yarn](https://yarnpkg.com)
6464

6565
## Release

examples/demo/index.html

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
63

7-
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
4+
<head>
5+
<meta charset="UTF-8" />
6+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>DocSearch v3 - React</title>
9+
</head>
810

9-
<title>DocSearch v3 - React</title>
10-
</head>
11+
<body>
12+
<div id="root"></div>
13+
<script type="module" src="/src/main.tsx"></script>
14+
</body>
1115

12-
<body>
13-
<noscript>You need to enable JavaScript to run this app.</noscript>
14-
<div id="root"></div>
15-
16-
<script type="module" src="src/index.js"></script>
17-
</body>
1816
</html>

examples/demo/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
"version": "3.6.2",
55
"private": true,
66
"license": "MIT",
7+
"type": "module",
78
"scripts": {
8-
"build": "parcel build index.html",
9-
"start": "parcel index.html"
9+
"dev": "vite",
10+
"build": "tsc -b && vite build",
11+
"preview": "vite preview"
1012
},
1113
"dependencies": {
1214
"@docsearch/css": "3.6.2",
13-
"@docsearch/react": "3.6.2",
14-
"react": "^18.1.0",
15-
"react-dom": "^18.1.0"
15+
"@docsearch/react": "3.6.2"
1616
},
1717
"devDependencies": {
18-
"parcel": "2.7.0"
18+
"@vitejs/plugin-react": "^4.3.3",
19+
"vite": "^5.4.10"
1920
}
2021
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React from 'react';
21
import { DocSearch } from '@docsearch/react';
32

4-
import './app.css';
5-
import '@docsearch/css';
3+
import './App.css';
4+
import '@docsearch/css/dist/style.css';
65

76
function App() {
87
return (
@@ -12,7 +11,7 @@ function App() {
1211
indexName="vuejs"
1312
appId="ML0LEBN7FQ"
1413
apiKey="21cf9df0734770a2448a9da64a700c22"
15-
insights
14+
insights={true}
1615
/>
1716
</div>
1817
);

examples/demo/src/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/demo/src/main.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { StrictMode } from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
4+
import App from './App.js';
5+
6+
createRoot(document.getElementById('root')!).render(
7+
<StrictMode>
8+
<App />
9+
</StrictMode>
10+
);

examples/demo/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

examples/demo/tsconfig.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4+
"target": "ES2020",
5+
"useDefineForClassFields": true,
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"module": "ESNext",
8+
"skipLibCheck": true,
9+
10+
/* Bundler mode */
11+
"moduleResolution": "Bundler",
12+
"allowImportingTsExtensions": true,
13+
"isolatedModules": true,
14+
"moduleDetection": "force",
15+
"noEmit": true,
16+
"jsx": "react-jsx",
17+
18+
/* Linting */
19+
"strict": true,
20+
"noUnusedLocals": true,
21+
"noUnusedParameters": true,
22+
"noFallthroughCasesInSwitch": true,
23+
"noUncheckedSideEffectImports": true
24+
},
25+
"include": ["src"]
26+
}

0 commit comments

Comments
 (0)