-
-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Implementation * fix * fix lint * fix * fix * cleanup * fallback to older @tsconfig/node* config when we detect an incompatibility with the lib or target options * lint fix * WIP * Add CLI and programmatic option to disable implicit compiler options * Remove --no-implicit-compiler-options flag and programmatic option; it is implemented in another PR * add tests * fix tests * fix tests * fix tests
- Loading branch information
Showing
11 changed files
with
172 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@tsconfig/node10/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@tsconfig/node12/tsconfig.json", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@tsconfig/node14/tsconfig.json" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { TSCommon } from '.' | ||
|
||
const nodeMajor = parseInt(process.versions.node.split('.')[0], 10) | ||
/** | ||
* return parsed JSON of the bundled @tsconfig/bases config appropriate for the | ||
* running version of nodejs | ||
* @internal | ||
*/ | ||
export function getDefaultTsconfigJsonForNodeVersion (ts: TSCommon): any { | ||
if (nodeMajor >= 14) { | ||
const config = require('@tsconfig/node14/tsconfig.json') | ||
if (configCompatible(config)) return config | ||
} | ||
if (nodeMajor >= 12) { | ||
const config = require('@tsconfig/node12/tsconfig.json') | ||
if (configCompatible(config)) return config | ||
} | ||
return require('@tsconfig/node10/tsconfig.json') | ||
|
||
// Verify that tsconfig target and lib options are compatible with TypeScript compiler | ||
function configCompatible (config: { | ||
compilerOptions: { | ||
lib: string[], | ||
target: string | ||
} | ||
}) { | ||
return ( | ||
typeof (ts.ScriptTarget as any)[config.compilerOptions.target.toUpperCase()] === 'number' && | ||
ts.libs && | ||
config.compilerOptions.lib.every(lib => ts.libs!.includes(lib)) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "ts-node/node10/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "ts-node/node12/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "ts-node/node14/tsconfig.json" | ||
} |