-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13563 from apache/bundle-dts
chore(dts): generate bundled dts distribution
- Loading branch information
Showing
91 changed files
with
439 additions
and
242 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { TypeScriptVersion } = require('@definitelytyped/typescript-versions'); | ||
const { | ||
cleanTypeScriptInstalls, | ||
installAllTypeScriptVersions, | ||
typeScriptPath | ||
} = require('@definitelytyped/utils'); | ||
const { runTsCompile, readTSConfig } = require('./pre-publish'); | ||
const globby = require('globby'); | ||
const semver = require('semver'); | ||
|
||
const MIN_VERSION = '3.4.0'; | ||
|
||
async function installTs() { | ||
// await cleanTypeScriptInstalls(); | ||
await installAllTypeScriptVersions(); | ||
} | ||
|
||
async function runTests() { | ||
const tsConfig = readTSConfig(); | ||
const compilerOptions = { | ||
...tsConfig.compilerOptions, | ||
declaration: false, | ||
importHelpers: false, | ||
sourceMap: false, | ||
pretty: false, | ||
removeComments: false, | ||
allowJs: false, | ||
outDir: __dirname + '/../test/types/tmp', | ||
typeRoots: [__dirname + '/../types/dist'], | ||
rootDir: __dirname + '/../test/types' | ||
}; | ||
const testsList = await globby(__dirname + '/../test/types/*.ts'); | ||
|
||
for (let version of TypeScriptVersion.shipped) { | ||
if (semver.lt(version + '.0', MIN_VERSION)) { | ||
continue; | ||
} | ||
|
||
console.log(`Testing ts version ${version}`); | ||
const ts = require(typeScriptPath(version)); | ||
await runTsCompile(ts, compilerOptions, testsList); | ||
|
||
console.log(`Finished test of ts version ${version}`); | ||
} | ||
} | ||
|
||
async function main() { | ||
await installTs(); | ||
await runTests(); | ||
} | ||
|
||
module.exports = main; | ||
|
||
main(); |
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
Oops, something went wrong.