Skip to content

Commit 0b96c09

Browse files
authored
feat: replace ts-node with tsx (freeCodeCamp#59019)
1 parent c444541 commit 0b96c09

File tree

11 files changed

+4492
-1844
lines changed

11 files changed

+4492
-1844
lines changed

api/src/server.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// We need to use the triple-slash directive to ensure that ts-node uses the
2-
// reset.d.ts file. It's not possible to import the file directly because it
3-
// is not included in the build (it's a dev dependency).
4-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
5-
/// <reference path="./reset.d.ts" />
6-
71
import './instrument';
82

93
import { randomBytes } from 'crypto';

client/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
"build:scripts": "pnpm run -F=browser-scripts build",
2525
"clean": "gatsby clean",
2626
"common-setup": "pnpm -w run create:shared && pnpm run create:env && pnpm run create:trending && pnpm run create:search-placeholder",
27-
"create:env": "DEBUG=fcc:* ts-node ./tools/create-env.ts",
28-
"create:trending": "ts-node ./tools/download-trending.ts",
29-
"create:search-placeholder": "ts-node ./tools/generate-search-placeholder",
27+
"create:env": "DEBUG=fcc:* tsx ./tools/create-env.ts",
28+
"create:trending": "tsx ./tools/download-trending.ts",
29+
"create:search-placeholder": "tsx ./tools/generate-search-placeholder",
3030
"predevelop": "pnpm run common-setup && pnpm run build:scripts --env development",
3131
"develop": "NODE_OPTIONS=\"--max-old-space-size=7168\" gatsby develop --inspect=9230",
32-
"lint": "ts-node ./i18n/schema-validation.ts",
32+
"lint": "tsx ./i18n/schema-validation.ts",
3333
"serve": "gatsby serve -p 8000",
3434
"serve-ci": "serve -l 8000 -c serve.json public",
3535
"prestand-alone": "pnpm run prebuild",
3636
"stand-alone": "gatsby develop",
37-
"validate-keys": "ts-node --project ../tsconfig.json ../tools/scripts/lint/validate-keys"
37+
"validate-keys": "tsx --tsconfig ../tsconfig.json ../tools/scripts/lint/validate-keys"
3838
},
3939
"dependencies": {
4040
"@babel/plugin-proposal-export-default-from": "7.23.3",
@@ -169,7 +169,6 @@
169169
"react-test-renderer": "17.0.2",
170170
"redux-saga-test-plan": "4.0.6",
171171
"serve": "13.0.4",
172-
"ts-node": "10.9.2",
173172
"webpack": "5.90.3"
174173
}
175174
}

client/tsconfig.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,5 @@
2222
"utils/**/*",
2323
"tools/**/*",
2424
"config/**/*"
25-
], // since ts-node compiles ts on the fly and then uses node, it needs to
26-
// compile the scripts to commonjs (or node will complain about the requires)
27-
"ts-node": {
28-
"compilerOptions": {
29-
"module": "commonjs"
30-
},
31-
"transpileOnly": true
32-
}
25+
]
3326
}

curriculum/i18n-curriculum

Submodule i18n-curriculum updated 6490 files

