-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added typescript outDir support for getOutputFilePath * Compile if tsconfig is present * Added a isTypescript flag * Parse tsconfig fix * Fix relative directory for mocks * Updated test-ext logic * Autoswitch ext for mocks * Remove ext from imports * Updated import code for typescript * Refactor packaged external file * Autoswitch dialect for PackagedExternalFile * Check before trying to remove directory * Autoswitch entrypoint * Fixed mock offsets * Typescript in AssignmentOperation * MockImportBlock typescript support * Autoswitch prettier parser * Fixed mock import statements * Fixed TestFileBlock test * Updated documentation
- Loading branch information
1 parent
bb69da8
commit ce95ca7
Showing
31 changed files
with
759 additions
and
262 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
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,30 @@ | ||
const cp = require('child_process'); | ||
const fs = require('fs'); | ||
const ts = require('typescript'); | ||
|
||
const rimraf = require('rimraf'); | ||
|
||
const compileAndGetOutputDir = (typescriptConfig) => { | ||
if (fs.existsSync(typescriptConfig)) { | ||
console.log(`Typescript config found at ${typescriptConfig}`); | ||
const contents = fs.readFileSync(typescriptConfig).toString(); | ||
const { config, error } = ts.parseConfigFileTextToJson(typescriptConfig, contents); | ||
|
||
if (error) throw new Error(error); | ||
|
||
const tsBuildDir = config.compilerOptions.outDir; | ||
if (fs.existsSync(tsBuildDir)) { | ||
console.log('Purging build directory'); | ||
rimraf.sync(tsBuildDir); | ||
} | ||
console.log('Recompiling'); | ||
cp.execSync('tsc'); | ||
console.log('Compiled'); | ||
return tsBuildDir; | ||
} | ||
return null; | ||
}; | ||
|
||
module.exports = { | ||
compileAndGetOutputDir, | ||
}; |
Oops, something went wrong.