Skip to content

Commit 49f8445

Browse files
Merge pull request #715 from freeCodeCamp/main
Create a new pull request by comparing changes across two branches
2 parents 7683dd8 + 0810a23 commit 49f8445

File tree

2,446 files changed

+96651
-42107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,446 files changed

+96651
-42107
lines changed

.dockerignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ client/public
44
.git
55
.gitignore
66
.dockerignore
7-
docker/web/Dockerfile
8-
docker/api/Dockerfile
7+
docker/**/Dockerfile
98
**/*docker-compose*
109
**/node_modules
1110
.eslintcache
11+
api/__mocks__
12+
api/src/exam-environment/seed

.github/workflows/build-images.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI - Build Images
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build:
7+
name: Build (Image)
8+
runs-on: ubuntu-22.04
9+
strategy:
10+
matrix:
11+
node-version: [20.x]
12+
apps: [api]
13+
site_tlds: [dev]
14+
fail-fast: false
15+
16+
steps:
17+
- name: Checkout Source Files
18+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
19+
20+
- name: Create a tagname
21+
id: tagname
22+
run: |
23+
echo "tagname=$(git rev-parse --short HEAD)-$(date +%Y%m%d)-$(date +%H%M)" >> $GITHUB_ENV
24+
25+
- name: Build & Tag Image
26+
run: |
27+
docker build \
28+
--tag registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ matrix.site_tlds }}/learn-${{ matrix.apps }}:$tagname \
29+
--tag registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ matrix.site_tlds }}/learn-${{ matrix.apps }}:latest \
30+
--file docker/${{ matrix.apps }}/Dockerfile .
31+
32+
- name: Install doctl
33+
uses: digitalocean/action-doctl@v2
34+
with:
35+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
36+
37+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
38+
run: doctl registry login --expiry-seconds 1200
39+
40+
- name: Push image to DigitalOcean Container Registry
41+
run: |
42+
docker push registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ matrix.site_tlds }}/learn-${{ matrix.apps }}:$tagname
43+
docker push registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ matrix.site_tlds }}/learn-${{ matrix.apps }}:latest

.github/workflows/e2e-with-new-api.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,6 @@ jobs:
7171
name: webpack-stats
7272
path: client/public/stats.json
7373

74-
build-api:
75-
name: Build Api (Container)
76-
runs-on: ubuntu-22.04
77-
strategy:
78-
matrix:
79-
node-version: [20.x]
80-
81-
steps:
82-
- name: Checkout Source Files
83-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
84-
with:
85-
submodules: 'recursive'
86-
87-
- name: Create Image
88-
run: |
89-
docker build \
90-
-t fcc-api \
91-
-f docker/api/Dockerfile .
92-
9374
build-new-api:
9475
name: Build New Api (Container)
9576
runs-on: ubuntu-22.04
@@ -106,11 +87,11 @@ jobs:
10687
- name: Create Image
10788
run: |
10889
docker build \
109-
-t fcc-new-api \
110-
-f docker/new-api/Dockerfile .
90+
-t fcc-api \
91+
-f docker/api/Dockerfile .
11192
11293
- name: Save Image
113-
run: docker save fcc-new-api > api-artifact.tar
94+
run: docker save fcc-api > api-artifact.tar
11495

11596
- name: Upload Api Artifact
11697
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
@@ -166,7 +147,6 @@ jobs:
166147
- name: Set freeCodeCamp Environment Variables (needed by api)
167148
run: |
168149
cp sample.env .env
169-
echo 'HOST=0.0.0.0' >> .env
170150
171151
- name: Install playwright dependencies
172152
run: npx playwright install --with-deps

.github/workflows/github-autoclose.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ jobs:
2121
});
2222
if (
2323
files.data.length !== 1 ||
24-
files.data[0].filename !== ".gitignore"
24+
(files.data[0].filename !== ".gitignore" &&
25+
// We've had four PRs make this same (irrelevant) change already.
26+
!(files.data[0].filename === "664ef4623946e65e18d59764.md" &&
27+
files.data[0].patch.includes("return re.sub('(?<!\d)1', '', equation_string.strip('+'))")
28+
)
29+
)
2530
) {
2631
return;
2732
}

