Skip to content

Commit d6076ab

Browse files
arbrandesclaude
andcommitted
docs: add bin-linking workaround to migration guide
npm skips bin-linking for workspace packages during install, so the openedx CLI from frontend-base isn't available in node_modules/.bin. Document the workaround. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 51a1fdf commit d6076ab

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

docs/how_tos/migrate-frontend-app.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ Then add the following scripts to ``package.json``:
10421042
```json
10431043
"build:packages": "make build-packages",
10441044
"clean:packages": "make clean-packages",
1045-
"dev:site": "npm run dev",
1045+
"dev:site": "make dev-site",
10461046
"dev:packages": "make dev-packages",
10471047
"watch:build": "nodemon --exec 'npm run build'",
10481048
```
@@ -1060,21 +1060,29 @@ TURBO = TURBO_TELEMETRY_DISABLED=1 turbo --dangerously-disable-package-manager-c
10601060
turbo.json: turbo.site.json
10611061
cp $< $@
10621062

1063+
# NPM doesn't bin-link workspace packages during install, so it must be done manually.
1064+
bin-link:
1065+
[ -f packages/frontend-base/package.json ] && npm rebuild --ignore-scripts @openedx/frontend-base || true
1066+
10631067
build-packages: turbo.json
10641068
$(TURBO) run build; rm -f turbo.json
1069+
$(MAKE) bin-link
10651070

10661071
clean-packages: turbo.json
10671072
$(TURBO) run clean; rm -f turbo.json
10681073

1069-
dev-packages: turbo.json
1074+
dev-packages: build-packages turbo.json
10701075
$(TURBO) run watch:build dev:site; rm -f turbo.json
1076+
1077+
dev-site: bin-link
1078+
npm run dev
10711079
```
10721080

10731081
- ``watch:build`` uses ``nodemon`` to watch for source changes (as configured in ``nodemon.json``) and re-runs ``npm run build`` on each change. Turbo runs this in each workspace package that defines it.
1074-
- ``build:packages`` builds all workspace packages in dependency order (e.g., ``frontend-base`` before the app).
1082+
- ``build:packages`` builds all workspace packages in dependency order (e.g., ``frontend-base`` before the app), then runs ``make bin-link`` to create missing bin links. This is necessary because npm skips bin-linking for workspace packages during install, so without this step the ``openedx`` CLI won't be available in ``node_modules/.bin``.
10751083
- ``clean:packages`` runs the ``clean`` script in each workspace package.
1076-
- ``dev:site`` is an alias for ``npm run dev`` that turbo uses as a root-only task (``//#dev:site``).
1077-
- ``dev:packages`` builds dependencies, then concurrently watches workspace packages for changes and starts the dev server.
1084+
- ``dev:site`` is an alias for ``npm run dev`` that also bin-links the frontend-base bin files; turbo uses it as a root-only task (``//#dev:site``).
1085+
- ``dev:packages`` depends on ``build-packages`` so the CLI is available before starting the watch, then concurrently watches workspace packages for changes and starts the dev server.
10781086

10791087
The Makefile targets copy ``turbo.site.json`` to ``turbo.json`` before invoking turbo, then remove the copy afterward. This ensures turbo finds its expected config when running standalone, without leaving a ``turbo.json`` that would conflict in a workspace context. The ``--dangerously-disable-package-manager-check`` flag and ``TURBO_TELEMETRY_DISABLED=1`` are also set here, keeping turbo invocation details in one place.
10801088

0 commit comments

Comments
 (0)