Skip to content

T-2UYF-polish-dev-auto-port-selection

Status: closed/obsoleted · Impact: low · Complexity: small

The standalone polish repo auto-selected free dev ports via scripts/dev-port.sh + scripts/tauri-wrapper.mjs, so concurrent dev instances never collided. The monorepo import dropped both; polish dev now uses a fixed port (1432). Restore auto-selection so a busy 1432 or a second instance doesn’t fail to boot.

LocationRole today
apps/legacy-polish/src-tauri/tauri.conf.jsondevUrl fixed at http://localhost:1432; beforeDevCommand: bun run dev
apps/legacy-polish/src-nuxt/nuxt.config.tsdevServer.port = `TAURI_DEV_PORT
apps/legacy-polish/moon.ymldev task runs cargo tauri dev with no port resolution

moon run polish:dev resolves a free base port at startup, exports TAURI_DEV_PORT, and drives Tauri’s devUrl to match — so two instances bind different ports and neither errors on port-in-use. Fixed 1432 stays as the fallback when nothing is running.

  1. Port the original dev-port.sh free-port scan into the monorepo (or a small inline resolver in the moon task).
  2. Wire it into polish:dev: resolve the port, export TAURI_DEV_PORT, and pass cargo tauri dev --config with a matching devUrl (what tauri-wrapper.mjs did).
  3. Keep 1432 as the default when the resolver is unavailable.
LocationKindChange
apps/legacy-polish/moon.ymlmodifydev resolves a free port, exports TAURI_DEV_PORT, injects --config devUrl
apps/legacy-polish/scripts/dev-port.shnewfree-port resolver (ported from the standalone repo)
  • AC-1: two concurrent moon run polish:dev runs bind different ports; neither fails on port-in-use.
  • AC-2: nuxt devServer.port and Tauri devUrl always resolve to the same port.
  • AC-3: with nothing else running, dev still boots on the default port.
  • The rest of tauri-wrapper.mjs (only port-selection is needed).
  • Production/build ports.
  • none (builds on the dev fix in PR #743).
  • The standalone repo’s scripts/tauri-wrapper.mjs + dev-port.sh were “intentionally not imported” (see apps/legacy-polish/MIGRATION.md); the gap surfaced while fixing polish:dev (PR #743).

← Back to Tasks