.github/workflows/temporary-container-checks.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
--build-arg SHOW_NEW_CURRICULUM=false \
5151
--build-arg GROWTHBOOK_URI=api_URI_from_Growthbook_dashboard \
5252
--build-arg FREECODECAMP_NODE_ENV=development \
53-
-t fcc-client \
5453
-f docker/web/Dockerfile .
5554
5655
build-api:
@@ -69,8 +68,7 @@ jobs:
6968
- name: Create Image
7069
run: |
7170
docker build \
72-
-t fcc-api \
73-
-f docker/api/Dockerfile .
71+
-f docker/api-server/Dockerfile .
7472
7573
build-new-api:
7674
name: Build New Api (Container)
@@ -88,5 +86,4 @@ jobs:
8886
- name: Create Image
8987
run: |
9088
docker build \
91-
-t fcc-new-api \
92-
-f docker/new-api/Dockerfile .
89+
-f docker/api/Dockerfile .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ shared/utils/get-lines.test.js
162162
shared/utils/validate.js
163163
shared/utils/validate.test.js
164164
shared/utils/is-audited.js
165+
shared/utils/shuffle-array.js
165166

166167
### Old Generated files ###
167168
# These files are no longer generated by the client, but can

.gitpod.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ tasks:
4141
- name: db
4242
# starting mongod in background, so it doesn't block prebuilds
4343
before: >
44-
mkdir -p /workspace/data &&
45-
(mongod --dbpath /workspace/data &)
44+
cd api/tools &&
45+
docker compose up -d
4646
4747
- name: server
4848
before: export COOKIE_DOMAIN=gitpod.io && export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000)
@@ -58,7 +58,8 @@ tasks:
5858
pnpm run seed &&
5959
mongosh --eval "db.fsyncLock(); db.fsyncUnlock()" &&
6060
gp ports await 27017 &&
61-
pnpm run develop:server
61+
cd api &&
62+
pnpm run develop
6263
6364
- name: client
6465
before: export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000)

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
**/.cache
22
**/*fixtures*
3-
**/public
43
api-server/lib
54
client/**/trending.json
5+
client/**/search-bar.json
66
client/config/*.json
77
client/config/browser-scripts/*.json
88
client/static
9+
client/public
910
curriculum/challenges/_meta/*/*
1011
curriculum/challenges/**/*
1112
curriculum/i18n-curriculum

api-server/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@
8080
"@babel/cli": "7.17.10",
8181
"@babel/core": "7.18.0",
8282
"@babel/node": "7.17.10",
83-
"@babel/plugin-proposal-class-properties": "7.17.12",
8483
"@babel/plugin-proposal-object-rest-spread": "7.18.0",
8584
"@babel/plugin-proposal-optional-chaining": "7.17.12",
8685
"@babel/preset-env": "7.18.0",
87-
"@babel/register": "7.17.7",
8886
"loopback-component-explorer": "6.4.0",
8987
"nodemon": "2.0.16"
9088
}

api-server/src/server/utils/exam.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
function shuffleArray(arr) {
2-
let currentIndex = arr.length,
3-
randomIndex;
4-
5-
while (currentIndex != 0) {
6-
randomIndex = Math.floor(Math.random() * currentIndex);
7-
currentIndex--;
8-
[arr[currentIndex], arr[randomIndex]] = [
9-
arr[randomIndex],
10-
arr[currentIndex]
11-
];
12-
}
13-
14-
return arr;
15-
}
1+
import { shuffleArray } from '../../../../shared/utils/shuffle-array';
162

173
function filterDeprecated(arr) {
184
return arr.filter(i => !i.deprecated);

0 commit comments

Comments
 (0)