Desktop App Builder — Skill Reference
CRITICAL: Sandbox Awareness
You are running in a cloud sandbox. You CANNOT:
- Access npm registry (you will get 502 errors)
- Download Electron or any packages
- Run
npm install,npm ci,yarn install,curl, orwget
DO NOT attempt to install or download anything. It WILL fail.
How It Works
The user has a pre-built Electron template on their LOCAL Mac at:
~/.wix-desktop-app-template/
It contains node_modules with the full Electron binary. Your job is to:
- Generate a
.commandscript (self-contained bash file) - The script runs on the USER'S Mac (not in the sandbox)
- It copies the template, writes
index.html+ updatesmain.js, and builds the .dmg
Template File Structure
~/.wix-desktop-app-template/
├── main.js — Loads index.html via path.join(__dirname, 'index.html'), has SITE_ID_PLACEHOLDER
├── preload.js — IPC bridge: window.wixApi()
├── index.html — Placeholder, replaced with generated UI
├── package.json — files: ["main.js", "preload.js", "index.html"], productName: "WixManager"
└── node_modules/ — Full Electron + electron-builder (pre-installed)
What the .command Script Must Do
- Copy template:
cp -a ~/.wix-desktop-app-template "$BUILD_DIR"(use-aNOT-r— preserves symlinks!) - Verify node_modules exists
- Replace
SITE_ID_PLACEHOLDERinmain.jswith real site ID viased - Write the full generated HTML as
$BUILD_DIR/index.html(heredoc) - Update
productNameinpackage.jsonviased - Build:
cd "$BUILD_DIR" && npx electron-builder --mac dmg - Open output folder in Finder
Critical Rules
- NEVER embed HTML in main.js — write it as
index.html - NEVER use
loadURL('data:text/html...')— useloadFile(path.join(__dirname, 'index.html')) - ALWAYS use
cp -anotcp -r(preserves symlinks in node_modules/.bin) - NEVER modify main.js beyond the
sedreplacement ofSITE_ID_PLACEHOLDER - NEVER run npm install or any download command
BANNED COMMANDS (in the sandbox)
npm install/npm ci/yarn install/pnpm installnpm initcurlorwgetto download packages- Any command that installs or downloads dependencies
- Building a web app / HTML file as a fallback
Output Naming
Name the .command file after its function:
WixPriceEditor-builder.commandWixOrderManager-builder.commandWixInventoryManager-builder.commandWixFulfillmentManager-builder.commandWixProductEditor-builder.command
Size Constraint
Keep the final binary under 120MB. Do not bundle unnecessary Electron modules.