Skip to content

Commit 8001143

Browse files
committed
Move frontend project to Vite
1 parent 6bd82f9 commit 8001143

37 files changed

+1322
-330
lines changed

extra_script.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ def before_build_filesystem(source, target, env):
3737
print('Building react app')
3838
# subprocess.run('npm run build', shell=True, cwd='web').check_returncode()
3939
env.Execute('cd web; npm run build')
40-
copy_matching('web/build', 'static/js', lambda f: 'main' in f and f.endswith('js'))
41-
copy_matching('web/build', 'static/css', lambda f: 'main' in f and f.endswith('css'))
42-
copy_matching('web/public', '', lambda f: f.endswith('.min.css'))
43-
copy_matching('web/build', '', lambda f: f in ['index.html'])
40+
copy_matching('web/build', 'assets', lambda f: 'index' in f and f.endswith('.js'))
41+
copy_matching('web/build', '', lambda f: [ext for ext in ['.html', '.min.css', 'site_logo_mid.png'] if f.endswith(ext)])
4442

4543

4644

web/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/site_logo_mid.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="AstroPowerBox"
11+
/>
12+
<title>AstroPowerBox</title>
13+
</head>
14+
<body>
15+
<noscript>You need to enable JavaScript to run this app.</noscript>
16+
<div id="root"></div>
17+
<script type="module" src="/src/index.jsx"></script>
18+
</body>
19+
</html>

web/package-lock.json

Lines changed: 1267 additions & 252 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
},
2222
"scripts": {
2323
"prepare": "cp node_modules/bootswatch/dist/flatly/bootstrap.min.css public/flatly.min.css && cp node_modules/bootswatch/dist/darkly/bootstrap.min.css public/darkly.min.css",
24-
"start": "react-scripts start",
25-
"build": "react-scripts build",
26-
"test": "react-scripts test",
27-
"eject": "react-scripts eject"
24+
"dev": "vite",
25+
"build": "npm run prepare && vite build",
26+
"preview": "vite preview"
2827
},
2928
"eslintConfig": {
3029
"extends": [
@@ -43,5 +42,9 @@
4342
"last 1 firefox version",
4443
"last 1 safari version"
4544
]
45+
},
46+
"devDependencies": {
47+
"@vitejs/plugin-react": "^4.7.0",
48+
"vite": "^7.0.6"
4649
}
4750
}

web/proxy-server

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

web/public/index.html

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

web/public/site_logo.png

134 KB
Loading

web/public/site_logo.xcf

711 KB
Binary file not shown.

web/public/site_logo_mid.png

61 KB
Loading

web/scripts/dev

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
cd "$(dirname "$0")/.."
3+
ASTROPOWERBOX_HOST="$1"; shift
4+
if [ -z "$ASTROPOWERBOX_HOST" ]; then
5+
echo "Usage: $0 <backend-host>" >&2
6+
exit 1
7+
fi
8+
npm run dev
9+

0 commit comments

Comments
 (0)