mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 10:22:16 +00:00
refactor: simplify turbo config, use it for develop + build (#65526)
This commit is contained in:
committed by
GitHub
parent
7f44e71852
commit
f940f2beee
@@ -152,11 +152,8 @@ jobs:
|
||||
- name: Install playwright dependencies
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Install and Build
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm turbo compile
|
||||
pnpm run build:curriculum
|
||||
- name: Install
|
||||
run: pnpm install
|
||||
|
||||
- name: Start apps
|
||||
run: |
|
||||
|
||||
@@ -135,11 +135,8 @@ jobs:
|
||||
- name: Install playwright dependencies
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Install and Build
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm turbo compile
|
||||
pnpm run build:curriculum
|
||||
- name: Install
|
||||
run: pnpm install
|
||||
|
||||
- name: Start apps
|
||||
run: |
|
||||
|
||||
@@ -52,7 +52,6 @@ tasks:
|
||||
cp sample.env .env &&
|
||||
pnpm install &&
|
||||
gp sync-done pnpm-install &&
|
||||
pnpm turbo compile &&
|
||||
pnpm run build:curriculum &&
|
||||
gp ports await 27017
|
||||
command: >
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
},
|
||||
"description": "The freeCodeCamp.org open-source codebase and curriculum",
|
||||
"devDependencies": {
|
||||
"@freecodecamp/curriculum": "workspace:*",
|
||||
"@freecodecamp/eslint-config": "workspace:*",
|
||||
"@freecodecamp/shared": "workspace:*",
|
||||
"@total-typescript/ts-reset": "0.6.1",
|
||||
|
||||
+3
-5
@@ -19,18 +19,16 @@
|
||||
"author": "freeCodeCamp <team@freecodecamp.org>",
|
||||
"main": "none",
|
||||
"scripts": {
|
||||
"prebuild": "pnpm run common-setup && pnpm run build:scripts --env production",
|
||||
"build": "NODE_OPTIONS=\"--max-old-space-size=7168 --no-deprecation\" gatsby build --prefix-paths",
|
||||
"build:scripts": "pnpm run -F=browser-scripts compile && tsx ./tools/copy-browser-scripts.ts",
|
||||
"build:external-curriculum": "tsx ./tools/external-curriculum/build",
|
||||
"clean": "gatsby clean",
|
||||
"common-setup": "pnpm -w turbo compile && pnpm run create:env && pnpm run create:trending && pnpm run create:search-placeholder",
|
||||
"copy:scripts": "tsx ./tools/copy-browser-scripts.ts",
|
||||
"create:env": "DEBUG=fcc:* tsx ./tools/create-env.ts",
|
||||
"create:external-curriculum": "tsx ./tools/external-curriculum/build",
|
||||
"create:trending": "tsx ./tools/download-trending.ts",
|
||||
"create:search-placeholder": "tsx ./tools/generate-search-placeholder",
|
||||
"predevelop": "pnpm run common-setup && pnpm run build:scripts --env development",
|
||||
"develop": "NODE_OPTIONS=\"--max-old-space-size=7168 --no-deprecation\" gatsby develop --inspect=9230",
|
||||
"lint": "eslint --max-warnings 0",
|
||||
"setup": "pnpm create:env && pnpm create:trending && pnpm create:search-placeholder && pnpm create:external-curriculum && pnpm copy:scripts",
|
||||
"serve": "gatsby serve -p 8000",
|
||||
"serve-ci": "serve -l 8000 -c serve.json public",
|
||||
"prestand-alone": "pnpm run prebuild",
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://turborepo.com/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": ["public/**"]
|
||||
},
|
||||
"setup": {
|
||||
"outputs": [
|
||||
"config/env.json",
|
||||
"i18n/locales/*.json",
|
||||
"static/curriculum-data/**",
|
||||
"static/js/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,8 @@
|
||||
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme",
|
||||
"author": "freeCodeCamp <team@freecodecamp.org>",
|
||||
"scripts": {
|
||||
"audit-challenges": "pnpm -w turbo compile && tsx ./src/challenge-auditor/index.ts",
|
||||
"build": "tsx ./src/generate/build-curriculum",
|
||||
"compile": "tsc",
|
||||
"audit-challenges": "pnpm turbo setup && tsx ./src/challenge-auditor/index.ts",
|
||||
"build": "tsc && tsx ./src/generate/build-curriculum",
|
||||
"type-check": "tsc --noEmit",
|
||||
"create-empty-steps": "tsx --tsconfig ../tools/challenge-helper-scripts/tsconfig.json ../tools/challenge-helper-scripts/create-empty-steps",
|
||||
"create-next-challenge": "tsx --tsconfig ../tools/challenge-helper-scripts/tsconfig.json ../tools/challenge-helper-scripts/create-next-challenge",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://turborepo.com/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": ["dist/**", "generated/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,14 +22,12 @@ RUN pnpm config set dedupe-peer-dependents false
|
||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||
RUN cd api && pnpm prisma generate
|
||||
|
||||
# The api needs to source curriculum.json and build:curriculum relies on the
|
||||
# The api needs to source curriculum.json and the build process relies on the
|
||||
# following env vars.
|
||||
ARG SHOW_UPCOMING_CHANGES=false
|
||||
ENV SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES
|
||||
|
||||
RUN pnpm turbo compile
|
||||
RUN pnpm build:curriculum
|
||||
RUN pnpm -F=api build
|
||||
RUN pnpm turbo -F=@freecodecamp/api build
|
||||
|
||||
FROM node:24-bookworm AS deps
|
||||
RUN apt-get update && apt-get install -y jq
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0",
|
||||
"playwright:watch": "playwright test --ui-port=0",
|
||||
"playwright:run": "playwright test",
|
||||
"playwright:watch": "turbo setup && playwright test --ui-port=0",
|
||||
"playwright:run": "turbo setup && playwright test",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"author": "freeCodeCamp <team@freecodecamp.org>",
|
||||
|
||||
+9
-11
@@ -21,11 +21,10 @@
|
||||
"scripts": {
|
||||
"audit-challenges": "cd curriculum && pnpm audit-challenges",
|
||||
"analyze-bundle": "webpack-bundle-analyzer",
|
||||
"prebuild": "turbo compile",
|
||||
"build": "npm-run-all -p build:*",
|
||||
"build:client": "cd ./client && pnpm run build",
|
||||
"build:curriculum": "pnpm -F=curriculum run build && pnpm -F=client run build:external-curriculum",
|
||||
"build:api": "cd ./api && pnpm run build",
|
||||
"build": "turbo build",
|
||||
"build:client": "turbo -F=@freecodecamp/client build",
|
||||
"build:curriculum": "turbo -F=@freecodecamp/curriculum build",
|
||||
"build:api": "turbo -F=@freecodecamp/api build",
|
||||
"challenge-editor": "cd tools/challenge-editor && pnpm dev",
|
||||
"challenge-editor-setup": "git submodule update --init tools/challenge-editor && cd tools/challenge-editor && pnpm install",
|
||||
"clean": "npm-run-all -p clean:client clean:api clean:curriculum --serial clean:packages",
|
||||
@@ -38,10 +37,9 @@
|
||||
"create-new-project": "cd ./tools/challenge-helper-scripts/ && pnpm run create-project",
|
||||
"create-new-language-block": "cd ./tools/challenge-helper-scripts/ && pnpm run create-language-block",
|
||||
"create-new-quiz": "cd ./tools/challenge-helper-scripts/ && pnpm run create-quiz",
|
||||
"predevelop": "turbo compile && pnpm build:curriculum",
|
||||
"develop": "npm-run-all -p develop:*",
|
||||
"develop:client": "cd ./client && pnpm run develop",
|
||||
"develop:api": "cd ./api && pnpm run develop",
|
||||
"develop": "turbo develop",
|
||||
"develop:client": "cd ./client && turbo develop",
|
||||
"develop:api": "cd ./api && turbo develop",
|
||||
"format": "run-s format:eslint format:prettier",
|
||||
"format:eslint": "turbo lint -- --fix",
|
||||
"format:prettier": "prettier --write .",
|
||||
@@ -53,7 +51,7 @@
|
||||
"lint:challenges": "cd ./curriculum && pnpm run lint-challenges",
|
||||
"lint:prettier": "prettier --list-different .",
|
||||
"lint:css": "stylelint '**/*.css'",
|
||||
"preseed": "turbo compile",
|
||||
"preseed": "turbo setup",
|
||||
"playwright:install-build-tools": "npx playwright install --with-deps",
|
||||
"rename-challenges": "tsx tools/challenge-helper-scripts/rename-challenge-files.ts",
|
||||
"seed": "pnpm seed:surveys && pnpm seed:exams && DEBUG=fcc:* node ./tools/scripts/seed/seed-demo-user",
|
||||
@@ -65,7 +63,7 @@
|
||||
"seed:ms-username": "DEBUG=fcc:* node ./tools/scripts/seed/seed-ms-username",
|
||||
"serve:client": "cd ./client && pnpm run serve",
|
||||
"serve:client-ci": "cd ./client && pnpm run serve-ci",
|
||||
"start": "turbo compile && npm-run-all -p develop:server serve:client",
|
||||
"start": "turbo setup && npm-run-all -p develop:server serve:client",
|
||||
"test": "turbo test",
|
||||
"prepare": "husky",
|
||||
"playwright:run": "pnpm -F e2e run playwright:run",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"test:watch": "vitest",
|
||||
"test:ui": "vitest --ui",
|
||||
"type-check": "tsc --noEmit",
|
||||
"compile": "tsc",
|
||||
"build": "tsc",
|
||||
"lint": "eslint --max-warnings 0"
|
||||
},
|
||||
"type": "module",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"test:watch": "vitest",
|
||||
"test:ui": "vitest --ui",
|
||||
"type-check": "tsc --noEmit",
|
||||
"compile": "tsdown --format cjs --format esm",
|
||||
"build": "tsdown --format cjs --format esm",
|
||||
"lint": "eslint --max-warnings 0"
|
||||
},
|
||||
"type": "module",
|
||||
|
||||
Generated
+6
-3
@@ -198,6 +198,9 @@ importers:
|
||||
specifier: 13.15.26
|
||||
version: 13.15.26
|
||||
devDependencies:
|
||||
'@freecodecamp/curriculum':
|
||||
specifier: workspace:*
|
||||
version: link:../curriculum
|
||||
'@freecodecamp/eslint-config':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/eslint-config
|
||||
@@ -20784,7 +20787,7 @@ snapshots:
|
||||
|
||||
'@types/yoga-layout@1.9.2': {}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)':
|
||||
'@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/experimental-utils': 4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@typescript-eslint/parser': 4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
@@ -23717,7 +23720,7 @@ snapshots:
|
||||
|
||||
eslint-config-react-app@6.0.0(@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@7.32.0)(typescript@5.9.3))(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(babel-eslint@10.1.0(eslint@9.39.2(jiti@2.6.1)))(eslint-plugin-flowtype@5.10.0(eslint@7.32.0))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@7.32.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@7.32.0))(eslint-plugin-react-hooks@4.6.0(eslint@7.32.0))(eslint-plugin-react@7.37.4(eslint@7.32.0))(eslint@7.32.0)(typescript@5.9.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0(@typescript-eslint/parser@4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@typescript-eslint/parser': 4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
babel-eslint: 10.1.0(eslint@9.39.2(jiti@2.6.1))
|
||||
confusing-browser-globals: 1.0.11
|
||||
@@ -25017,7 +25020,7 @@ snapshots:
|
||||
'@nodelib/fs.walk': 1.2.8
|
||||
'@pmmmwh/react-refresh-webpack-plugin': 0.4.3(react-refresh@0.9.0)(webpack@5.90.3)
|
||||
'@types/http-proxy': 1.17.12
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0(@typescript-eslint/parser@4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@typescript-eslint/parser': 4.33.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
||||
'@vercel/webpack-asset-relocator-loader': 1.7.3
|
||||
address: 1.1.2
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0",
|
||||
"compile": "NODE_OPTIONS=\"--max-old-space-size=7168\" webpack -c webpack.config.cjs"
|
||||
"build": "NODE_OPTIONS=\"--max-old-space-size=7168\" webpack -c webpack.config.cjs --env production"
|
||||
},
|
||||
"type": "module",
|
||||
"keywords": [],
|
||||
|
||||
+7
-34
@@ -1,41 +1,14 @@
|
||||
{
|
||||
"$schema": "https://turborepo.com/schema.json",
|
||||
"tasks": {
|
||||
"lint": { "dependsOn": ["compile"] },
|
||||
"type-check": { "dependsOn": ["compile"] },
|
||||
"@freecodecamp/client#lint": {
|
||||
"dependsOn": ["compile", "create:env"]
|
||||
},
|
||||
"@freecodecamp/client#type-check": {
|
||||
"dependsOn": ["compile", "create:env"]
|
||||
},
|
||||
"@freecodecamp/scripts-lint#lint": {
|
||||
"dependsOn": ["@freecodecamp/client#create:trending"],
|
||||
"inputs": [
|
||||
"$TURBO_DEFAULT$",
|
||||
"$TURBO_ROOT$/client/i18n/locales/english/*"
|
||||
]
|
||||
},
|
||||
"build": { "dependsOn": ["setup"], "outputs": ["dist/**"] },
|
||||
"develop": { "dependsOn": ["setup"], "cache": false, "persistent": true },
|
||||
"lint": { "dependsOn": ["setup"] },
|
||||
"setup": { "dependsOn": ["^build"] },
|
||||
"test": { "dependsOn": ["setup"] },
|
||||
"type-check": { "dependsOn": ["setup"] },
|
||||
"//#lint-root": {
|
||||
"dependsOn": ["@freecodecamp/shared#compile"]
|
||||
},
|
||||
"compile": { "dependsOn": ["^compile"], "outputs": ["dist/**"] },
|
||||
"create:trending": { "cache": false },
|
||||
"create:env": {
|
||||
"dependsOn": ["@freecodecamp/curriculum#compile"],
|
||||
"outputs": ["config/env.json"]
|
||||
},
|
||||
"build": { "dependsOn": ["compile"], "outputs": ["generated/**"] },
|
||||
"build:scripts": {},
|
||||
"build:external-curriculum": {
|
||||
"dependsOn": ["@freecodecamp/curriculum#build"]
|
||||
},
|
||||
"test": { "dependsOn": ["compile"] },
|
||||
"@freecodecamp/api#test": {
|
||||
"dependsOn": ["compile", "@freecodecamp/curriculum#build"]
|
||||
},
|
||||
"@freecodecamp/client#test": {
|
||||
"dependsOn": ["compile", "create:env", "build:external-curriculum"]
|
||||
"dependsOn": ["@freecodecamp/shared#build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user