Skip to content

feat(win): add a portable build - #140

Open
AmerDwight wants to merge 1 commit into
darrenprx:mainfrom
AmerDwight:feat/portable-build
Open

AmerDwight wants to merge 1 commit into
darrenprx:mainfrom
AmerDwight:feat/portable-build

Conversation

@AmerDwight

Copy link
Copy Markdown

What and why

A portable Windows build, lolPing-<version>-portable.exe, next to the installer: run it from any folder or a USB drive, with settings, emotes and caches in a data folder beside the .exe and nothing in %APPDATA% or the registry. An unpacked copy (win-unpacked) is portable too when a portable.txt sits next to lolPing.exe.

How it works (src/main/portable.ts, paths.ts, index.ts):

  • electron-builder's portable target sets PORTABLE_EXECUTABLE_DIR; that, or the marker file, decides the data folder once at startup. A development build is never portable.
  • userData and sessionData are moved there before the single-instance lock, so the MCP pipe and token follow, an installed and a portable copy run side by side, and two copies of one portable folder don't.
  • No updater in a portable build (electron-updater would install the downloaded setup over it) and no launch-at-startup (the path moves with the folder, nothing uninstalls the Run entry). The settings page hides that switch via a new AppStatus.portable, and About lists it under known limitations.

One thing for you to decide: .github/workflows/release.yml gains one line to upload the portable .exe. AGENTS.md says that file is yours, so drop it if you'd rather not ship the portable build from releases; the target still builds locally with npm run dist. The portable .exe is not in latest.yml, so installed copies are unaffected.

No new network host.

How I tested it

  • npm run typecheck and npm test (tests/main/portable.test.ts covers the launcher variable, the marker file, the installed case and the development exclusion).
  • Built on a GitHub windows-latest runner: npm run test:helper and npm run dist produce both lolPing-Setup-0.6.0.exe and lolPing-0.6.0-portable.exe.
  • Not yet run by hand on a real Windows desktop (will tick below once done).

Ran by hand on:

  • Windows 11
  • macOS (Apple Silicon) — not affected: IS_PORTABLE is false there unless a portable.txt is placed next to the binary

Checklist

  • npm run typecheck, npm run test:helper and npm test pass
  • New logic has tests; a bug fix has a test that fails without it, or I explained why it can't
  • User-facing text is in both English and Chinese (src/shared/i18n.ts, both READMEs)
  • docs/design.md is updated if the behaviour it describes changed
  • Screenshot attached if something visible changed
  • If I used an AI tool, it had AGENTS.md in context and I read the whole diff. Tool: Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_0135UvqhMz4dTkZUm42VbK44

A second Windows target, electron-builder's `portable`, makes
lolPing-<version>-portable.exe: no installer, nothing in the registry.
An unpacked copy becomes portable with a portable.txt next to its
executable, so a zipped win-unpacked folder works too.

A portable build keeps its settings, emotes, caches and Electron's
userData (MCP pipe and token, session data) in a data folder next to
the executable. userData is moved before the single-instance lock, so
an installed and a portable copy run side by side and two copies of one
portable folder don't.

It has no self-update (electron-updater would install the downloaded
setup over it) and no launch-at-startup entry (the path moves with the
folder and nothing uninstalls the entry). The settings page hides that
switch and the About section says so, in both languages.

The release workflow uploads the portable .exe next to the installer.
It is not in latest.yml, so installed copies are unaffected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0135UvqhMz4dTkZUm42VbK44
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.

2 participants