Skip to content

Commit

Permalink
Upgrade TypeScript config to recommended Node 20 config
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyomair committed Oct 24, 2024
1 parent 60acf0c commit 124ce3a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
47 changes: 42 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
},
"devDependencies": {
"@comet/eslint-config": "^3.2.1",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.0.0",
"@types/prettier": "^2.7.1",
"@types/semver": "^7.5.8",
"husky": "^8.0.2",
"lint-staged": "^13.1.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"typescript": "^4.9.4"
"typescript": "~5.1.0"
},
"engines": {
"node": "20"
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ async function runUpgradeScript(script: string) {
const upgradeScript = await import(path.join(__dirname, script));

try {
await upgradeScript.default();
// Need default.default because of ESM interoperability with CommonJS.
// See https://www.typescriptlang.org/docs/handbook/modules/reference.html#node16-nodenext.
await upgradeScript.default.default();
} catch (error) {
console.error(`Script '${script}' failed to execute. See original error below`);
console.error(error);
Expand Down
9 changes: 2 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"rootDir": "src/",
"outDir": "lib/",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
"outDir": "lib/"
}
}

0 comments on commit 124ce3a

Please sign in to comment.