Skip to content

build: migrate simulator to browser Vite SPA - #151

Open
prashant2007-wq wants to merge 1 commit into
Newton-School:masterfrom
prashant2007-wq:feat/browser-vite-spa-migration
Open

build: migrate simulator to browser Vite SPA#151
prashant2007-wq wants to merge 1 commit into
Newton-School:masterfrom
prashant2007-wq:feat/browser-vite-spa-migration

Conversation

@prashant2007-wq

Copy link
Copy Markdown

Summary

Closes #150.

Migrates ns-simulator from an Electron app shell to a browser-hosted Vite SPA.

Changes

  • Replaced electron.vite.config.ts with a standard vite.config.ts.
  • Configured Vite to use src/renderer as the browser app root.
  • Updated npm scripts to use vite, vite build, and vite preview.
  • Removed Electron packaging/start scripts and dependencies.
  • Replaced Electron IPC file save/load with browser-native file APIs.
  • Added File System Access API support for Chromium.
  • Added fallback open flow using hidden file input.
  • Added fallback save flow using Blob download.
  • Replaced Electron discard confirmation with browser confirmation.
  • Replaced Electron close interception with beforeunload.
  • Removed src/main, src/preload, IPC handlers, Electron builder config, and app update config.
  • Updated TypeScript config for browser-first build.
  • Kept the CLI entrypoint available through npm run simulate.

Testing

Ran:

npm run typecheck
npm run test
npm run build
npm run lint

Manual browser verification:

  • Opened app through Vite dev server.
  • Confirmed .json scenario opening works.
  • Confirmed .json scenario saving works.
  • Confirmed Cmd/Ctrl+O opens file picker.
  • Confirmed Cmd/Ctrl+S saves the current scenario.
  • Confirmed opening a file with unsaved changes asks for confirmation.
  • Confirmed reloading/closing the tab with unsaved changes triggers the browser leave prompt.
  • Confirmed production build outputs static assets into dist/.

Notes

Safari and Firefox do not support Chromium’s File System Access API, so they use the fallback download/input flows and may re-prompt during save, as expected in the issue scope.

Made with Cursor

Closes Newton-School#150.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate ns-simulator from Electron to a browser-hosted Vite SPA

1 participant