openpetswithchatandmcp/website/domain-split.ts
OpenPets Dev 65ac83849e Add 'website/' from commit '966aea480ffe1c340553aa878def30131d2af827'
git-subtree-dir: website
git-subtree-mainline: 8d3849caea
git-subtree-split: 966aea480f
2026-06-17 20:48:39 +00:00

50 lines
1.4 KiB
TypeScript
Executable file

import { Project } from 'ts-morph';
import * as fs from 'fs';
import * as path from 'path';
console.log("Starting utility domain split for runboard-route-logic.tsx...");
const project = new Project({
tsConfigFilePath: 'C:/ScriptoriumAI/scriptoriumai-ui/tsconfig.json'
});
const sourceFile = project.getSourceFileOrThrow('C:/ScriptoriumAI/scriptoriumai-ui/src/utils/runboard-route-logic.tsx');
const utilityTypesFile = project.createSourceFile('C:/ScriptoriumAI/scriptoriumai-ui/src/utils/runboard/runboard-utility-types.ts', '', { overwrite: true });
const typeAliases = sourceFile.getTypeAliases();
const interfaces = sourceFile.getInterfaces();
const extractedNames = [];
for (const typeAlias of [...typeAliases]) {
if (typeAlias.isExported()) {
utilityTypesFile.addTypeAlias({
...typeAlias.getStructure(),
isExported: true
});
extractedNames.push(typeAlias.getName());
typeAlias.remove();
}
}
for (const iface of [...interfaces]) {
if (iface.isExported()) {
utilityTypesFile.addInterface({
...iface.getStructure(),
isExported: true
});
extractedNames.push(iface.getName());
iface.remove();
}
}
if (extractedNames.length > 0) {
sourceFile.addImportDeclaration({
moduleSpecifier: './runboard/runboard-utility-types',
namedImports: extractedNames.map(name => ({ name })),
isTypeOnly: true
});
}
console.log("Extracted types to runboard-utility-types.ts");
project.saveSync()