37b986aa4b
## What Vendors a narrowed copy of [`@genql/cli@3.0.5`](https://github.com/remorses/genql) (MIT) into `packages/twenty-client-sdk/src/generate/genql/` and repoints the two client generators at it, then removes `@genql/cli` from `twenty-client-sdk`, `twenty-sdk` and `create-twenty-app`. ## Why `@genql/cli` was used **only** to generate the typed GraphQL client from an SDL string. It is unmaintained and pulls in vulnerable/abandoned transitives — `undici@5` (**30 Dependabot alerts**), `native-fetch`, `listr`, `yargs`, etc. None of these were ever executed by Twenty: the sole consumer of `undici`/`native-fetch` is `@genql/cli`'s live-endpoint schema-introspection path, and Twenty always passes a schema string, never an endpoint. Removing the package eliminates the dependency at the source — for Twenty and for scaffolded end-user apps. ## What changed vs upstream The vendored copy (`genql/README.md` + `genql/LICENSE`) keeps the `render/` and `runtime/` trees verbatim and narrows the orchestration: - **Dropped the endpoint/introspection path** (`schema/fetchSchema.ts`) — the only `undici`/`native-fetch`/`qs` consumer. - **Dropped `listr`** — generation tasks run as plain sequential `async` functions (file contents unchanged). - **Replaced `fs-extra`/`mkdirp`/`rimraf`** with `node:fs`. - **Runtime templates are imported as `?raw`** and bundled, instead of read from `node_modules` at generation time. - **Kept `prettier@^2.8` and `@graphql-tools/*`** so the generated output is byte-for-byte identical. ## Verification - **Byte-identical output**: regenerating the metadata client from its committed schema produces a recursive-diff-clean result vs the previous `@genql/cli` output (including the copied `runtime/` folder). The core client generates and esbuild-bundles cleanly. - The public `twenty-client-sdk/generate` barrel API is unchanged (twenty-server / twenty-sdk consumers unaffected). - `undici@^5`, `native-fetch`, `@genql/cli`, `listr`, `yargs@^15` and `subscriptions-transport-ws@0.9` are gone from `yarn.lock` (net −364 lines). - `twenty-client-sdk` and `twenty-sdk` typecheck, lint and build; `twenty-client-sdk` tests pass (9/9). ## Notes - The vendored folder is excluded from `oxlint`/`oxfmt` (it is third-party code, with `@ts-nocheck` on the verbatim renderers, mirroring the generated output). - Stacks conceptually on #21334 (drops `@genql/runtime`); the two are independent and only overlap trivially in `yarn.lock`. `@genql/runtime` is intentionally left for that PR.
38 lines
983 B
TypeScript
38 lines
983 B
TypeScript
// @ts-nocheck
|
|
import { GraphQLArgument, GraphQLEnumValue, GraphQLField, GraphQLInputField, GraphQLNamedType } from 'graphql'
|
|
|
|
|
|
export const comment = (comment: { text?: string | null; deprecated?: string | null }) => {
|
|
const lines: string[] = []
|
|
|
|
if (comment.deprecated) {
|
|
lines.push(`@deprecated ${comment.deprecated.replace(/\s/g, ' ')}`)
|
|
}
|
|
|
|
if (comment.text) {
|
|
lines.push(...comment.text.split('\n'))
|
|
}
|
|
|
|
return lines.length > 0
|
|
? lines.length === 1
|
|
? `\n/** ${lines[0]} */\n`
|
|
: `\n/**\n${lines.map(l => ` * ${l}`).join('\n')}\n */\n`
|
|
: ''
|
|
}
|
|
|
|
export const typeComment = (type: GraphQLNamedType) =>
|
|
comment({
|
|
text: type.description,
|
|
})
|
|
|
|
export const fieldComment = (field: GraphQLEnumValue | GraphQLField<any, any, any>) =>
|
|
comment({
|
|
deprecated: field.deprecationReason,
|
|
text: field.description,
|
|
})
|
|
|
|
export const argumentComment = (arg: GraphQLArgument | GraphQLInputField) =>
|
|
comment({
|
|
text: arg.description,
|
|
})
|