Skip to content

Commit 0a55f65

Browse files
feat: support npm workspaces for local development (#140)
1 parent 82c29e5 commit 0a55f65

7 files changed

Lines changed: 422 additions & 22 deletions

File tree

.gitignore

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

811
### i18n ###
912
src/i18n/transifex_input.json

Makefile

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
TURBO = TURBO_TELEMETRY_DISABLED=1 turbo --dangerously-disable-package-manager-check
12
intl_imports = ./node_modules/.bin/intl-imports.js
23
transifex_utils = ./node_modules/.bin/transifex-utils.js
34
i18n = ./src/i18n
@@ -13,6 +14,31 @@ precommit:
1314
requirements:
1415
npm ci
1516

17+
# turbo.site.json is the standalone turbo config for this package. It is
18+
# renamed to avoid conflicts with turbo v2's workspace validation, which
19+
# rejects root task syntax (//#) and requires "extends" in package-level
20+
# turbo.json files, such as when running in a site repository. The targets
21+
# below copy it into place before running turbo and clean up after.
22+
turbo.json: turbo.site.json
23+
cp $< $@
24+
25+
# NPM doesn't bin-link workspace packages during install, so it must be done manually.
26+
bin-link:
27+
[ -f packages/frontend-base/package.json ] && npm rebuild --ignore-scripts @openedx/frontend-base || true
28+
29+
build-packages: turbo.json
30+
$(TURBO) run build; rm -f turbo.json
31+
$(MAKE) bin-link
32+
33+
clean-packages: turbo.json
34+
$(TURBO) run clean; rm -f turbo.json
35+
36+
dev-packages: turbo.json
37+
$(TURBO) run watch:build dev:site; rm -f turbo.json
38+
39+
dev-site: bin-link
40+
npm run dev
41+
1642
i18n.extract:
1743
# Pulling display strings from .jsx files into .json files...
1844
rm -rf $(transifex_temp)
@@ -43,7 +69,7 @@ pull_translations:
4369
clean:
4470
rm -rf dist
4571

46-
build: clean
72+
build:
4773
tsc --project tsconfig.build.json
4874
tsc-alias -p tsconfig.build.json
4975
find src -type f -name '*.scss' -exec sh -c '\

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"
6+
}

0 commit comments

Comments
 (0)