aleios-cloud / aleios-cloud/eventbridge-toolbox

🐛 Can't run npx schema-generator due to missing types which should be exported by eventbridge-toolbox

Abierto
#46 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
10
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Description**
When using eventbridge-toolbox-schema-generator's `npx schema-generator` command, I receive an error indicating that the types module from eventbridge-toolbox cannot be found.

**Expected Behaviour**
Schemas generated and added to the event catalog successfully

**Current Behaviour**
Throw's the following error:
```
Found testContract1. ts
/Users/solomonparker/wizzair/platform-demo/node_modules/.pnpm/ts-json-schema-generator@1.4.0/node_modules/ts-json-schema-generator/dist/factory/program…js:89
throw new DiagnosticError_1.DiagnosticError (diagnostics);
DiagnosticError: Cannot find module 'src/classes/types'
or its corresponding
type declarations.
at createProgram (/Users/solomonparker/wizzair/platform-demo/node_modules/_pnpm/ts-json-schema-generator@1.4.0/node_modules/ts-json-schema-generator/dist/f
actory/program. js:89:19)
at createGenerator (/Users/solomonparker/wizzair/platform-demo/node_modules/_pnpm/ts-json-schema-generator@1.4.0/node_modules/ts-json-schema-generator/dist /factory/generator.js:9:49)
at file:///Users/solomonparker/wizzair/platform-demo/node_modules/_pnpm/@aleios-cloud+eventbridge-toolbox-schema-generator@0.0.5/node_modules/@aleios-cloud
/eventbridge-toolbox-schema-generator/dist/generate-docs-js:47:28
at Array.forEach ()
at file:///Users/solomonparker/wizzair/platform-demo/node_modules/_pnpm/@aleios-cloud+eventbridge-toolbox-schema-generator@0.0.5/node_modules/@aleios-cloud
/eventbridge-toolbox-schema-generator/dist/generate-docs-js:20:14
at FReqCallback.oncomplete (node: fs:200:23)
```

**Reproduction Steps**

1. Install eventbridge toolbox and eventbridge toolbox schema generator as project dependencies (also had to install ts-json-schema-generator which should be a dependency in eventbridge-toolbox-scehma-generator)
2. Create a directory containing `.ts` files which export contracts (interfaces extending the Contract type from eventbridge-toolbox)
3. Run `npx @eventcatalog/create-eventcatalog@latest demo-event-catalog`
4. Remove the example events from the events folder, as well as everything in the services and domains folders
5. Run `npx schema-generator `

**Possible Solution**
Amend the tsconfig in eventbridge-toolbox to ensure that types are packaged correctly. This may be easier if the example-architecture was in a separate repo or if the eventbridge-toolbox repo was restructured as a monorepo; this would also have helped catch this issue earlier.

**Additional Context**
Contracts used when the issue was encountered:

```
import { Contract } from "@aleios-cloud/eventbridge-toolbox";

export interface testContract extends Contract {
detail: {
"detail-version": 1;
data: { message: string; name: string };
};
"detail-type": "testContractDetail";
}
```

```
import { Contract } from "@aleios-cloud/eventbridge-toolbox";

export interface testContract extends Contract {
detail: {
"detail-version": 2;
data: { message: string; name: string };
};
"detail-type": "testContractDetail";
}
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.