import FairyManager from './reader/FairyManager'; import Path from './Path'; import Setting from './Setting'; import * as Fse from 'fs-extra'; import { ExportVer } from './Options'; import Ts2ExportAll from './export/ts_layabox2merge/Ts2ExportAll'; import { IExportAll } from './export/IExportAll'; import { TsExportAll } from './export/ts_layabox2/TsExportAll'; import Ts3ExportAll from './export/ts_layabox2mergejs/Ts3ExportAll'; export default class Main { static async Init() { if(!Path.IsDirectory(Setting.Options.fairyProjectPath)) { throw new Error(`project path url not found: ${Setting.Options.fairyProjectPath}`); } let mgr = new FairyManager(); FairyManager.current = mgr; // 加载fgui项目 mgr.LoadProject(Setting.Options.fairyProjectPath); var exportHandler:IExportAll; // 导出TypeScript代码 if(Setting.Options.codeExportVer == ExportVer.ts_layabox2merge) { exportHandler = new Ts2ExportAll(mgr); } else if(Setting.Options.codeExportVer == ExportVer.ts_layabox2mergejs) { exportHandler = new Ts3ExportAll(mgr); } else { exportHandler = new TsExportAll(mgr); } await exportHandler.ExportAll(); mgr.ExportRes(Setting.Options.resPath); process.exit(); } } new Main();