最後活躍 1 day ago

修訂 84444c6db63a34e4ff4de5bd1c7110ef7488db8c

git-rename-ts-files.js 原始檔案
1const glob = require("glob");
2const { execSync } = require('child_process');
3
4console.log('building list of files');
5
6const opts = { absolute: true };
7var files = glob.sync("**/*.ts", opts).concat(glob.sync("**/*.tsx", opts)).filter(f => f.indexOf('node_modules') < 0);
8
9console.log(`found ${files.length} files`);
10
11files.forEach(f => {
12 const newName = f.replace(/\.ts(x)?$/, '.js$1');
13 console.log(`renaming ${f} to ${newName}`);
14 execSync(`git mv ${f} ${f.replace(/\.ts(x)?$/, '.js$1')}`);
15});
16