@constructive-io/graphql-codegen 2.32.0 → 3.0.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/README.md +429 -1691
- package/cli/index.d.ts +5 -2
- package/cli/index.js +98 -581
- package/cli/shared.d.ts +35 -0
- package/cli/shared.js +106 -0
- package/{esm/cli → core}/codegen/barrel.d.ts +1 -1
- package/{cli → core}/codegen/barrel.js +1 -4
- package/{esm/cli → core}/codegen/index.d.ts +15 -5
- package/{cli → core}/codegen/index.js +44 -24
- package/{cli → core}/codegen/invalidation.d.ts +2 -2
- package/{esm/cli → core}/codegen/mutation-keys.d.ts +2 -2
- package/{cli → core}/codegen/orm/client-generator.js +2 -3
- package/{esm/cli → core}/codegen/orm/index.d.ts +9 -2
- package/{cli → core}/codegen/orm/index.js +3 -2
- package/{cli → core}/codegen/query-keys.d.ts +2 -2
- package/core/codegen/shared/index.d.ts +39 -0
- package/core/codegen/shared/index.js +118 -0
- package/core/config/index.d.ts +5 -0
- package/core/config/index.js +13 -0
- package/core/config/loader.d.ts +18 -0
- package/{cli/commands/init.js → core/config/loader.js} +7 -94
- package/core/config/resolver.d.ts +46 -0
- package/core/config/resolver.js +104 -0
- package/core/database/index.d.ts +43 -0
- package/core/database/index.js +85 -0
- package/core/generate.d.ts +22 -0
- package/core/generate.js +192 -0
- package/core/index.d.ts +13 -1
- package/core/index.js +22 -2
- package/{cli → core}/introspect/fetch-schema.js +58 -9
- package/core/introspect/source/api-schemas.d.ts +44 -0
- package/core/introspect/source/api-schemas.js +122 -0
- package/core/introspect/source/database.d.ts +32 -0
- package/core/introspect/source/database.js +91 -0
- package/core/introspect/source/index.d.ts +112 -0
- package/core/introspect/source/index.js +173 -0
- package/core/introspect/source/pgpm-module.d.ts +83 -0
- package/core/introspect/source/pgpm-module.js +200 -0
- package/core/output/index.d.ts +4 -0
- package/core/output/index.js +9 -0
- package/core/output/writer.d.ts +38 -0
- package/core/output/writer.js +156 -0
- package/{cli/commands/shared.d.ts → core/pipeline/index.d.ts} +5 -3
- package/{cli/commands/shared.js → core/pipeline/index.js} +4 -0
- package/{cli → core}/watch/orchestrator.d.ts +25 -3
- package/{cli → core}/watch/orchestrator.js +35 -27
- package/{cli → core}/watch/types.d.ts +1 -1
- package/esm/cli/index.d.ts +5 -2
- package/esm/cli/index.js +97 -547
- package/esm/cli/shared.d.ts +35 -0
- package/esm/cli/shared.js +101 -0
- package/{cli → esm/core}/codegen/barrel.d.ts +1 -1
- package/esm/{cli → core}/codegen/barrel.js +1 -4
- package/{cli → esm/core}/codegen/index.d.ts +15 -5
- package/esm/{cli → core}/codegen/index.js +44 -24
- package/esm/{cli → core}/codegen/invalidation.d.ts +2 -2
- package/{cli → esm/core}/codegen/mutation-keys.d.ts +2 -2
- package/esm/{cli → core}/codegen/orm/client-generator.js +2 -3
- package/{cli → esm/core}/codegen/orm/index.d.ts +9 -2
- package/esm/{cli → core}/codegen/orm/index.js +3 -2
- package/esm/{cli → core}/codegen/query-keys.d.ts +2 -2
- package/esm/core/codegen/shared/index.d.ts +39 -0
- package/esm/core/codegen/shared/index.js +79 -0
- package/esm/core/config/index.d.ts +5 -0
- package/esm/core/config/index.js +5 -0
- package/esm/core/config/loader.d.ts +18 -0
- package/esm/core/config/loader.js +71 -0
- package/esm/core/config/resolver.d.ts +46 -0
- package/esm/core/config/resolver.js +100 -0
- package/esm/core/database/index.d.ts +43 -0
- package/esm/core/database/index.js +48 -0
- package/esm/core/generate.d.ts +22 -0
- package/esm/core/generate.js +186 -0
- package/esm/core/index.d.ts +13 -1
- package/esm/core/index.js +20 -1
- package/esm/{cli → core}/introspect/fetch-schema.js +55 -9
- package/esm/core/introspect/source/api-schemas.d.ts +44 -0
- package/esm/core/introspect/source/api-schemas.js +117 -0
- package/esm/core/introspect/source/database.d.ts +32 -0
- package/esm/core/introspect/source/database.js +87 -0
- package/esm/core/introspect/source/index.d.ts +112 -0
- package/esm/core/introspect/source/index.js +154 -0
- package/esm/core/introspect/source/pgpm-module.d.ts +83 -0
- package/esm/core/introspect/source/pgpm-module.js +194 -0
- package/esm/core/output/index.d.ts +4 -0
- package/esm/core/output/index.js +4 -0
- package/esm/core/output/writer.d.ts +38 -0
- package/esm/core/output/writer.js +119 -0
- package/esm/{cli/commands/shared.d.ts → core/pipeline/index.d.ts} +5 -3
- package/esm/{cli/commands/shared.js → core/pipeline/index.js} +1 -0
- package/esm/{cli → core}/watch/orchestrator.d.ts +25 -3
- package/esm/{cli → core}/watch/orchestrator.js +35 -27
- package/esm/{cli → core}/watch/types.d.ts +1 -1
- package/esm/index.d.ts +8 -3
- package/esm/index.js +9 -3
- package/esm/types/config.d.ts +101 -138
- package/esm/types/config.js +8 -35
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.js +1 -1
- package/index.d.ts +8 -3
- package/index.js +18 -8
- package/package.json +18 -11
- package/types/config.d.ts +101 -138
- package/types/config.js +9 -38
- package/types/index.d.ts +2 -2
- package/types/index.js +3 -3
- package/cli/commands/generate-orm.d.ts +0 -53
- package/cli/commands/generate-orm.js +0 -292
- package/cli/commands/generate.d.ts +0 -66
- package/cli/commands/generate.js +0 -431
- package/cli/commands/index.d.ts +0 -9
- package/cli/commands/index.js +0 -14
- package/cli/commands/init.d.ts +0 -35
- package/cli/introspect/source/index.d.ts +0 -48
- package/cli/introspect/source/index.js +0 -72
- package/esm/cli/commands/generate-orm.d.ts +0 -53
- package/esm/cli/commands/generate-orm.js +0 -289
- package/esm/cli/commands/generate.d.ts +0 -66
- package/esm/cli/commands/generate.js +0 -393
- package/esm/cli/commands/index.d.ts +0 -9
- package/esm/cli/commands/index.js +0 -6
- package/esm/cli/commands/init.d.ts +0 -35
- package/esm/cli/commands/init.js +0 -158
- package/esm/cli/introspect/source/index.d.ts +0 -48
- package/esm/cli/introspect/source/index.js +0 -54
- /package/{cli → core}/codegen/babel-ast.d.ts +0 -0
- /package/{cli → core}/codegen/babel-ast.js +0 -0
- /package/{cli → core}/codegen/client.d.ts +0 -0
- /package/{cli → core}/codegen/client.js +0 -0
- /package/{cli → core}/codegen/custom-mutations.d.ts +0 -0
- /package/{cli → core}/codegen/custom-mutations.js +0 -0
- /package/{cli → core}/codegen/custom-queries.d.ts +0 -0
- /package/{cli → core}/codegen/custom-queries.js +0 -0
- /package/{cli → core}/codegen/gql-ast.d.ts +0 -0
- /package/{cli → core}/codegen/gql-ast.js +0 -0
- /package/{cli → core}/codegen/invalidation.js +0 -0
- /package/{cli → core}/codegen/mutation-keys.js +0 -0
- /package/{cli → core}/codegen/mutations.d.ts +0 -0
- /package/{cli → core}/codegen/mutations.js +0 -0
- /package/{cli → core}/codegen/orm/barrel.d.ts +0 -0
- /package/{cli → core}/codegen/orm/barrel.js +0 -0
- /package/{cli → core}/codegen/orm/client-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/client.d.ts +0 -0
- /package/{cli → core}/codegen/orm/client.js +0 -0
- /package/{cli → core}/codegen/orm/custom-ops-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/custom-ops-generator.js +0 -0
- /package/{cli → core}/codegen/orm/input-types-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/input-types-generator.js +0 -0
- /package/{cli → core}/codegen/orm/model-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/model-generator.js +0 -0
- /package/{cli → core}/codegen/orm/query-builder.d.ts +0 -0
- /package/{cli → core}/codegen/orm/query-builder.js +0 -0
- /package/{cli → core}/codegen/orm/query-builder.ts +0 -0
- /package/{cli → core}/codegen/orm/select-types.d.ts +0 -0
- /package/{cli → core}/codegen/orm/select-types.js +0 -0
- /package/{cli → core}/codegen/queries.d.ts +0 -0
- /package/{cli → core}/codegen/queries.js +0 -0
- /package/{cli → core}/codegen/query-keys.js +0 -0
- /package/{cli → core}/codegen/scalars.d.ts +0 -0
- /package/{cli → core}/codegen/scalars.js +0 -0
- /package/{cli → core}/codegen/schema-gql-ast.d.ts +0 -0
- /package/{cli → core}/codegen/schema-gql-ast.js +0 -0
- /package/{cli → core}/codegen/schema-types-generator.d.ts +0 -0
- /package/{cli → core}/codegen/schema-types-generator.js +0 -0
- /package/{cli → core}/codegen/type-resolver.d.ts +0 -0
- /package/{cli → core}/codegen/type-resolver.js +0 -0
- /package/{cli → core}/codegen/types.d.ts +0 -0
- /package/{cli → core}/codegen/types.js +0 -0
- /package/{cli → core}/codegen/utils.d.ts +0 -0
- /package/{cli → core}/codegen/utils.js +0 -0
- /package/{cli → core}/introspect/fetch-schema.d.ts +0 -0
- /package/{cli → core}/introspect/index.d.ts +0 -0
- /package/{cli → core}/introspect/index.js +0 -0
- /package/{cli → core}/introspect/infer-tables.d.ts +0 -0
- /package/{cli → core}/introspect/infer-tables.js +0 -0
- /package/{cli → core}/introspect/schema-query.d.ts +0 -0
- /package/{cli → core}/introspect/schema-query.js +0 -0
- /package/{cli → core}/introspect/source/endpoint.d.ts +0 -0
- /package/{cli → core}/introspect/source/endpoint.js +0 -0
- /package/{cli → core}/introspect/source/file.d.ts +0 -0
- /package/{cli → core}/introspect/source/file.js +0 -0
- /package/{cli → core}/introspect/source/types.d.ts +0 -0
- /package/{cli → core}/introspect/source/types.js +0 -0
- /package/{cli → core}/introspect/transform-schema.d.ts +0 -0
- /package/{cli → core}/introspect/transform-schema.js +0 -0
- /package/{cli → core}/introspect/transform.d.ts +0 -0
- /package/{cli → core}/introspect/transform.js +0 -0
- /package/{cli → core}/watch/cache.d.ts +0 -0
- /package/{cli → core}/watch/cache.js +0 -0
- /package/{cli → core}/watch/debounce.d.ts +0 -0
- /package/{cli → core}/watch/debounce.js +0 -0
- /package/{cli → core}/watch/hash.d.ts +0 -0
- /package/{cli → core}/watch/hash.js +0 -0
- /package/{cli → core}/watch/index.d.ts +0 -0
- /package/{cli → core}/watch/index.js +0 -0
- /package/{cli → core}/watch/poller.d.ts +0 -0
- /package/{cli → core}/watch/poller.js +0 -0
- /package/{cli → core}/watch/types.js +0 -0
- /package/esm/{cli → core}/codegen/babel-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/babel-ast.js +0 -0
- /package/esm/{cli → core}/codegen/client.d.ts +0 -0
- /package/esm/{cli → core}/codegen/client.js +0 -0
- /package/esm/{cli → core}/codegen/custom-mutations.d.ts +0 -0
- /package/esm/{cli → core}/codegen/custom-mutations.js +0 -0
- /package/esm/{cli → core}/codegen/custom-queries.d.ts +0 -0
- /package/esm/{cli → core}/codegen/custom-queries.js +0 -0
- /package/esm/{cli → core}/codegen/gql-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/gql-ast.js +0 -0
- /package/esm/{cli → core}/codegen/invalidation.js +0 -0
- /package/esm/{cli → core}/codegen/mutation-keys.js +0 -0
- /package/esm/{cli → core}/codegen/mutations.d.ts +0 -0
- /package/esm/{cli → core}/codegen/mutations.js +0 -0
- /package/esm/{cli → core}/codegen/orm/barrel.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/barrel.js +0 -0
- /package/esm/{cli → core}/codegen/orm/client-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/client.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/client.js +0 -0
- /package/esm/{cli → core}/codegen/orm/custom-ops-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/custom-ops-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/input-types-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/input-types-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/model-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/model-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/query-builder.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/query-builder.js +0 -0
- /package/esm/{cli → core}/codegen/orm/select-types.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/select-types.js +0 -0
- /package/esm/{cli → core}/codegen/queries.d.ts +0 -0
- /package/esm/{cli → core}/codegen/queries.js +0 -0
- /package/esm/{cli → core}/codegen/query-keys.js +0 -0
- /package/esm/{cli → core}/codegen/scalars.d.ts +0 -0
- /package/esm/{cli → core}/codegen/scalars.js +0 -0
- /package/esm/{cli → core}/codegen/schema-gql-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/schema-gql-ast.js +0 -0
- /package/esm/{cli → core}/codegen/schema-types-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/schema-types-generator.js +0 -0
- /package/esm/{cli → core}/codegen/type-resolver.d.ts +0 -0
- /package/esm/{cli → core}/codegen/type-resolver.js +0 -0
- /package/esm/{cli → core}/codegen/types.d.ts +0 -0
- /package/esm/{cli → core}/codegen/types.js +0 -0
- /package/esm/{cli → core}/codegen/utils.d.ts +0 -0
- /package/esm/{cli → core}/codegen/utils.js +0 -0
- /package/esm/{cli → core}/introspect/fetch-schema.d.ts +0 -0
- /package/esm/{cli → core}/introspect/index.d.ts +0 -0
- /package/esm/{cli → core}/introspect/index.js +0 -0
- /package/esm/{cli → core}/introspect/infer-tables.d.ts +0 -0
- /package/esm/{cli → core}/introspect/infer-tables.js +0 -0
- /package/esm/{cli → core}/introspect/schema-query.d.ts +0 -0
- /package/esm/{cli → core}/introspect/schema-query.js +0 -0
- /package/esm/{cli → core}/introspect/source/endpoint.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/endpoint.js +0 -0
- /package/esm/{cli → core}/introspect/source/file.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/file.js +0 -0
- /package/esm/{cli → core}/introspect/source/types.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/types.js +0 -0
- /package/esm/{cli → core}/introspect/transform-schema.d.ts +0 -0
- /package/esm/{cli → core}/introspect/transform-schema.js +0 -0
- /package/esm/{cli → core}/introspect/transform.d.ts +0 -0
- /package/esm/{cli → core}/introspect/transform.js +0 -0
- /package/esm/{cli → core}/watch/cache.d.ts +0 -0
- /package/esm/{cli → core}/watch/cache.js +0 -0
- /package/esm/{cli → core}/watch/debounce.d.ts +0 -0
- /package/esm/{cli → core}/watch/debounce.js +0 -0
- /package/esm/{cli → core}/watch/hash.d.ts +0 -0
- /package/esm/{cli → core}/watch/hash.js +0 -0
- /package/esm/{cli → core}/watch/index.d.ts +0 -0
- /package/esm/{cli → core}/watch/index.js +0 -0
- /package/esm/{cli → core}/watch/poller.d.ts +0 -0
- /package/esm/{cli → core}/watch/poller.js +0 -0
- /package/esm/{cli → core}/watch/types.js +0 -0
package/cli/shared.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI utilities for graphql-codegen
|
|
3
|
+
*
|
|
4
|
+
* These are exported so that packages/cli can use the same questions
|
|
5
|
+
* and types, ensuring consistency between the two CLIs.
|
|
6
|
+
*/
|
|
7
|
+
import type { Question } from 'inquirerer';
|
|
8
|
+
import type { GenerateResult } from '../core/generate';
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize function that splits comma-separated strings into arrays
|
|
11
|
+
*/
|
|
12
|
+
export declare const splitCommas: (input: string | undefined) => string[] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Interface for codegen CLI answers
|
|
15
|
+
*/
|
|
16
|
+
export interface CodegenAnswers {
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
schemaFile?: string;
|
|
19
|
+
output?: string;
|
|
20
|
+
schemas?: string[];
|
|
21
|
+
apiNames?: string[];
|
|
22
|
+
reactQuery?: boolean;
|
|
23
|
+
orm?: boolean;
|
|
24
|
+
authorization?: string;
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
verbose?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Questions for the codegen CLI
|
|
30
|
+
*/
|
|
31
|
+
export declare const codegenQuestions: Question[];
|
|
32
|
+
/**
|
|
33
|
+
* Print the result of a generate operation
|
|
34
|
+
*/
|
|
35
|
+
export declare function printResult(result: GenerateResult): void;
|
package/cli/shared.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codegenQuestions = exports.splitCommas = void 0;
|
|
4
|
+
exports.printResult = printResult;
|
|
5
|
+
/**
|
|
6
|
+
* Sanitize function that splits comma-separated strings into arrays
|
|
7
|
+
*/
|
|
8
|
+
const splitCommas = (input) => {
|
|
9
|
+
if (!input)
|
|
10
|
+
return undefined;
|
|
11
|
+
return input.split(',').map((s) => s.trim()).filter(Boolean);
|
|
12
|
+
};
|
|
13
|
+
exports.splitCommas = splitCommas;
|
|
14
|
+
/**
|
|
15
|
+
* Questions for the codegen CLI
|
|
16
|
+
*/
|
|
17
|
+
exports.codegenQuestions = [
|
|
18
|
+
{
|
|
19
|
+
name: 'endpoint',
|
|
20
|
+
message: 'GraphQL endpoint URL',
|
|
21
|
+
type: 'text',
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'schemaFile',
|
|
26
|
+
message: 'Path to GraphQL schema file',
|
|
27
|
+
type: 'text',
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'output',
|
|
32
|
+
message: 'Output directory',
|
|
33
|
+
type: 'text',
|
|
34
|
+
required: false,
|
|
35
|
+
default: 'codegen',
|
|
36
|
+
useDefault: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'schemas',
|
|
40
|
+
message: 'PostgreSQL schemas (comma-separated)',
|
|
41
|
+
type: 'text',
|
|
42
|
+
required: false,
|
|
43
|
+
sanitize: exports.splitCommas,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'apiNames',
|
|
47
|
+
message: 'API names (comma-separated)',
|
|
48
|
+
type: 'text',
|
|
49
|
+
required: false,
|
|
50
|
+
sanitize: exports.splitCommas,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'reactQuery',
|
|
54
|
+
message: 'Generate React Query hooks?',
|
|
55
|
+
type: 'confirm',
|
|
56
|
+
required: false,
|
|
57
|
+
default: false,
|
|
58
|
+
useDefault: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'orm',
|
|
62
|
+
message: 'Generate ORM client?',
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
required: false,
|
|
65
|
+
default: false,
|
|
66
|
+
useDefault: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'authorization',
|
|
70
|
+
message: 'Authorization header value',
|
|
71
|
+
type: 'text',
|
|
72
|
+
required: false,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'dryRun',
|
|
76
|
+
message: 'Preview without writing files?',
|
|
77
|
+
type: 'confirm',
|
|
78
|
+
required: false,
|
|
79
|
+
default: false,
|
|
80
|
+
useDefault: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'verbose',
|
|
84
|
+
message: 'Verbose output?',
|
|
85
|
+
type: 'confirm',
|
|
86
|
+
required: false,
|
|
87
|
+
default: false,
|
|
88
|
+
useDefault: true,
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
/**
|
|
92
|
+
* Print the result of a generate operation
|
|
93
|
+
*/
|
|
94
|
+
function printResult(result) {
|
|
95
|
+
if (result.success) {
|
|
96
|
+
console.log('[ok]', result.message);
|
|
97
|
+
if (result.tables?.length) {
|
|
98
|
+
console.log('Tables:', result.tables.join(', '));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
console.error('x', result.message);
|
|
103
|
+
result.errors?.forEach((e) => console.error(' -', e));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -28,7 +28,7 @@ export interface MainBarrelOptions {
|
|
|
28
28
|
/** Whether invalidation.ts was generated */
|
|
29
29
|
hasInvalidation?: boolean;
|
|
30
30
|
}
|
|
31
|
-
export declare function generateMainBarrel(tables: CleanTable[], options?: MainBarrelOptions
|
|
31
|
+
export declare function generateMainBarrel(tables: CleanTable[], options?: MainBarrelOptions): string;
|
|
32
32
|
/**
|
|
33
33
|
* Generate queries barrel including custom query operations
|
|
34
34
|
*/
|
|
@@ -103,10 +103,7 @@ function generateMutationsBarrel(tables) {
|
|
|
103
103
|
return (0, babel_ast_1.generateCode)(statements);
|
|
104
104
|
}
|
|
105
105
|
function generateMainBarrel(tables, options = {}) {
|
|
106
|
-
|
|
107
|
-
const opts = typeof options === 'boolean'
|
|
108
|
-
? { hasSchemaTypes: options, hasMutations: true }
|
|
109
|
-
: options;
|
|
106
|
+
const opts = options;
|
|
110
107
|
const { hasSchemaTypes = false, hasMutations = true, hasQueryKeys = false, hasMutationKeys = false, hasInvalidation = false, } = opts;
|
|
111
108
|
const tableNames = tables.map((tbl) => tbl.name).join(', ');
|
|
112
109
|
const statements = [];
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* ...
|
|
25
25
|
*/
|
|
26
26
|
import type { CleanTable, CleanOperation, TypeRegistry } from '../../types/schema';
|
|
27
|
-
import type {
|
|
27
|
+
import type { GraphQLSDKConfigTarget } from '../../types/config';
|
|
28
28
|
export interface GeneratedFile {
|
|
29
29
|
/** Relative path from output directory */
|
|
30
30
|
path: string;
|
|
@@ -51,15 +51,25 @@ export interface GenerateOptions {
|
|
|
51
51
|
mutations: CleanOperation[];
|
|
52
52
|
typeRegistry: TypeRegistry;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
config:
|
|
54
|
+
/** Configuration */
|
|
55
|
+
config: GraphQLSDKConfigTarget;
|
|
56
|
+
/**
|
|
57
|
+
* Path to shared types directory (relative import path).
|
|
58
|
+
* When provided, types.ts and schema-types.ts are NOT generated
|
|
59
|
+
* and imports reference the shared types location instead.
|
|
60
|
+
* Example: '..' means types are in parent directory
|
|
61
|
+
*/
|
|
62
|
+
sharedTypesPath?: string;
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
|
-
* Generate all SDK files for tables only
|
|
65
|
+
* Generate all SDK files for tables only
|
|
59
66
|
*/
|
|
60
|
-
export declare function generateAllFiles(tables: CleanTable[], config:
|
|
67
|
+
export declare function generateAllFiles(tables: CleanTable[], config: GraphQLSDKConfigTarget): GenerateResult;
|
|
61
68
|
/**
|
|
62
69
|
* Generate all SDK files with full support for custom operations
|
|
70
|
+
*
|
|
71
|
+
* When sharedTypesPath is provided, types.ts and schema-types.ts are NOT generated
|
|
72
|
+
* (they're expected to exist in the shared types directory).
|
|
63
73
|
*/
|
|
64
74
|
export declare function generate(options: GenerateOptions): GenerateResult;
|
|
65
75
|
export { generateClientFile } from './client';
|
|
@@ -20,21 +20,24 @@ const utils_1 = require("./utils");
|
|
|
20
20
|
// Main orchestrator
|
|
21
21
|
// ============================================================================
|
|
22
22
|
/**
|
|
23
|
-
* Generate all SDK files for tables only
|
|
23
|
+
* Generate all SDK files for tables only
|
|
24
24
|
*/
|
|
25
25
|
function generateAllFiles(tables, config) {
|
|
26
26
|
return generate({ tables, config });
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Generate all SDK files with full support for custom operations
|
|
30
|
+
*
|
|
31
|
+
* When sharedTypesPath is provided, types.ts and schema-types.ts are NOT generated
|
|
32
|
+
* (they're expected to exist in the shared types directory).
|
|
30
33
|
*/
|
|
31
34
|
function generate(options) {
|
|
32
|
-
const { tables, customOperations, config } = options;
|
|
35
|
+
const { tables, customOperations, config, sharedTypesPath } = options;
|
|
33
36
|
const files = [];
|
|
34
37
|
// Extract codegen options
|
|
35
38
|
const maxDepth = config.codegen.maxFieldDepth;
|
|
36
39
|
const skipQueryField = config.codegen.skipQueryField;
|
|
37
|
-
const reactQueryEnabled = config.reactQuery
|
|
40
|
+
const reactQueryEnabled = config.reactQuery;
|
|
38
41
|
// Query key configuration (use defaults if not provided)
|
|
39
42
|
const queryKeyConfig = config.queryKeys ?? config_1.DEFAULT_QUERY_KEY_CONFIG;
|
|
40
43
|
const useCentralizedKeys = queryKeyConfig.generateScopedKeys;
|
|
@@ -46,32 +49,49 @@ function generate(options) {
|
|
|
46
49
|
});
|
|
47
50
|
// Collect table type names for import path resolution
|
|
48
51
|
const tableTypeNames = new Set(tables.map((t) => (0, utils_1.getTableNames)(t).typeName));
|
|
49
|
-
//
|
|
50
|
-
//
|
|
52
|
+
// When using shared types, skip generating types.ts and schema-types.ts
|
|
53
|
+
// They're already generated in the shared directory
|
|
51
54
|
let hasSchemaTypes = false;
|
|
52
55
|
let generatedEnumNames = [];
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (schemaTypesResult.content.split('\n').length > 10) {
|
|
60
|
-
files.push({
|
|
61
|
-
path: 'schema-types.ts',
|
|
62
|
-
content: schemaTypesResult.content,
|
|
56
|
+
if (sharedTypesPath) {
|
|
57
|
+
// Using shared types - check if schema-types would be generated
|
|
58
|
+
if (customOperations && customOperations.typeRegistry) {
|
|
59
|
+
const schemaTypesResult = (0, schema_types_generator_1.generateSchemaTypesFile)({
|
|
60
|
+
typeRegistry: customOperations.typeRegistry,
|
|
61
|
+
tableTypeNames,
|
|
63
62
|
});
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
if (schemaTypesResult.content.split('\n').length > 10) {
|
|
64
|
+
hasSchemaTypes = true;
|
|
65
|
+
generatedEnumNames = schemaTypesResult.generatedEnums || [];
|
|
66
|
+
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
else {
|
|
70
|
+
// 2. Generate schema-types.ts for custom operations (if any)
|
|
71
|
+
// NOTE: This must come BEFORE types.ts so that types.ts can import enum types
|
|
72
|
+
if (customOperations && customOperations.typeRegistry) {
|
|
73
|
+
const schemaTypesResult = (0, schema_types_generator_1.generateSchemaTypesFile)({
|
|
74
|
+
typeRegistry: customOperations.typeRegistry,
|
|
75
|
+
tableTypeNames,
|
|
76
|
+
});
|
|
77
|
+
// Only include if there's meaningful content
|
|
78
|
+
if (schemaTypesResult.content.split('\n').length > 10) {
|
|
79
|
+
files.push({
|
|
80
|
+
path: 'schema-types.ts',
|
|
81
|
+
content: schemaTypesResult.content,
|
|
82
|
+
});
|
|
83
|
+
hasSchemaTypes = true;
|
|
84
|
+
generatedEnumNames = schemaTypesResult.generatedEnums || [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// 3. Generate types.ts (can now import enums from schema-types)
|
|
88
|
+
files.push({
|
|
89
|
+
path: 'types.ts',
|
|
90
|
+
content: (0, types_1.generateTypesFile)(tables, {
|
|
91
|
+
enumsFromSchemaTypes: generatedEnumNames,
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
75
95
|
// 3b. Generate centralized query keys (query-keys.ts)
|
|
76
96
|
let hasQueryKeys = false;
|
|
77
97
|
if (useCentralizedKeys) {
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* for parent-child entity relationships.
|
|
6
6
|
*/
|
|
7
7
|
import type { CleanTable } from '../../types/schema';
|
|
8
|
-
import type {
|
|
8
|
+
import type { QueryKeyConfig } from '../../types/config';
|
|
9
9
|
export interface InvalidationGeneratorOptions {
|
|
10
10
|
tables: CleanTable[];
|
|
11
|
-
config:
|
|
11
|
+
config: QueryKeyConfig;
|
|
12
12
|
}
|
|
13
13
|
export interface GeneratedInvalidationFile {
|
|
14
14
|
fileName: string;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* - Tracking mutation state with useIsMutating
|
|
9
9
|
*/
|
|
10
10
|
import type { CleanTable, CleanOperation } from '../../types/schema';
|
|
11
|
-
import type {
|
|
11
|
+
import type { QueryKeyConfig } from '../../types/config';
|
|
12
12
|
export interface MutationKeyGeneratorOptions {
|
|
13
13
|
tables: CleanTable[];
|
|
14
14
|
customMutations: CleanOperation[];
|
|
15
|
-
config:
|
|
15
|
+
config: QueryKeyConfig;
|
|
16
16
|
}
|
|
17
17
|
export interface GeneratedMutationKeysFile {
|
|
18
18
|
fileName: string;
|
|
@@ -410,10 +410,9 @@ function generateCreateClientFile(tables, hasCustomQueries, hasCustomMutations)
|
|
|
410
410
|
], t.stringLiteral('./query-builder')));
|
|
411
411
|
// export * from './select-types';
|
|
412
412
|
statements.push(t.exportAllDeclaration(t.stringLiteral('./select-types')));
|
|
413
|
-
// Re-export all models
|
|
414
|
-
// export * from './models';
|
|
413
|
+
// Re-export all models
|
|
415
414
|
statements.push(t.exportAllDeclaration(t.stringLiteral('./models')));
|
|
416
|
-
// Re-export custom operations
|
|
415
|
+
// Re-export custom operations
|
|
417
416
|
if (hasCustomQueries) {
|
|
418
417
|
statements.push(t.exportNamedDeclaration(null, [
|
|
419
418
|
t.exportSpecifier(t.identifier('createQueryOperations'), t.identifier('createQueryOperations')),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and produces the complete ORM client output.
|
|
6
6
|
*/
|
|
7
7
|
import type { CleanTable, CleanOperation, TypeRegistry } from '../../../types/schema';
|
|
8
|
-
import type {
|
|
8
|
+
import type { GraphQLSDKConfigTarget } from '../../../types/config';
|
|
9
9
|
export interface GeneratedFile {
|
|
10
10
|
path: string;
|
|
11
11
|
content: string;
|
|
@@ -17,7 +17,14 @@ export interface GenerateOrmOptions {
|
|
|
17
17
|
mutations: CleanOperation[];
|
|
18
18
|
typeRegistry?: TypeRegistry;
|
|
19
19
|
};
|
|
20
|
-
config:
|
|
20
|
+
config: GraphQLSDKConfigTarget;
|
|
21
|
+
/**
|
|
22
|
+
* Path to shared types directory (relative import path).
|
|
23
|
+
* When provided, entity types are imported from shared types
|
|
24
|
+
* instead of being generated in input-types.ts.
|
|
25
|
+
* Example: '..' means types are in parent directory
|
|
26
|
+
*/
|
|
27
|
+
sharedTypesPath?: string;
|
|
21
28
|
}
|
|
22
29
|
export interface GenerateOrmResult {
|
|
23
30
|
files: GeneratedFile[];
|
|
@@ -11,9 +11,10 @@ const input_types_generator_1 = require("./input-types-generator");
|
|
|
11
11
|
* Generate all ORM client files
|
|
12
12
|
*/
|
|
13
13
|
function generateOrm(options) {
|
|
14
|
-
const { tables, customOperations,
|
|
14
|
+
const { tables, customOperations, sharedTypesPath } = options;
|
|
15
15
|
const files = [];
|
|
16
|
-
|
|
16
|
+
// Use shared types when a sharedTypesPath is provided (unified output mode)
|
|
17
|
+
const useSharedTypes = !!sharedTypesPath;
|
|
17
18
|
const hasCustomQueries = (customOperations?.queries.length ?? 0) > 0;
|
|
18
19
|
const hasCustomMutations = (customOperations?.mutations.length ?? 0) > 0;
|
|
19
20
|
const typeRegistry = customOperations?.typeRegistry;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CleanTable, CleanOperation } from '../../types/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { QueryKeyConfig } from '../../types/config';
|
|
3
3
|
export interface QueryKeyGeneratorOptions {
|
|
4
4
|
tables: CleanTable[];
|
|
5
5
|
customQueries: CleanOperation[];
|
|
6
|
-
config:
|
|
6
|
+
config: QueryKeyConfig;
|
|
7
7
|
}
|
|
8
8
|
export interface GeneratedQueryKeysFile {
|
|
9
9
|
fileName: string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types generator
|
|
3
|
+
*
|
|
4
|
+
* Generates shared TypeScript types that can be imported by both
|
|
5
|
+
* React Query SDK and ORM client outputs.
|
|
6
|
+
*
|
|
7
|
+
* Output structure:
|
|
8
|
+
* shared/
|
|
9
|
+
* index.ts - Barrel export
|
|
10
|
+
* types.ts - Entity interfaces
|
|
11
|
+
* schema-types.ts - Enums, input types, payload types
|
|
12
|
+
* filters.ts - Filter types (StringFilter, IntFilter, etc.)
|
|
13
|
+
*/
|
|
14
|
+
import type { CleanTable, CleanOperation, TypeRegistry } from '../../../types/schema';
|
|
15
|
+
import type { GraphQLSDKConfigTarget } from '../../../types/config';
|
|
16
|
+
export interface GeneratedFile {
|
|
17
|
+
path: string;
|
|
18
|
+
content: string;
|
|
19
|
+
}
|
|
20
|
+
export interface GenerateSharedOptions {
|
|
21
|
+
tables: CleanTable[];
|
|
22
|
+
customOperations?: {
|
|
23
|
+
queries: CleanOperation[];
|
|
24
|
+
mutations: CleanOperation[];
|
|
25
|
+
typeRegistry: TypeRegistry;
|
|
26
|
+
};
|
|
27
|
+
config: GraphQLSDKConfigTarget;
|
|
28
|
+
}
|
|
29
|
+
export interface GenerateSharedResult {
|
|
30
|
+
files: GeneratedFile[];
|
|
31
|
+
generatedEnumNames: string[];
|
|
32
|
+
hasSchemaTypes: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generate shared types that can be imported by both React Query SDK and ORM client
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateSharedTypes(options: GenerateSharedOptions): GenerateSharedResult;
|
|
38
|
+
export { generateTypesFile } from '../types';
|
|
39
|
+
export { generateSchemaTypesFile } from '../schema-types-generator';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateSchemaTypesFile = exports.generateTypesFile = void 0;
|
|
37
|
+
exports.generateSharedTypes = generateSharedTypes;
|
|
38
|
+
const t = __importStar(require("@babel/types"));
|
|
39
|
+
const babel_ast_1 = require("../babel-ast");
|
|
40
|
+
const types_1 = require("../types");
|
|
41
|
+
const schema_types_generator_1 = require("../schema-types-generator");
|
|
42
|
+
const utils_1 = require("../utils");
|
|
43
|
+
/**
|
|
44
|
+
* Helper to create export * from './module' statement
|
|
45
|
+
*/
|
|
46
|
+
function exportAllFrom(modulePath) {
|
|
47
|
+
return t.exportAllDeclaration(t.stringLiteral(modulePath));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate shared types that can be imported by both React Query SDK and ORM client
|
|
51
|
+
*/
|
|
52
|
+
function generateSharedTypes(options) {
|
|
53
|
+
const { tables, customOperations } = options;
|
|
54
|
+
const files = [];
|
|
55
|
+
// Collect table type names for import path resolution
|
|
56
|
+
const tableTypeNames = new Set(tables.map((t) => (0, utils_1.getTableNames)(t).typeName));
|
|
57
|
+
// 1. Generate schema-types.ts for custom operations (if any)
|
|
58
|
+
// NOTE: This must come BEFORE types.ts so that types.ts can import enum types
|
|
59
|
+
let hasSchemaTypes = false;
|
|
60
|
+
let generatedEnumNames = [];
|
|
61
|
+
if (customOperations && customOperations.typeRegistry) {
|
|
62
|
+
const schemaTypesResult = (0, schema_types_generator_1.generateSchemaTypesFile)({
|
|
63
|
+
typeRegistry: customOperations.typeRegistry,
|
|
64
|
+
tableTypeNames,
|
|
65
|
+
});
|
|
66
|
+
// Only include if there's meaningful content
|
|
67
|
+
if (schemaTypesResult.content.split('\n').length > 10) {
|
|
68
|
+
files.push({
|
|
69
|
+
path: 'schema-types.ts',
|
|
70
|
+
content: schemaTypesResult.content,
|
|
71
|
+
});
|
|
72
|
+
hasSchemaTypes = true;
|
|
73
|
+
generatedEnumNames = schemaTypesResult.generatedEnums || [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// 2. Generate types.ts (entity interfaces and filter types)
|
|
77
|
+
files.push({
|
|
78
|
+
path: 'types.ts',
|
|
79
|
+
content: (0, types_1.generateTypesFile)(tables, {
|
|
80
|
+
enumsFromSchemaTypes: generatedEnumNames,
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
// 3. Generate barrel export (index.ts)
|
|
84
|
+
const barrelContent = generateSharedBarrel(hasSchemaTypes);
|
|
85
|
+
files.push({
|
|
86
|
+
path: 'index.ts',
|
|
87
|
+
content: barrelContent,
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
files,
|
|
91
|
+
generatedEnumNames,
|
|
92
|
+
hasSchemaTypes,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Generate the barrel export for shared types using Babel AST
|
|
97
|
+
*/
|
|
98
|
+
function generateSharedBarrel(hasSchemaTypes) {
|
|
99
|
+
const statements = [];
|
|
100
|
+
// Export types
|
|
101
|
+
statements.push(exportAllFrom('./types'));
|
|
102
|
+
// Export schema types if present
|
|
103
|
+
if (hasSchemaTypes) {
|
|
104
|
+
statements.push(exportAllFrom('./schema-types'));
|
|
105
|
+
}
|
|
106
|
+
// Add file header as leading comment on first statement
|
|
107
|
+
if (statements.length > 0) {
|
|
108
|
+
(0, babel_ast_1.addJSDocComment)(statements[0], [
|
|
109
|
+
'Shared types - auto-generated, do not edit',
|
|
110
|
+
'@generated by @constructive-io/graphql-codegen',
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
return (0, babel_ast_1.generateCode)(statements);
|
|
114
|
+
}
|
|
115
|
+
var types_2 = require("../types");
|
|
116
|
+
Object.defineProperty(exports, "generateTypesFile", { enumerable: true, get: function () { return types_2.generateTypesFile; } });
|
|
117
|
+
var schema_types_generator_2 = require("../schema-types-generator");
|
|
118
|
+
Object.defineProperty(exports, "generateSchemaTypesFile", { enumerable: true, get: function () { return schema_types_generator_2.generateSchemaTypesFile; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration module exports
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadWatchConfig = exports.loadAndResolveConfig = exports.loadConfigFile = exports.findConfigFile = exports.CONFIG_FILENAME = void 0;
|
|
7
|
+
var loader_1 = require("./loader");
|
|
8
|
+
Object.defineProperty(exports, "CONFIG_FILENAME", { enumerable: true, get: function () { return loader_1.CONFIG_FILENAME; } });
|
|
9
|
+
Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return loader_1.findConfigFile; } });
|
|
10
|
+
Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return loader_1.loadConfigFile; } });
|
|
11
|
+
var resolver_1 = require("./resolver");
|
|
12
|
+
Object.defineProperty(exports, "loadAndResolveConfig", { enumerable: true, get: function () { return resolver_1.loadAndResolveConfig; } });
|
|
13
|
+
Object.defineProperty(exports, "loadWatchConfig", { enumerable: true, get: function () { return resolver_1.loadWatchConfig; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const CONFIG_FILENAME = "graphql-codegen.config.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Find the nearest config file by walking up directories
|
|
4
|
+
*/
|
|
5
|
+
export declare function findConfigFile(startDir?: string): string | null;
|
|
6
|
+
export interface LoadConfigFileResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
config?: any;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Load and validate a config file
|
|
13
|
+
*
|
|
14
|
+
* Uses jiti to support TypeScript config files (.ts) in addition to
|
|
15
|
+
* JavaScript (.js, .mjs, .cjs) without requiring the user to have
|
|
16
|
+
* tsx or ts-node installed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadConfigFile(configPath: string): Promise<LoadConfigFileResult>;
|