Download scripts/build.mjs from webml-community/MiniCPM5-2B-WebGPU-Pi: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/webml-community/MiniCPM5-2B-WebGPU-Pi/resolve/main/scripts/build.mjs
- Command line
-
hf download hf://spaces/webml-community/MiniCPM5-2B-WebGPU-Pi/scripts/build.mjs
-
curl -L -o build.mjs https://huggingface.co/spaces/webml-community/MiniCPM5-2B-WebGPU-Pi/resolve/main/scripts/build.mjs
1.28 kB
| import { cp, mkdir, readFile, rm, stat } from 'node:fs/promises'; | |
| import { fileURLToPath } from 'node:url'; | |
| import path from 'node:path'; | |
| const root = fileURLToPath(new URL('../', import.meta.url)); | |
| const output = path.join(root, 'dist'); | |
| const directories = ['assets', 'src', 'runtime', 'vendor', 'file-icons', 'library-icons', 'licenses']; | |
| const files = ['index.html', 'favicon.svg', 'empty-cat-v1.png', 'modal-cat-v1.png', | |
| 'openbmb-avatar.webp', 'cat-meow-v1.mp3', 'social-thumbnail-v3.png', 'LICENSE', 'NOTICE']; | |
| // Catch missing LFS downloads before packaging what would look like broken images. | |
| for (const name of ['empty-cat-v1.png', 'modal-cat-v1.png', 'social-thumbnail-v3.png']) { | |
| const file = await readFile(path.join(root, name)); | |
| if (file.subarray(0, 42).toString().startsWith('version https://git-lfs.github.com/spec/')) { | |
| throw new Error(`${name} is a Git LFS pointer. Run git lfs pull before building.`); | |
| } | |
| } | |
| await rm(output, { recursive: true, force: true }); | |
| await mkdir(output); | |
| for (const item of [...directories, ...files]) { | |
| await stat(path.join(root, item)); | |
| await cp(path.join(root, item), path.join(output, item), { recursive: true }); | |
| } | |
| console.log('Built dist/ — static files ready for localhost or a Hugging Face static Space.'); | |