diff --git a/.github/workflows/e2e-playwright.yml b/.github/workflows/e2e-playwright.yml index 82beac0f899..6e208ca3778 100644 --- a/.github/workflows/e2e-playwright.yml +++ b/.github/workflows/e2e-playwright.yml @@ -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: | diff --git a/.github/workflows/e2e-third-party.yml b/.github/workflows/e2e-third-party.yml index 62006af6da1..65f15ef5f50 100644 --- a/.github/workflows/e2e-third-party.yml +++ b/.github/workflows/e2e-third-party.yml @@ -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: | diff --git a/.gitpod.yml b/.gitpod.yml index bfdb3073aa7..bf61e9b5259 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -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: > diff --git a/api/package.json b/api/package.json index e231a9fd8b9..ae9c31d48ab 100644 --- a/api/package.json +++ b/api/package.json @@ -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", diff --git a/client/package.json b/client/package.json index 902c9aa04fc..ac3742d2514 100644 --- a/client/package.json +++ b/client/package.json @@ -19,18 +19,16 @@ "author": "freeCodeCamp ", "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", diff --git a/client/turbo.json b/client/turbo.json new file mode 100644 index 00000000000..62132b93e5b --- /dev/null +++ b/client/turbo.json @@ -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/**" + ] + } + } +} diff --git a/curriculum/package.json b/curriculum/package.json index ba35b7bd8ba..c782bd32693 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -26,9 +26,8 @@ "homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", "author": "freeCodeCamp ", "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", diff --git a/curriculum/turbo.json b/curriculum/turbo.json new file mode 100644 index 00000000000..ed5ebccd8d1 --- /dev/null +++ b/curriculum/turbo.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://turborepo.com/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["dist/**", "generated/**"] + } + } +} diff --git a/docker/api/Dockerfile b/docker/api/Dockerfile index 8bc1bd82d05..778ddd744c0 100644 --- a/docker/api/Dockerfile +++ b/docker/api/Dockerfile @@ -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 diff --git a/e2e/package.json b/e2e/package.json index da778bb169a..0eb629cfb1a 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -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 ", diff --git a/package.json b/package.json index 1ce04128a70..52eb45d67bd 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/challenge-builder/package.json b/packages/challenge-builder/package.json index 9a839bd86b7..fe522228b90 100644 --- a/packages/challenge-builder/package.json +++ b/packages/challenge-builder/package.json @@ -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", diff --git a/packages/shared/package.json b/packages/shared/package.json index 5663d037a61..ab0e73e42dc 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ec967e0427..50ec1915869 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/tools/client-plugins/browser-scripts/package.json b/tools/client-plugins/browser-scripts/package.json index 18c161a18f4..6a679e0faca 100644 --- a/tools/client-plugins/browser-scripts/package.json +++ b/tools/client-plugins/browser-scripts/package.json @@ -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": [], diff --git a/turbo.json b/turbo.json index 7197a15223a..21c60aff6df 100644 --- a/turbo.json +++ b/turbo.json @@ -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"] } } }