Download rack/build.mjs from PYTHAI/mindX: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/spaces/PYTHAI/mindX/resolve/main/rack/build.mjs
- Command line
-
hf download hf://spaces/PYTHAI/mindX/rack/build.mjs
-
curl -L -o build.mjs https://huggingface.co/spaces/PYTHAI/mindX/resolve/main/rack/build.mjs
1.72 kB
| // Build the studio rack island → ../studio_rack.js (committed; the Space has no build step). | |
| // The dependencies (dreamknob 1.1.4 from the vendored tgz, React 18, esbuild) are the ones already | |
| // installed for mindx_backend_service/rack — this folder carries no node_modules of its own, because | |
| // push_static_space uploads everything in space_static. | |
| // | |
| // (cd mindx_backend_service/rack && npm install) # once | |
| // node mindx/godel/mindxtrain/hf/space_static/rack/build.mjs | |
| import { createRequire } from 'node:module' | |
| import { fileURLToPath } from 'node:url' | |
| import path from 'node:path' | |
| const here = path.dirname(fileURLToPath(import.meta.url)) | |
| const deps = path.resolve(here, '../../../../../../mindx_backend_service/rack/node_modules') | |
| const require = createRequire(path.join(deps, 'x.js')) | |
| const { build } = require('esbuild') | |
| const result = await build({ | |
| entryPoints: [path.join(here, 'src/studio_rack.jsx')], | |
| bundle: true, | |
| minify: true, | |
| format: 'iife', | |
| target: ['es2019'], | |
| jsx: 'automatic', | |
| nodePaths: [deps], | |
| // pin every import to the rack's own install: a stray ~/node_modules (dreamknob 1.0.0) would otherwise win | |
| alias: { dreamknob: path.join(deps, 'dreamknob'), react: path.join(deps, 'react'), 'react-dom': path.join(deps, 'react-dom') }, | |
| define: { 'process.env.NODE_ENV': '"production"' }, | |
| banner: { js: '/*! mindX studio rack · dreamknob 1.1.4 (MIT, Dreamodus Software Inc.) · React 18 (MIT, Meta) · see rack/DREAMKNOB_LICENSE.txt */' }, | |
| outfile: path.join(here, '../studio_rack.js'), | |
| logLevel: 'info', | |
| metafile: true, | |
| }) | |
| const out = Object.entries(result.metafile.outputs)[0] | |
| console.log(`built ${out[0]} — ${(out[1].bytes / 1024).toFixed(1)} KB`) | |