Skip to content

Commit 9207b7b

Browse files
arbrandesclaude
andcommitted
feat: support npm workspaces for local development
Add workspaces configuration and workspace-aware scripts for developing with local packages (such as frontend-base). Decouple clean from build in the Makefile so watch mode can rebuild without wiping dist/. Part of openedx/frontend-base#184 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 18f3619 commit 9207b7b

6 files changed

Lines changed: 1592 additions & 185 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ npm-debug.log
33
coverage
44
module.config.js
55
dist/
6+
packages/
7+
/.turbo
8+
/turbo.json
69
/*.tgz
710

811
### i18n ###

Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ transifex_input = $(i18n)/transifex_input.json
1010
# This directory must match .babelrc .
1111
transifex_temp = ./temp/babel-plugin-formatjs
1212

13+
TURBO = TURBO_TELEMETRY_DISABLED=1 turbo --dangerously-disable-package-manager-check
14+
1315
NPM_TESTS=build i18n_extract lint test
1416

1517
# Variables for additional translation sources and imports (define in edx-internal if needed)
@@ -29,10 +31,27 @@ test.npm.%: validate-no-uncommitted-package-lock-changes
2931
requirements: ## install ci requirements
3032
npm ci
3133

34+
# turbo.site.json is the standalone turbo config for this package. It is
35+
# renamed to avoid conflicts with turbo v2's workspace validation, which
36+
# rejects root task syntax (//#) and requires "extends" in package-level
37+
# turbo.json files, such as when running in a site repository. The targets
38+
# below copy it into place before running turbo and clean up after.
39+
turbo.json: turbo.site.json
40+
cp $< $@
41+
42+
build-packages: turbo.json
43+
$(TURBO) run build; rm -f turbo.json
44+
45+
clean-packages: turbo.json
46+
$(TURBO) run clean; rm -f turbo.json
47+
48+
dev-packages: turbo.json
49+
$(TURBO) run watch:build dev:site; rm -f turbo.json
50+
3251
clean:
3352
rm -rf dist
3453

35-
build: clean
54+
build:
3655
tsc --project tsconfig.build.json
3756
find src -type f \( -name '*.scss' -o \( \( -name '*.png' -o -name '*.svg' \) -path '*/assets/*' \) \) -exec sh -c '\
3857
for f in "$$@"; do \

nodemon.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"watch": [
3+
"src"
4+
],
5+
"ext": "js,jsx,ts,tsx,scss,png,svg"
6+
}

0 commit comments

Comments
 (0)