Skip to content

Commit 6e0f0fe

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 22368c6 commit 6e0f0fe

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
@@ -1036,7 +1036,7 @@ Then add the following scripts to ``package.json``:
10361036
```json
10371037
"build:packages": "make build-packages",
10381038
"clean:packages": "make clean-packages",
1039-
"dev:site": "npm run dev",
1039+
"dev:site": "make dev-site",
10401040
"dev:packages": "make dev-packages",
10411041
"watch:build": "nodemon --exec 'npm run build'",
10421042
```
@@ -1054,21 +1054,29 @@ TURBO = TURBO_TELEMETRY_DISABLED=1 turbo --dangerously-disable-package-manager-c
10541054
turbo.json: turbo.site.json
10551055
cp $< $@
10561056

1057+
# NPM doesn't bin-link workspace packages during install, so it must be done manually.
1058+
bin-link:
1059+
[ -f packages/frontend-base/package.json ] && npm rebuild --ignore-scripts @openedx/frontend-base || true
1060+
10571061
build-packages: turbo.json
10581062
$(TURBO) run build; rm -f turbo.json
1063+
$(MAKE) bin-link
10591064

10601065
clean-packages: turbo.json
10611066
$(TURBO) run clean; rm -f turbo.json
10621067

1063-
dev-packages: turbo.json
1068+
dev-packages: build-packages turbo.json
10641069
$(TURBO) run watch:build dev:site; rm -f turbo.json
1070+
1071+
dev-site: bin-link
1072+
npm run dev
10651073
```
10661074

10671075
- ``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.
1068-
- ``build:packages`` builds all workspace packages in dependency order (e.g., ``frontend-base`` before the app).
1076+
- ``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``.
10691077
- ``clean:packages`` runs the ``clean`` script in each workspace package.
1070-
- ``dev:site`` is an alias for ``npm run dev`` that turbo uses as a root-only task (``//#dev:site``).
1071-
- ``dev:packages`` builds dependencies, then concurrently watches workspace packages for changes and starts the dev server.
1078+
- ``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``).
1079+
- ``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.
10721080

10731081
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.
10741082

0 commit comments

Comments
 (0)