feat: сделать split-клиент режимом по умолчанию

- добавлен operationsTree для сборки полного клиента
- удален режим генерации both
- обновлена документация под npm SDK workflow
- поднята версия пакета до 4.0.0
This commit is contained in:
2026-06-30 10:46:15 +03:00
parent bf340b3dbe
commit fe5d3ae091
9 changed files with 445 additions and 109 deletions

View File

@@ -63,7 +63,7 @@ describe('E2E Generation', () => {
// 3. Проверка импорта (компиляция TypeScript)
const testFile = join(tempDir, 'test-import.ts');
const testCode = `
import { createApiClient, HttpClient } from '${generatedFile}';
import { createApiClient, HttpClient, operationsTree } from '${generatedFile}';
import { getAll } from '${join(outputPath, 'operations', 'get-all.ts')}';
const api = createApiClient(new HttpClient(), {
@@ -71,6 +71,8 @@ describe('E2E Generation', () => {
getAll,
},
});
const fullApi = createApiClient(new HttpClient(), operationsTree);
fullApi.getAll;
console.log('Import successful');
`;
@@ -95,9 +97,10 @@ describe('E2E Generation', () => {
expect(exitCode).toBe(0);
const generatedFile = join(outputPath, 'MinimalAPI.ts');
const exists = await fileExists(generatedFile);
expect(exists).toBe(true);
expect(await fileExists(join(outputPath, 'index.ts'))).toBe(true);
expect(await fileExists(join(outputPath, 'http-client.ts'))).toBe(true);
expect(await fileExists(join(outputPath, 'operations-tree.ts'))).toBe(true);
expect(await fileExists(join(outputPath, 'operations', 'index.ts'))).toBe(true);
}, 30000);
test('повторная генерация (перезапись файлов)', async () => {