curriculum/package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@
1818
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme",
1919
"author": "freeCodeCamp <[email protected]>",
2020
"scripts": {
21-
"build": "ts-node --project ../tsconfig.json ../tools/scripts/build/build-curriculum",
22-
"create-empty-steps": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/create-empty-steps",
23-
"create-next-challenge": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/create-next-challenge",
24-
"create-this-challenge": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/create-this-challenge",
25-
"create-next-step": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/create-next-step",
26-
"create-next-task": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/create-next-task",
27-
"insert-challenge": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/insert-challenge",
28-
"insert-step": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/insert-step",
29-
"insert-task": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/insert-task",
21+
"build": "tsx --tsconfig ../tsconfig.json ../tools/scripts/build/build-curriculum",
22+
"create-empty-steps": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-empty-steps",
23+
"create-next-challenge": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-next-challenge",
24+
"create-this-challenge": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-this-challenge",
25+
"create-next-step": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-next-step",
26+
"create-next-task": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-next-task",
27+
"insert-challenge": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/insert-challenge",
28+
"insert-step": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/insert-step",
29+
"insert-task": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/insert-task",
3030
"install-puppeteer": "puppeteer browsers install chrome",
31-
"delete-step": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/delete-step",
32-
"delete-challenge": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/delete-challenge",
33-
"delete-task": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/delete-task",
34-
"lint": "ts-node --project ../tsconfig.json lint-localized",
35-
"repair-meta": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/repair-meta",
36-
"reorder-tasks": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/reorder-tasks",
37-
"update-challenge-order": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/update-challenge-order",
38-
"update-step-titles": "CALLING_DIR=$INIT_CWD ts-node --project ../tsconfig.json ../tools/challenge-helper-scripts/update-step-titles",
39-
"test": "NODE_OPTIONS='--max-old-space-size=7168' ts-node ./node_modules/mocha/bin/mocha.js --delay --exit --reporter progress --bail",
40-
"test:full-output": "NODE_OPTIONS='--max-old-space-size=7168' FULL_OUTPUT=true ts-node ./node_modules/mocha/bin/mocha.js --delay --reporter progress"
31+
"delete-step": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/delete-step",
32+
"delete-challenge": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/delete-challenge",
33+
"delete-task": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/delete-task",
34+
"lint": "tsx --tsconfig ../tsconfig.json lint-localized",
35+
"repair-meta": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/repair-meta",
36+
"reorder-tasks": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/reorder-tasks",
37+
"update-challenge-order": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/update-challenge-order",
38+
"update-step-titles": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/update-step-titles",
39+
"test": "NODE_OPTIONS='--max-old-space-size=7168' tsx ./node_modules/mocha/bin/mocha.js --delay --exit --reporter progress --bail",
40+
"test:full-output": "NODE_OPTIONS='--max-old-space-size=7168' FULL_OUTPUT=true tsx ./node_modules/mocha/bin/mocha.js --delay --reporter progress"
4141
},
4242
"devDependencies": {
4343
"@babel/core": "7.23.7",

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"main": "none",
2121
"scripts": {
2222
"preinstall": "npx -y only-allow pnpm",
23-
"audit-challenges": "pnpm run create:shared && ts-node tools/challenge-auditor/index.ts",
23+
"audit-challenges": "pnpm run create:shared && tsx tools/challenge-auditor/index.ts",
2424
"analyze-bundle": "webpack-bundle-analyzer",
2525
"prebuild": "npm-run-all create:shared",
2626
"build": "npm-run-all -p build:*",
@@ -47,7 +47,7 @@
4747
"format": "run-s format:eslint format:prettier",
4848
"format:eslint": "eslint . --fix",
4949
"format:prettier": "prettier --write .",
50-
"i18n-sync": "ts-node ./tools/scripts/sync-i18n.ts",
50+
"i18n-sync": "tsx ./tools/scripts/sync-i18n.ts",
5151
"knip": "npx -y knip@5 --include files",
5252
"knip:all": "npx -y knip@5 ",
5353
"prelint": "pnpm run -F=client predevelop",
@@ -60,7 +60,7 @@
6060
"reload:server": "pm2 reload api-server/ecosystem.config.js",
6161
"preseed": "npm-run-all create:shared",
6262
"playwright:install-build-tools": "npx playwright install --with-deps",
63-
"rename-challenges": "ts-node tools/challenge-helper-scripts/rename-challenge-files.ts",
63+
"rename-challenges": "tsx tools/challenge-helper-scripts/rename-challenge-files.ts",
6464
"seed": "pnpm seed:surveys && pnpm seed:exams && DEBUG=fcc:* node ./tools/scripts/seed/seed-demo-user",
6565
"seed:certified-user": "pnpm seed:surveys && pnpm seed:exams && pnpm seed:ms-username && DEBUG=fcc:* node ./tools/scripts/seed/seed-demo-user --certified-user",
6666
"seed:exams": "DEBUG=fcc:* node tools/scripts/seed-exams/create-exams",
@@ -131,7 +131,7 @@
131131
"prettier": "3.2.5",
132132
"prismjs": "1.29.0",
133133
"stylelint": "16.14.1",
134-
"ts-node": "10.9.2",
134+
"tsx": "4.19.1",
135135
"typescript": "5.7.3",
136136
"typescript-eslint": "^8.23.0",
137137
"webpack-bundle-analyzer": "4.10.1",

0 commit comments

Comments
 (0)