Files
GDevelop/GDJS/scripts/codemod-all-to-ts.js
Florian Rival 522e62fa2f Manually translated gd.js to TypeScript
Don't show in changelog
2021-01-08 19:54:33 +01:00

38 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const shell = require('shelljs');
const path = require('path');
const {
getAllInOutFilePaths,
isUntransformedFile,
} = require('./lib/runtime-files-list');
(async () => {
// Generate the output file paths
const {
allGDJSInOutFilePaths,
allExtensionsInOutFilePaths,
} = await getAllInOutFilePaths();
const allInOutFilePaths = [
...allGDJSInOutFilePaths,
...allExtensionsInOutFilePaths,
].filter(({ inPath }) => !isUntransformedFile(inPath))
.filter(({ inPath }) => path.extname(inPath) === '.js');
const totalCount = allInOutFilePaths.length;
let doneCount = 0;
shell.echo(
`️ Will codemod these files: ${allInOutFilePaths
.map(({ inPath }) => path.relative(__dirname, inPath))
.join(', ')}`
);
for (const inOutFilePath of allInOutFilePaths) {
const { inPath } = inOutFilePath;
shell.echo(`️ Codemoding ${inPath}... (${doneCount}/${totalCount} done)`);
shell.exec(
`node codemod-file-to-ts.js --file ${path.relative(__dirname, inPath)}`
);
shell.rm(inPath);
doneCount++;
}
})();