Download frontend/scripts/clean-static.mjs from nst1/gemini: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/spaces/nst1/gemini/resolve/main/frontend/scripts/clean-static.mjs
- Command line
-
hf download hf://spaces/nst1/gemini/frontend/scripts/clean-static.mjs
-
curl -L -o clean-static.mjs https://huggingface.co/spaces/nst1/gemini/resolve/main/frontend/scripts/clean-static.mjs
638 Bytes
| import fs from 'node:fs' | |
| import path from 'node:path' | |
| import { fileURLToPath } from 'node:url' | |
| const __filename = fileURLToPath(import.meta.url) | |
| const __dirname = path.dirname(__filename) | |
| const staticDir = path.resolve(__dirname, '../../static') | |
| const assetsDir = path.join(staticDir, 'assets') | |
| const indexFile = path.join(staticDir, 'index.html') | |
| function safeRemove(targetPath) { | |
| if (!fs.existsSync(targetPath)) { | |
| return | |
| } | |
| fs.rmSync(targetPath, { recursive: true, force: true }) | |
| } | |
| safeRemove(assetsDir) | |
| safeRemove(indexFile) | |
| fs.mkdirSync(staticDir, { recursive: true }) | |
| console.log(`[clean-static] cleaned: ${assetsDir}`) | |