@corpdk/codegen-cli 2026.10.0-alpha.1 → 2026.10.0-alpha.13
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/README.md +44 -0
- package/dist/gen-cli.d.ts +3 -0
- package/dist/gen-info.d.ts +2 -0
- package/dist/gen-man.d.ts +2 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.js +1 -1
- package/dist/schema-utils.d.ts +24 -0
- package/package.json +18 -4
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @corpdk/codegen-cli
|
|
2
|
+
|
|
3
|
+
GraphQL Code Generator **preset** that emits resolver typings and a TypedDocumentNode SDK aligned with CorpDK data services.
|
|
4
|
+
|
|
5
|
+
Configure it in your `codegen.ts` (or `codegen.yml`) alongside `@graphql-codegen/cli`. DAL DS apps run this after `dal-codegen` schema generation.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add -D @corpdk/codegen-cli
|
|
11
|
+
# or
|
|
12
|
+
npm install --save-dev @corpdk/codegen-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Peer dependency: `graphql` ^16.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import type { CodegenConfig } from "@graphql-codegen/cli";
|
|
21
|
+
|
|
22
|
+
const config: CodegenConfig = {
|
|
23
|
+
schema: "./src/generated/generated-schema.ts",
|
|
24
|
+
generates: {
|
|
25
|
+
"../ds-sdk/src/": {
|
|
26
|
+
preset: "@corpdk/codegen-cli",
|
|
27
|
+
// …preset options from templates/ds-sdk
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default config;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See [`templates/ds-sdk/codegen.ts`](https://github.com/CorpDK/coding-templates/blob/main/templates/ds-sdk/codegen.ts) in the monorepo for the canonical setup.
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
- Package source: [`libraries/codegen-cli`](https://github.com/CorpDK/coding-templates/tree/main/libraries/codegen-cli)
|
|
40
|
+
- [Monorepo overview](https://github.com/CorpDK/coding-templates/blob/main/docs/developer/01-monorepo-overview.md)
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT — see the [repository LICENSE](https://github.com/CorpDK/coding-templates/blob/main/LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { Types } from
|
|
2
|
-
|
|
3
|
-
interface Config {
|
|
1
|
+
import type { Types } from "@graphql-codegen/plugin-helpers";
|
|
2
|
+
export interface Config {
|
|
4
3
|
/** Name of the env var that holds the HTTP endpoint. Default: DS_HTTP_URL */
|
|
5
4
|
httpUrlEnvVar?: string;
|
|
6
5
|
/** Name of the env var that holds the WebSocket endpoint. Default: DS_WS_URL */
|
|
7
6
|
wsUrlEnvVar?: string;
|
|
8
7
|
}
|
|
9
|
-
declare const preset: Types.OutputPreset<Config>;
|
|
10
|
-
|
|
11
|
-
export { type Config, preset };
|
|
8
|
+
export declare const preset: Types.OutputPreset<Config>;
|
package/dist/index.js
CHANGED
|
@@ -354,7 +354,7 @@ function generateCli(ops, config) {
|
|
|
354
354
|
"#!/usr/bin/env node",
|
|
355
355
|
"// @generated \u2014 do not edit manually",
|
|
356
356
|
"// Regenerate by running: pnpm codegen (in your DS package)",
|
|
357
|
-
"// Requires Node
|
|
357
|
+
"// Requires Node 24+ (fetch, WebSocket)",
|
|
358
358
|
"",
|
|
359
359
|
'import { parseArgs } from "node:util";',
|
|
360
360
|
'import { readFileSync } from "node:fs";',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type GraphQLSchema } from "graphql";
|
|
2
|
+
export type OperationType = "query" | "mutation" | "subscription";
|
|
3
|
+
export interface ArgDescriptor {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Full GraphQL type string, e.g. "ID!", "String", "[Item!]!" */
|
|
6
|
+
graphqlType: string;
|
|
7
|
+
/** Type for node:util parseArgs — scalars other than Boolean become "string" */
|
|
8
|
+
parseType: "string" | "boolean";
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface OperationDescriptor {
|
|
13
|
+
operationType: OperationType;
|
|
14
|
+
/** camelCase field name from the schema, e.g. "createItem" */
|
|
15
|
+
fieldName: string;
|
|
16
|
+
/** kebab-case command name for the CLI, e.g. "create-item" */
|
|
17
|
+
commandName: string;
|
|
18
|
+
description: string;
|
|
19
|
+
args: ArgDescriptor[];
|
|
20
|
+
/** Ready-to-execute GraphQL document string */
|
|
21
|
+
document: string;
|
|
22
|
+
}
|
|
23
|
+
/** Extract all query/mutation/subscription operations from a GraphQLSchema. */
|
|
24
|
+
export declare function extractOperations(schema: GraphQLSchema): OperationDescriptor[];
|
package/package.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corpdk/codegen-cli",
|
|
3
|
-
"version": "2026.10.0-alpha.
|
|
3
|
+
"version": "2026.10.0-alpha.13",
|
|
4
|
+
"description": "GraphQL Code Generator plugin for resolver types and TypedDocumentNode SDK output",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"registry": "https://registry.npmjs.org/",
|
|
7
8
|
"access": "public"
|
|
8
9
|
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/CorpDK/coding-templates.git",
|
|
13
|
+
"directory": "libraries/codegen-cli"
|
|
14
|
+
},
|
|
9
15
|
"files": [
|
|
10
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
11
18
|
],
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
12
20
|
"main": "./dist/index.js",
|
|
13
21
|
"exports": {
|
|
14
|
-
".":
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
15
26
|
},
|
|
16
27
|
"devDependencies": {
|
|
17
28
|
"@graphql-codegen/plugin-helpers": "^6.2.0",
|
|
@@ -23,8 +34,11 @@
|
|
|
23
34
|
"graphql": "^16.0.0"
|
|
24
35
|
},
|
|
25
36
|
"license": "MIT",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=24.0.0"
|
|
39
|
+
},
|
|
26
40
|
"scripts": {
|
|
27
|
-
"build": "tsup src/index.ts --format esm --
|
|
41
|
+
"build": "tsup src/index.ts --format esm && pnpm exec tsc -p tsconfig.json --emitDeclarationOnly",
|
|
28
42
|
"clean": "rm -rf dist node_modules .turbo *.tsbuildinfo"
|
|
29
43
|
}
|
|
30
44
|
}
|