Prepare repository for gradual flow->ts migration (#12317)

Co-authored-by: Bogdan Savluk <savluk.bogdan@gmail.com>
This commit is contained in:
Nicolò Ribaudo
2020-11-09 21:31:48 +01:00
parent a9bc9becc5
commit f80478c06d
15 changed files with 498 additions and 188 deletions

View File

@@ -81,13 +81,21 @@ module.exports = function () {
? packageJson["browser"]
: packageJson["main"];
return path.normalize(
const asJS = path.normalize(
path.join(
packageFolder,
// replace lib with src in the package.json entry
filename.replace(/^(\.\/)?lib\//, "src/")
)
);
const asTS = asJS.replace(/\.js$/, ".ts");
try {
fs.statSync(asTS);
return asTS;
} catch {
return asJS;
}
},
};
};