Skip to content

Align npm scripts and dev ports - #1341

Merged
microbit-matt-hillsdon merged 3 commits into
mainfrom
align-npm-scripts-and-dev-ports
Sep 19, 2026
Merged

microbit-matt-hillsdon merged 3 commits into
mainfrom
align-npm-scripts-and-dev-ports

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

No description provided.

The four web apps had drifted apart on script names, and three of them
served on port 3000, so only one could run at a time. This app keeps 3000
because it matches the CORS configuration; classroom, data and ml-trainer
move to 3001-3003. Preview gets 4000.

strictPort makes a clash fail rather than quietly move to the next free
port. That matters because playwright.config.ts reuses an existing server
on the dev port, so a silent fallback would point one app's e2e run at a
sibling app.

The e2e page objects build absolute URLs from E2E_PORT, whose default only
worked because the dev and CI preview ports were both 3000. Splitting them
breaks that, so playwright.config.ts now derives both its webServer and
E2E_PORT from a single constant.

Scripts: dev replaces start, preview replaces the hand-rolled serve, format
and format:check are new, invalidate uses the shared
invalidate-cloudfront-distribution rather than a raw aws call, and prepare
becomes postinstall. ci runs typecheck, lint, test, i18n:tidy then build,
matching the ui repo.

Drop the npx serve and curl steps from the build workflow. They predate the
move to Playwright, which starts its own server inside the test container,
so nothing was reaching them.

Exclude the generated typeshed JSON that the stubs script copies out of
node_modules from prettier, mirroring how ml-trainer excludes its generated
messages. That leaves one real formatting fix in chunk-util.ts.
The README said the app had to be running already. That dates from 2021 and
predates the move to Playwright, whose webServer starts the dev server and
reuses one already on the port.

Also describe test:e2e as the Playwright UI rather than a watch mode, mention
test:e2e:headless, and note that the browsers are a separate download.
@github-actions

Copy link
Copy Markdown

- run: npm run ci
env:
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- run: mkdir -p /tmp/app${BASE_URL} && cp -r build/* /tmp/app${BASE_URL} && npx serve --no-clipboard -l 3000 /tmp/app &

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more than a little amusing that we've not been using this for some time.

The upload step pointed at reports/, but Playwright writes
playwright-report/, so it never captured anything.

The e2e step also had no timeout of its own, so a slow run took the
whole job past its limit and the run was cancelled rather than failed,
which skipped the upload too. Bound the step and leave the job room
for the deploy that follows it.
@microbit-matt-hillsdon
microbit-matt-hillsdon merged commit a9eb7bf into main Sep 19, 2026
1 check passed
@microbit-matt-hillsdon
microbit-matt-hillsdon deleted the align-npm-scripts-and-dev-ports branch September 19, 2026 12:13
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.

1 participant