Repository navigation
JOPS 1.1.6: build Electron desktop apps with JOPS, no bundler #4
arkwld
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone 👋
JOPS 1.1.6 is out, and it brings Electron. A JOPS SPA can now be the UI of an Electron desktop app, set up with a single command, with no bundler.
🖥️ Electron integration
Electron stays what it is: the main process, native windows, menus, the file system and packaging. JOPS is the renderer: class-based views with an Android-style lifecycle, a Router, a Store and an EventBus, loaded as plain ES modules from
file://.npx jops-core init→ 4. Electron JOPS Desktop App creates an Electron Forge project (main process, preload bridge, JOPS app, Content-Security-Policy), vendors the library and runsnpm install. No need to runcreate-electron-appfirst.<Router jops screens>, light and dark themes, and two sample IPC calls: app info, and a file list read by the main process.window.api.*functions that the preload exposes withcontextBridge, answered byipcMain.handle()in the main process. JOPS adds no IPC layer of its own, so Electron's documented security model stays as it is.npm run makebuilds the app with Electron Forge.jops-coreis a devDependency, so only the vendored library goes intoapp.asar.npx jops-core initin a project made from Electron Forge's default template and choose 1, 2 or 5. It vendors the library, sets up the page (import map, script tag, CSP) and keeps Forge's sample page asindex.forge.html. Forge's vite and webpack templates are not supported, since they bundle the page.We tested it with Electron 45 and Electron Forge 8 on macOS (
npm startand a packaged.app). A Windows build made on the Mac ran on Windows.One rule to know: under
file://, every path JOPS resolves (data-app,src=,layout=,loadLayout()) is written relative to the page, with no leading./or/, e.g.layout/main.html. The README section "Desktop Apps (Electron)" has the full guide: paths, IPC, events from the main process, and the CSP.🧩 Also since the last announcement
jopstag, inside a Router route's layout, nested inside anotherjopstag, or in the layout of a view added withaddSubView()/insertSubView(). Views removed while still loading no longer run their lifecycle. The Router hides routes even when your CSS sets theirdisplay.<Router jops screens>(opt-in) puts each route in its own full-size screen with its own scroll, which fixes transition glitches in app-like layouts. The default Router is unchanged..jops-screen/.jops-router.⬆️ How to upgrade
npm:
In an Electron project,
updaterefreshes the vendored library insrc/lib/.CDN:
@latestserves 1.1.6. The library itself is the same as in 1.1.5 (this release adds the CLI, the template and docs), so pinned@1.1.5URLs need no change.Building desktop tools? Tell us what you'd build with JOPS and Electron in Ideas. Questions go to Q&A, and bugs to Issues.
Previous announcement: JOPS 1.1.2 and WordPress · Full changelog: CHANGELOG.md · Release: v1.1.6
All reactions