Skip to content

Commit f940f2b

Browse files
refactor: simplify turbo config, use it for develop + build (freeCodeCamp#65526)
1 parent 7f44e71 commit f940f2b

File tree

16 files changed

+65
-76
lines changed

16 files changed

+65
-76
lines changed

.github/workflows/e2e-playwright.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,8 @@ jobs:
152152
- name: Install playwright dependencies
153153
run: npx playwright install --with-deps
154154

155-
- name: Install and Build
156-
run: |
157-
pnpm install
158-
pnpm turbo compile
159-
pnpm run build:curriculum
155+
- name: Install
156+
run: pnpm install
160157

161158
- name: Start apps
162159
run: |

.github/workflows/e2e-third-party.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,8 @@ jobs:
135135
- name: Install playwright dependencies
136136
run: npx playwright install --with-deps
137137

138-
- name: Install and Build
139-
run: |
140-
pnpm install
141-
pnpm turbo compile
142-
pnpm run build:curriculum
138+
- name: Install
139+
run: pnpm install
143140

144141
- name: Start apps
145142
run: |

.gitpod.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ tasks:
5252
cp sample.env .env &&
5353
pnpm install &&
5454
gp sync-done pnpm-install &&
55-
pnpm turbo compile &&
5655
pnpm run build:curriculum &&
5756
gp ports await 27017
5857
command: >

api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"description": "The freeCodeCamp.org open-source codebase and curriculum",
4343
"devDependencies": {
44+
"@freecodecamp/curriculum": "workspace:*",
4445
"@freecodecamp/eslint-config": "workspace:*",
4546
"@freecodecamp/shared": "workspace:*",
4647
"@total-typescript/ts-reset": "0.6.1",

client/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@
1919
"author": "freeCodeCamp <team@freecodecamp.org>",
2020
"main": "none",
2121
"scripts": {
22-
"prebuild": "pnpm run common-setup && pnpm run build:scripts --env production",
2322
"build": "NODE_OPTIONS=\"--max-old-space-size=7168 --no-deprecation\" gatsby build --prefix-paths",
24-
"build:scripts": "pnpm run -F=browser-scripts compile && tsx ./tools/copy-browser-scripts.ts",
25-
"build:external-curriculum": "tsx ./tools/external-curriculum/build",
2623
"clean": "gatsby clean",
27-
"common-setup": "pnpm -w turbo compile && pnpm run create:env && pnpm run create:trending && pnpm run create:search-placeholder",
24+
"copy:scripts": "tsx ./tools/copy-browser-scripts.ts",
2825
"create:env": "DEBUG=fcc:* tsx ./tools/create-env.ts",
26+
"create:external-curriculum": "tsx ./tools/external-curriculum/build",
2927
"create:trending": "tsx ./tools/download-trending.ts",
3028
"create:search-placeholder": "tsx ./tools/generate-search-placeholder",
31-
"predevelop": "pnpm run common-setup && pnpm run build:scripts --env development",
3229
"develop": "NODE_OPTIONS=\"--max-old-space-size=7168 --no-deprecation\" gatsby develop --inspect=9230",
3330
"lint": "eslint --max-warnings 0",
31+
"setup": "pnpm create:env && pnpm create:trending && pnpm create:search-placeholder && pnpm create:external-curriculum && pnpm copy:scripts",
3432
"serve": "gatsby serve -p 8000",
3533
"serve-ci": "serve -l 8000 -c serve.json public",
3634
"prestand-alone": "pnpm run prebuild",

client/turbo.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://turborepo.com/schema.json",
3+
"extends": ["//"],
4+
"tasks": {
5+
"build": {
6+
"outputs": ["public/**"]
7+
},
8+
"setup": {
9+
"outputs": [
10+
"config/env.json",
11+
"i18n/locales/*.json",
12+
"static/curriculum-data/**",
13+
"static/js/**"
14+
]
15+
}
16+
}
17+
}

curriculum/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme",
2727
"author": "freeCodeCamp <team@freecodecamp.org>",
2828
"scripts": {
29-
"audit-challenges": "pnpm -w turbo compile && tsx ./src/challenge-auditor/index.ts",
30-
"build": "tsx ./src/generate/build-curriculum",
31-
"compile": "tsc",
29+
"audit-challenges": "pnpm turbo setup && tsx ./src/challenge-auditor/index.ts",
30+
"build": "tsc && tsx ./src/generate/build-curriculum",
3231
"type-check": "tsc --noEmit",
3332
"create-empty-steps": "tsx --tsconfig ../tools/challenge-helper-scripts/tsconfig.json ../tools/challenge-helper-scripts/create-empty-steps",
3433
"create-next-challenge": "tsx --tsconfig ../tools/challenge-helper-scripts/tsconfig.json ../tools/challenge-helper-scripts/create-next-challenge",

curriculum/turbo.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://turborepo.com/schema.json",
3+
"extends": ["//"],
4+
"tasks": {
5+
"build": {
6+
"outputs": ["dist/**", "generated/**"]
7+
}
8+
}
9+
}

docker/api/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ RUN pnpm config set dedupe-peer-dependents false
2222
RUN pnpm install --frozen-lockfile --ignore-scripts
2323
RUN cd api && pnpm prisma generate
2424

25-
# The api needs to source curriculum.json and build:curriculum relies on the
25+
# The api needs to source curriculum.json and the build process relies on the
2626
# following env vars.
2727
ARG SHOW_UPCOMING_CHANGES=false
2828
ENV SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES
2929

30-
RUN pnpm turbo compile
31-
RUN pnpm build:curriculum
32-
RUN pnpm -F=api build
30+
RUN pnpm turbo -F=@freecodecamp/api build
3331

3432
FROM node:24-bookworm AS deps
3533
RUN apt-get update && apt-get install -y jq

e2e/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "1.0.0",
44
"scripts": {
55
"lint": "eslint --max-warnings 0",
6-
"playwright:watch": "playwright test --ui-port=0",
7-
"playwright:run": "playwright test",
6+
"playwright:watch": "turbo setup && playwright test --ui-port=0",
7+
"playwright:run": "turbo setup && playwright test",
88
"type-check": "tsc --noEmit"
99
},
1010
"author": "freeCodeCamp <team@freecodecamp.org>",

0 commit comments

Comments
 (0)