Spaces:
Sleeping
Sleeping
File size: 3,521 Bytes
1bcce96 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
#!/bin/bash
# This script is used to pull the latest frontend code during the build process
# It is called from the Dockerfile
set -e # Exit on error
if [ -d "frontend/podcraft" ]; then
echo "Frontend code already exists"
else
echo "Frontend code not found, creating dummy placeholder"
mkdir -p frontend/podcraft/public
mkdir -p frontend/podcraft/src
# Create a minimal package.json
cat > frontend/podcraft/package.json << EOF
{
"name": "podcraft",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-router-dom": "^6.15.0",
"reactflow": "^11.8.3"
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.0.0",
"eslint-plugin-react-hooks": "^4.0.0",
"eslint-plugin-react-refresh": "^0.4.0",
"vite": "^4.0.0"
}
}
EOF
# Create a minimal index.html
cat > frontend/podcraft/index.html << EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PodCraft</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
EOF
# Create a minimal vite.config.js
cat > frontend/podcraft/vite.config.js << EOF
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': 'http://localhost:8000',
'/login': 'http://localhost:8000',
'/signup': 'http://localhost:8000',
'/token': 'http://localhost:8000',
'/generate-podcast': 'http://localhost:8000'
}
}
})
EOF
# Create a minimal main.jsx
mkdir -p frontend/podcraft/src
cat > frontend/podcraft/src/main.jsx << EOF
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
EOF
# Create a minimal App.jsx
cat > frontend/podcraft/src/App.jsx << EOF
import React from 'react'
import './App.css'
function App() {
return (
<div className="App">
<header className="App-header">
<h1>PodCraft</h1>
<p>Welcome to PodCraft API. This is the backend server for the PodCraft application.</p>
<p>Please use the API endpoints to interact with the application.</p>
</header>
</div>
)
}
export default App
EOF
# Create minimal CSS files
cat > frontend/podcraft/src/index.css << EOF
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
EOF
cat > frontend/podcraft/src/App.css << EOF
.App {
text-align: center;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
EOF
echo "Created dummy frontend code"
fi
# Make the script executable
chmod +x $0 |