Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 61bf4a9

Browse files
committedApr 12, 2025·
Replace CRA with Vite
1 parent 62d7223 commit 61bf4a9

14 files changed

+3625
-19219
lines changed
 

‎.github/workflows/deploy_demo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Upload artifact
4343
uses: actions/upload-pages-artifact@v3
4444
with:
45-
path: ./search_interface/build
45+
path: ./search_interface/dist
4646

4747
- name: Deploy to github pages
4848
id: deployment

‎search_interface/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/coverage
1010

1111
# production
12-
/build
12+
/dist
1313

1414
# misc
1515
.DS_Store
File renamed without changes.

‎search_interface/public/index.html renamed to ‎search_interface/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
5+
<link rel="icon" href="favicon.png" />
6+
<script type="module" src="src/index.jsx"></script>
67
<meta name="viewport" content="width=device-width, initial-scale=1" />
78
<meta name="theme-color" content="#000000" />
89
<title>Boost.Gecko</title>

‎search_interface/package-lock.json

+3,535-19,169
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎search_interface/package.json

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
2-
"name": "search-interface",
3-
"version": "0.1.0",
4-
"private": true,
2+
"name": "boost-gecko",
3+
"title": "Boost.Gecko",
4+
"description": "A search interface for Boost.Gecko project",
5+
"version": "0.1.2",
6+
"license": "BSL-1.0",
7+
"author": "Mohammad Nejati",
8+
"homepage": "https://github.com/cppalliance/boost-gecko",
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/cppalliance/boost-gecko.git"
12+
},
13+
"files": [
14+
"dist/*",
15+
"src/*"
16+
],
517
"dependencies": {
618
"@emotion/react": "^11.13.5",
719
"@emotion/styled": "^11.13.5",
@@ -16,17 +28,15 @@
1628
"react": "^18.3.1",
1729
"react-dom": "^18.3.1",
1830
"react-instantsearch": "^7.13.8",
19-
"react-scripts": "^5.0.1",
2031
"recent-searches": "^1.0.5",
2132
"url-join": "^5.0.0",
2233
"web-vitals": "^2.1.4"
2334
},
2435
"scripts": {
25-
"start": "react-scripts start",
26-
"build": "react-scripts build",
27-
"test": "react-scripts test",
28-
"eject": "react-scripts eject",
29-
"format": "prettier --write ./src"
36+
"format": "prettier --write ./src",
37+
"start": "vite",
38+
"build": "vite build",
39+
"preview": "vite preview"
3040
},
3141
"eslintConfig": {
3242
"extends": [
@@ -56,7 +66,9 @@
5666
"devDependencies": {
5767
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
5868
"@svgr/cli": "^8.1.0",
59-
"prettier": "^2.8.8"
69+
"@vitejs/plugin-react": "^4.3.4",
70+
"prettier": "^2.8.8",
71+
"vite": "^6.2.6"
6072
},
6173
"overrides": {
6274
"nth-check": "$nth-check"

‎search_interface/src/Demo.js renamed to ‎search_interface/src/Demo.jsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,21 @@ function Demo() {
3838
<FormControl fullWidth>
3939
<InputLabel>Theme</InputLabel>
4040
<Select size='small' value={themeMode} onChange={handleModeChange} label='Theme' sx={{ height: 36 }}>
41-
<MenuItem value='light'>
42-
Light
43-
</MenuItem>
44-
<MenuItem value='dark'>
45-
Dark
46-
</MenuItem>
41+
<MenuItem value='light'>Light</MenuItem>
42+
<MenuItem value='dark'>Dark</MenuItem>
4743
</Select>
4844
</FormControl>
4945
</Grid>
5046
<Grid item md={8} xs={5}>
5147
<FormControl fullWidth>
5248
<InputLabel>Library</InputLabel>
53-
<Select size='small' value={library ? library.key : 'none'} onChange={handleLibraryChange} label='Library' sx={{ height: 36 }}>
49+
<Select
50+
size='small'
51+
value={library ? library.key : 'none'}
52+
onChange={handleLibraryChange}
53+
label='Library'
54+
sx={{ height: 36 }}
55+
>
5456
<MenuItem value='none'>
5557
<em>None</em>
5658
</MenuItem>

‎search_interface/src/Search/SearchBox.js renamed to ‎search_interface/src/Search/SearchBox.jsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,17 @@ function SearchBox({ inputRef, recentSearches }) {
4343
{...params}
4444
sx={{
4545
'& input:focus': {
46-
boxShadow: 'none'
47-
}
46+
boxShadow: 'none',
47+
},
4848
}}
4949
placeholder='Search...'
5050
inputRef={inputRef}
5151
InputProps={{
5252
...params.InputProps,
53-
style: { fontSize: "1.2rem" },
53+
style: { fontSize: '1.2rem' },
5454
endAdornment: (
5555
<React.Fragment>
56-
{status === 'loading' || status === 'stalled' ? (
57-
<CircularProgress size={16} />
58-
) : null}
56+
{status === 'loading' || status === 'stalled' ? <CircularProgress size={16} /> : null}
5957
{params.InputProps.endAdornment}
6058
</React.Fragment>
6159
),

‎search_interface/src/Search/SearchDialog.js renamed to ‎search_interface/src/Search/SearchDialog.jsx

+34-21
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function SearchDialog({
3636
librariesAlgoliaIndex,
3737
learnAlgoliaIndex,
3838
alogliaAppId,
39-
alogliaApiKey
39+
alogliaApiKey,
4040
}) {
4141
const [searchClient] = React.useState(() => {
4242
const algoliaClient = algoliasearch(alogliaAppId, alogliaApiKey);
@@ -61,7 +61,7 @@ function SearchDialog({
6161
}
6262

6363
return algoliaClient.search(requests);
64-
}
64+
},
6565
};
6666
});
6767

@@ -91,23 +91,26 @@ function SearchDialog({
9191

9292
const handleDialogClose = React.useCallback(() => window.history.back(), []);
9393

94-
const theme = React.useMemo(() => createTheme({
95-
palette: {
96-
mode: themeMode,
97-
primary: {
98-
main: (themeMode === 'dark' ? '#7DD3FC' : '#0284C7'),
99-
},
100-
...(themeMode === 'dark' &&
101-
{
102-
background: {
103-
paper: '#172A34',
104-
}
105-
})
106-
},
107-
typography: {
108-
allVariants: { ...fontFamily && { fontFamily } }
109-
},
110-
}), [themeMode, fontFamily]);
94+
const theme = React.useMemo(
95+
() =>
96+
createTheme({
97+
palette: {
98+
mode: themeMode,
99+
primary: {
100+
main: themeMode === 'dark' ? '#7DD3FC' : '#0284C7',
101+
},
102+
...(themeMode === 'dark' && {
103+
background: {
104+
paper: '#172A34',
105+
},
106+
}),
107+
},
108+
typography: {
109+
allVariants: { ...(fontFamily && { fontFamily }) },
110+
},
111+
}),
112+
[themeMode, fontFamily],
113+
);
111114

112115
const dialogShouldBeFullScreen = useMediaQuery(theme.breakpoints.down('sm'));
113116

@@ -245,7 +248,12 @@ function SearchDialog({
245248
<Box hidden={selectedTab !== '1'} sx={{ pt: 1, typography: 'body1' }}>
246249
<Index indexName={librariesAlgoliaIndex}>
247250
<Configure hitsPerPage={30} />
248-
<InfiniteHits urlPrefix={librariesUrlPrefix} setnbHits={setnbHits1} onClick={setRecentSearch} showLibName />
251+
<InfiniteHits
252+
urlPrefix={librariesUrlPrefix}
253+
setnbHits={setnbHits1}
254+
onClick={setRecentSearch}
255+
showLibName
256+
/>
249257
</Index>
250258
</Box>
251259
<Box hidden={selectedTab !== '2'} sx={{ pt: 1, typography: 'body1' }}>
@@ -266,7 +274,12 @@ function SearchDialog({
266274
<Box hidden={selectedTab !== '2'} sx={{ pt: 1, typography: 'body1' }}>
267275
<Index indexName={librariesAlgoliaIndex}>
268276
<Configure hitsPerPage={30} filters={'NOT library_key:' + library.key} />
269-
<InfiniteHits urlPrefix={librariesUrlPrefix} setnbHits={setnbHits2} onClick={setRecentSearch} showLibName />
277+
<InfiniteHits
278+
urlPrefix={librariesUrlPrefix}
279+
setnbHits={setnbHits2}
280+
onClick={setRecentSearch}
281+
showLibName
282+
/>
270283
</Index>
271284
</Box>
272285
</>

‎search_interface/src/index.js renamed to ‎search_interface/src/index.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ function parseURL() {
6060

6161
const librariesPathPrefix = '/doc/libs/';
6262
if (!path.startsWith(librariesPathPrefix)) {
63-
const learnPathPrefixes = ['/docs/', '/doc/user-guide/', '/doc/formal-reviews/', '/doc/contributor-guide/']
64-
if (learnPathPrefixes.some(str => path.startsWith(str)))
65-
onLearnPages = true
63+
const learnPathPrefixes = ['/docs/', '/doc/user-guide/', '/doc/formal-reviews/', '/doc/contributor-guide/'];
64+
if (learnPathPrefixes.some((str) => path.startsWith(str))) onLearnPages = true;
6665
return { onLearnPages, boostVersion, library };
6766
}
6867
path = path.replace(librariesPathPrefix, '');

‎search_interface/vite.config.mjs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
4+
export default defineConfig({
5+
plugins: [react()],
6+
build: {
7+
chunkSizeWarningLimit: 1000,
8+
rollupOptions: {
9+
output: {
10+
entryFileNames: 'boost-gecko.min.js',
11+
assetFileNames: '[name].[ext]'
12+
}
13+
}
14+
}
15+
});

0 commit comments

Comments
 (0)
Please sign in to comment.