import * as util from 'egret-node-utils';
import * as path from 'path';
import { RenameService } from "./RenameService";

export async function run(rootDir: string) {
    const files = await util.walk(rootDir, (p) => p.indexOf('.ts') >= 0);
    let configPath = path.join(rootDir, "tsconfig.json")


    // "E:\\projects\\transformer\\test\\tsconfig.json";

    // let testProgram= ts.createProgram(files,options);
    // let checker=testProgram.getTypeChecker();
    // //测试tsPlus的功能
    // let plusRes= testProgram.emit(undefined, undefined, undefined, undefined, {
    //     before: [
    //         plus.transformPlus(checker)
    //     ]
    // })
    // //测试排序功能
    // let cicusRes = order.reorderSourceFiles(testProgram);

    //测试重命名功能(已加入tsPlus)
    let renameService = new RenameService(files, configPath, false, false);
    // let result = renameService.compilingWithWatch(true);
    renameService.compiling(true)
    // let recorder = renameService.propsRecorder;
    // let sum = 0;
    // recorder.forEach((num) => {
    //     sum += num;
    // })
    // let a = 10;
    // let b = 10;

}