Packaging apps
A ScriptWeaver app is just JavaScript. To ship it, bundle the entry script and
any assets into a single .zip — the Player runs it directly:
scriptweaver myapp.zip
A single .js file works too (for a one-file app); the .zip form is for
anything with more than one file.
Bundle layout
The Player looks for main.js at the root of the zip and runs it. Put your
modules and assets alongside it:
myapp.zip
├── main.js ← entry point (runs first)
├── greet.js ← import { … } from './greet.js'
├── logo.png ← an asset
└── help/ ← optional: your app's F1 manual
└── index.md
Relative imports between bundled modules work as usual. Create the zip with any
tool:
zip -r myapp.zip main.js greet.js logo.png help/
Bundling a manual (F1)
Add a help/ folder with an index.md and the Player opens it when the
user presses F1 — your app ships with its own browsable manual, rendered by
the same Markdown viewer as these docs. Use relative links and images between
help pages; they resolve inside the folder. docs/ works too, but help/ wins
when both are present (keep developer docs in docs/, the user manual in
help/). Preview it without running the app via scriptweaver --help myapp.zip.
See System & files → Help for the details.
Reading bundled assets
Files inside the zip are mounted in a virtual filesystem at //zipfs:/app.
Images and themes accept a //zipfs: path directly, so bundled images just
work:
const logo = new Photo({ file: '//zipfs:/app/logo.png' });
app.TLabel({ image: logo }).pack.configure();
sw.fs does not read the virtual filesystem — it's for real files only.
To read a bundled text/data file today, read it through the VFS:
const data = __native_tcl_eval(`
set fp [open //zipfs:/app/data.json r]
set s [read $fp]
close $fp
set s
`);
const config = JSON.parse(data);
This last step is lower-level than the rest of the API on purpose — a friendlier resource reader is planned. Bundled images and themes, though, need nothing special beyond the
//zipfs:/app/…path.
Distributing
Your users need the Player plus your .zip. Two common options:
- Install the Player once, then share the
.zip. The Player is free to redistribute (MPL-2.0), so you can host it yourself. - Ship them together — the Player binary and your
.zipin one download.
Either way there's no installer and no separate runtime to set up — the Player is a single self-contained binary.