chore: add re-exports for ts files (#7993)

This commit is contained in:
Alexander Vakrilov
2019-10-22 16:57:32 +03:00
committed by Manol Donev
parent 2412c0b6f5
commit ae6c02258e
3 changed files with 257 additions and 1 deletions

View File

@@ -81,6 +81,13 @@ function processDefinitionFile(entry: EntryInfo) {
}
}
function processTypeScriptFile(entry: EntryInfo) {
const relativeFilePathNoExt = entry.path.replace(/\.ts$/, "");
createReExportFile(relativeFilePathNoExt, ".ts");
addTestImport(relativeFilePathNoExt);
}
function createReExportFile(pathNoExt: string, ext: ".ts" | ".d.ts") {
const outputFile = path.join(outputFolder, pathNoExt + ext);
if (!fs.existsSync(outputFile)) {
@@ -162,6 +169,11 @@ function generateExportsForPrivateModules() {
// * .ts file with re-exports for the corresponding ts/js file (is such exists)
await traverseInputDir(["*.d.ts"], processDefinitionFile);
console.log(" ------> GENERATING FILES FROM TYPESCRIPT");
// Traverse all ts files which are not platform specific and create
// * .ts file with re-exports for the corresponding ts file
await traverseInputDir(["*(?<!\.(d|android|ios)).ts"], processTypeScriptFile);
generateExportsForPrivateModules();
// Generate tests in