-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure all packages correctly downlevel TS files (#9715)
- Loading branch information
Showing
15 changed files
with
155 additions
and
7 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
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
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
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
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,51 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const chalk = require('chalk'); | ||
const execa = require('execa'); | ||
const rimraf = require('rimraf'); | ||
const tempy = require('tempy'); | ||
|
||
const jestDirectory = path.resolve(__dirname, '../packages/jest'); | ||
|
||
const tsConfig = { | ||
compilerOptions: { | ||
esModuleInterop: false, | ||
lib: ['es2018'], | ||
module: 'commonjs', | ||
moduleResolution: 'node', | ||
noEmit: true, | ||
strict: true, | ||
target: 'es5', | ||
}, | ||
}; | ||
const cwd = tempy.directory(); | ||
|
||
try { | ||
execa.sync('yarn', ['init', '--yes'], {cwd, stdio: 'inherit'}); | ||
execa.sync('yarn', ['add', 'typescript@~3.4'], {cwd, stdio: 'inherit'}); | ||
fs.writeFileSync( | ||
path.join(cwd, 'tsconfig.json'), | ||
JSON.stringify(tsConfig, null, 2) | ||
); | ||
fs.writeFileSync( | ||
path.join(cwd, 'index.ts'), | ||
`import jest = require('${jestDirectory}');` | ||
); | ||
execa.sync('yarn', ['tsc', '--project', '.'], {cwd, stdio: 'inherit'}); | ||
|
||
console.log( | ||
chalk.inverse.green(' Successfully compiled Jest with TypeScript 3.4 ') | ||
); | ||
} finally { | ||
rimraf.sync(cwd); | ||
} |
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