@auto-engineer/server-generator-apollo-emmett 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -0
- package/README.md +182 -132
- package/dist/src/commands/generate-server.d.ts.map +1 -1
- package/dist/src/commands/generate-server.js +6 -1
- package/dist/src/commands/generate-server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/commands/generate-server.ts +6 -1
- package/tsconfig.json +1 -1
- package/dist/src/codegen/scaffoldFromSchema.integration.specs.d.ts +0 -2
- package/dist/src/codegen/scaffoldFromSchema.integration.specs.d.ts.map +0 -1
- package/dist/src/codegen/scaffoldFromSchema.integration.specs.js +0 -59
- package/dist/src/codegen/scaffoldFromSchema.integration.specs.js.map +0 -1
package/package.json
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"graphql-type-json": "^0.3.2",
|
|
32
32
|
"uuid": "^11.0.0",
|
|
33
33
|
"web-streams-polyfill": "^4.1.0",
|
|
34
|
-
"@auto-engineer/
|
|
35
|
-
"@auto-engineer/
|
|
34
|
+
"@auto-engineer/message-bus": "0.16.0",
|
|
35
|
+
"@auto-engineer/narrative": "0.16.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"typescript": "^5.8.3",
|
|
44
44
|
"vitest": "^3.2.4",
|
|
45
45
|
"tsx": "^4.19.2",
|
|
46
|
-
"@auto-engineer/cli": "0.
|
|
46
|
+
"@auto-engineer/cli": "0.16.0"
|
|
47
47
|
},
|
|
48
|
-
"version": "0.
|
|
48
|
+
"version": "0.16.0",
|
|
49
49
|
"scripts": {
|
|
50
50
|
"generate:server": "tsx src/cli/index.ts",
|
|
51
51
|
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts && rm -rf dist/src/codegen/templates && mkdir -p dist/src/codegen && cp -r src/codegen/templates dist/src/codegen/templates && cp src/server.ts dist/src && cp -r src/utils dist/src && cp -r src/domain dist/src",
|
|
@@ -62,11 +62,16 @@ export type GenerateServerEvents = ServerGeneratedEvent | ServerGenerationFailed
|
|
|
62
62
|
|
|
63
63
|
export const commandHandler = defineCommandHandler({
|
|
64
64
|
name: 'GenerateServer',
|
|
65
|
+
displayName: 'Generate Server',
|
|
65
66
|
alias: 'generate:server',
|
|
66
67
|
description: 'Generate server from model',
|
|
67
68
|
category: 'generate',
|
|
68
69
|
icon: 'server',
|
|
69
|
-
events: [
|
|
70
|
+
events: [
|
|
71
|
+
{ name: 'ServerGenerated', displayName: 'Server Generated' },
|
|
72
|
+
{ name: 'ServerGenerationFailed', displayName: 'Server Generation Failed' },
|
|
73
|
+
{ name: 'SliceGenerated', displayName: 'Slice Generated' },
|
|
74
|
+
],
|
|
70
75
|
fields: {
|
|
71
76
|
modelPath: {
|
|
72
77
|
description: 'Path to the json model file',
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scaffoldFromSchema.integration.specs.d.ts","sourceRoot":"","sources":["../../../src/codegen/scaffoldFromSchema.integration.specs.ts"],"names":[],"mappings":""}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { mkdir, readdir, rm } from 'node:fs/promises';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
|
-
import { describe, it } from 'vitest';
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
async function findTestFiles(dir) {
|
|
8
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
9
|
-
const testFiles = [];
|
|
10
|
-
for (const entry of entries) {
|
|
11
|
-
const fullPath = path.join(dir, entry.name);
|
|
12
|
-
if (entry.isDirectory()) {
|
|
13
|
-
testFiles.push(...(await findTestFiles(fullPath)));
|
|
14
|
-
}
|
|
15
|
-
else if (entry.name.endsWith('.specs.ts')) {
|
|
16
|
-
testFiles.push(fullPath);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return testFiles;
|
|
20
|
-
}
|
|
21
|
-
describe.skip('generateServer integration test', { timeout: 20000 }, () => {
|
|
22
|
-
it('should scaffold a working server with valid TS and passing tests', async () => {
|
|
23
|
-
const tmpDir = path.resolve(__dirname, '../../.tmp/server-test-output');
|
|
24
|
-
const specPath = path.resolve(__dirname, './test-data/specVariant1.json');
|
|
25
|
-
await rm(tmpDir, { recursive: true, force: true });
|
|
26
|
-
await mkdir(tmpDir, { recursive: true });
|
|
27
|
-
await execa('pnpm', ['generate:server', specPath, tmpDir], {
|
|
28
|
-
cwd: path.resolve(__dirname, '../../'),
|
|
29
|
-
});
|
|
30
|
-
const serverDir = path.join(tmpDir, 'server');
|
|
31
|
-
const tsconfigPath = path.join(serverDir, 'tsconfig.json');
|
|
32
|
-
const testFiles = await findTestFiles(serverDir);
|
|
33
|
-
if (testFiles.length === 0) {
|
|
34
|
-
throw new Error(`❌ No test files found in: ${serverDir}`);
|
|
35
|
-
}
|
|
36
|
-
const typecheck = await execa('npx', ['tsc', '--noEmit', '-p', tsconfigPath], {
|
|
37
|
-
cwd: serverDir,
|
|
38
|
-
reject: false,
|
|
39
|
-
});
|
|
40
|
-
if (typecheck.exitCode !== 0) {
|
|
41
|
-
console.error('❌ TypeScript errors:\n', typecheck.stderr || typecheck.stdout);
|
|
42
|
-
throw new Error('❌ TypeScript type-check failed');
|
|
43
|
-
}
|
|
44
|
-
const testResult = await execa('npx', ['vitest', 'run', '--dir', serverDir], {
|
|
45
|
-
reject: false,
|
|
46
|
-
});
|
|
47
|
-
const output = `${testResult.stdout}\n${testResult.stderr}`;
|
|
48
|
-
const notYetImplementedMatches = output.match(/Not yet implemented: \w+/g) ?? [];
|
|
49
|
-
const otherFailures = output.includes('FAIL') && !output.includes('Not yet implemented') ? output : '';
|
|
50
|
-
if (testResult.exitCode !== 0 && otherFailures) {
|
|
51
|
-
throw new Error(`❌ Unexpected test failures:\n${otherFailures}`);
|
|
52
|
-
}
|
|
53
|
-
if (notYetImplementedMatches.length > 0) {
|
|
54
|
-
console.warn(`ℹ️ Ignored test files awaiting implementation:\n${notYetImplementedMatches.join('\n')}`);
|
|
55
|
-
}
|
|
56
|
-
await rm(tmpDir, { recursive: true, force: true });
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=scaffoldFromSchema.integration.specs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scaffoldFromSchema.integration.specs.js","sourceRoot":"","sources":["../../../src/codegen/scaffoldFromSchema.integration.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,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