Download scripts/prepare-space.mjs from ebubar/teleop: direct link, hf CLI and curl.
- Browser
- Download file 851 Bytes
-
https://huggingface.co/spaces/ebubar/teleop/resolve/main/scripts/prepare-space.mjs
- Command line
-
hf download hf://spaces/ebubar/teleop/scripts/prepare-space.mjs
-
curl -L -o prepare-space.mjs https://huggingface.co/spaces/ebubar/teleop/resolve/main/scripts/prepare-space.mjs
851 Bytes
| // Ship verified local output as plain static files: no paid HF build step. | |
| import { cpSync, existsSync, mkdirSync, readdirSync, rmSync } from 'node:fs'; | |
| import { resolve, dirname, sep } from 'node:path'; | |
| import { fileURLToPath } from 'node:url'; | |
| const root = resolve(dirname(fileURLToPath(import.meta.url)), '..'); | |
| const output = resolve(root, 'site'); | |
| if (output !== resolve(root, 'site') || !output.startsWith(root + sep)) throw new Error('Unexpected output path'); | |
| if (!existsSync(resolve(root, 'dist/index.html'))) throw new Error('Build dist/index.html first'); | |
| mkdirSync(output, {recursive: true}); | |
| for (const entry of readdirSync(output)) rmSync(resolve(output, entry), {recursive: true, force: true}); | |
| cpSync(resolve(root, 'dist'), output, {recursive: true}); | |
| console.log('Prepared site/ for static publication. Commit it with the source.'); | |