Skip to content

Build workspace packages in the authoring image so validate-lab resolves them - #3

Open
ajeetraina wants to merge 1 commit into
dockersamples:mainfrom
ajeetraina:fix/authoring-build-packages
Open

Build workspace packages in the authoring image so validate-lab resolves them#3
ajeetraina wants to merge 1 commit into
dockersamples:mainfrom
ajeetraina:fix/authoring-build-packages

Conversation

@ajeetraina

Copy link
Copy Markdown
Member

Problem

npm run validate-lab in dockersamples/simspace-authoring:latest (built 2026-08-14) crashes before it reads any lab:

scripts/validate-lab.ts:35:7: ERROR: Could not resolve "@dockersamples/simspace-simulator"

This breaks the Validate labs step of the reusable deploy-lab.yml for every downstream lab repo, so their GitHub Pages deploys can no longer publish. latest is the only published authoring tag, so there's no consumer-side workaround. (Reported in #2.)

Root cause

The Aug 14 "Publish compiled packages instead of source" change pointed the workspace packages' exports at compiled ./dist/*:

// app/packages/simulator/package.json
"exports": { ".": { "default": "./dist/index.js" } }   // dist/ is gitignored; built by `npm run build:packages`
  • Vite still worksapp/vite.config.js aliases the packages to their source (resolve: { alias: workspaceSource }).
  • validate-lab breaks — it runs through scripts/run-ts.mjs, a standalone esbuild with no such alias. It resolves the real exports./dist/index.js, which doesn't exist because the authoring stage never builds the packages.

Fix

Run npm run build:packages after the source copy in the authoring stage of the Dockerfile, so dist/ exists before anything consumes the published exports.

Verification

docker build --target authoring -t simspace-authoring:fix .
docker run --rm -v "$PWD/lab:/lab:ro" simspace-authoring:fix npm run validate-lab -- /lab
  • Current latest: ERROR: Could not resolve "@dockersamples/simspace-simulator"
  • With this PR: 0 error(s), 0 warning(s) across 2 lab(s)

(Verified against a real downstream lab; the same lab validates clean pre-Aug-14 and fails on current latest, so this is purely the image, not lab content.)

Note

Once merged, dockersamples/simspace-authoring:latest needs to be rebuilt and republished — the fix only reaches downstream repos when the image is pushed.

🤖 Generated with Claude Code

…ves them

The Aug 14 "Publish compiled packages instead of source" change pointed the
workspace packages' `exports` at compiled `./dist/*` (gitignored, produced by
`npm run build:packages`). Vite still works because vite.config.js aliases the
packages to their source, but `npm run validate-lab` runs through a standalone
esbuild (scripts/run-ts.mjs) with no such alias — so it resolves the real
`exports` entry and needs `dist/` to exist.

The authoring stage never builds the packages, so `dist/` is absent and the
published `dockersamples/simspace-authoring:latest` fails with:

  scripts/validate-lab.ts:35:7: ERROR: Could not resolve
  "@dockersamples/simspace-simulator"

This breaks the `Validate labs` step of the reusable deploy-lab.yml for every
downstream lab repo, so GitHub Pages deploys can't publish.

Fix: run `npm run build:packages` after the source copy in the authoring stage.

Verified: `docker build --target authoring` then
`docker run ... npm run validate-lab -- /lab` now reports
`0 error(s), 0 warning(s)` on a lab that fails against the current latest image.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.

1 participant