Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(generator): export SDDM term aligning with input #1231

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.each<CasesQuery>([
)
injectTypenameOnRootResultFields({
request: graffleMappedResultToRequest(docWithout),
sddm: GraffleSchemaErrors.schemaDrivenDataMap,
sddm: GraffleSchemaErrors.schemaMap,
})
expect(docWithout.document).toMatchObject(docWith.document)
})
2 changes: 1 addition & 1 deletion src/extensions/SchemaErrors/tests/fixture/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
1 change: 1 addition & 0 deletions src/extensions/SchemaErrors/tests/fixture/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as GraffleSchemaErrors from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
3 changes: 2 additions & 1 deletion src/generator/generator/__snapshots__/generate.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ exports[`kitchen-sink generated modules > _.ts 1`] = `
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
"
`;

exports[`kitchen-sink generated modules > __.ts 1`] = `
"export * as Graffle from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
"
`;

Expand Down
4 changes: 3 additions & 1 deletion src/generator/generators/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const ModuleGenerator_ = createModuleGenerator(
`export { Select } from './modules/${getImportName(config, ModuleGeneratorSelect)}'`,
`export { create } from './modules/${getImportName(config, ModuleGeneratorClient)}'`,
`export * as SelectionSets from './modules/${getImportName(config, ModuleGeneratorSelectionSets)}'`,
`export { schemaDrivenDataMap } from './modules/${getImportName(config, ModuleGeneratorSchemaDrivenDataMap)}'`,
`export { schemaDrivenDataMap as schemaMap } from './modules/${
getImportName(config, ModuleGeneratorSchemaDrivenDataMap)
}'`,
)

return code
Expand Down
4 changes: 4 additions & 0 deletions src/generator/generators/__.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { capitalizeFirstLetter } from '../../lib/prelude.js'
import { defaultName } from '../config/defaults.js'
import { createModuleGenerator, getImportName } from '../helpers/moduleGenerator.js'
import { ModuleGenerator_ } from './_.js'
import { ModuleGeneratorSchemaDrivenDataMap } from './SchemaDrivenDataMap.js'

// todo remove, use config.name simply, any processing, do in config constructor
export const defaultNamespace = `Graffle`
Expand All @@ -12,6 +13,9 @@ export const ModuleGenerator__ = createModuleGenerator(
const namespace = config.name === defaultName ? defaultNamespace : capitalizeFirstLetter(config.name)
code(
`export * as ${namespace} from './${getImportName(config, ModuleGenerator_)}'`,
`export { schemaDrivenDataMap as schemaMap } from './modules/${
getImportName(config, ModuleGeneratorSchemaDrivenDataMap)
}'`,
)
return code
},
Expand Down
2 changes: 1 addition & 1 deletion tests/_/schemas/kitchen-sink/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
1 change: 1 addition & 0 deletions tests/_/schemas/kitchen-sink/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as Graffle from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
2 changes: 1 addition & 1 deletion tests/_/schemas/mutation-only/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
1 change: 1 addition & 0 deletions tests/_/schemas/mutation-only/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as MutationOnly from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
2 changes: 1 addition & 1 deletion tests/_/schemas/pokemon/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
1 change: 1 addition & 0 deletions tests/_/schemas/pokemon/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as Pokemon from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
2 changes: 1 addition & 1 deletion tests/_/schemas/query-only/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import './modules/global.js'

export { create } from './modules/client.js'
export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
export { Select } from './modules/select.js'
export * as SelectionSets from './modules/selection-sets.js'
1 change: 1 addition & 0 deletions tests/_/schemas/query-only/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as QueryOnly from './_.js'
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js'
2 changes: 1 addition & 1 deletion website/content/guides/50_appendix/05_custom-scalars.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pnpm graffle generate --schema ...
Then you augment your Graffle instance with the SDDM, and finally register your scalars:

```ts
import { schemaDrivenDataMap as schemaMap } from './graffle/__.js'
import { schemaMap } from './graffle/__.js'

const graffle = Graffle
.create({
Expand Down
2 changes: 1 addition & 1 deletion website/graffle/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import "./modules/global.js";

export { create } from "./modules/client.js";
export { schemaDrivenDataMap } from "./modules/schema-driven-data-map.js";
export { schemaDrivenDataMap as schemaMap } from "./modules/schema-driven-data-map.js";
export { Select } from "./modules/select.js";
export * as SelectionSets from "./modules/selection-sets.js";
1 change: 1 addition & 0 deletions website/graffle/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as Graffle from "./_.js";
export { schemaDrivenDataMap as schemaMap } from "./modules/schema-driven-data-map.js";
2 changes: 1 addition & 1 deletion website/pokemon/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import "./modules/global.js";

export { create } from "./modules/client.js";
export { schemaDrivenDataMap } from "./modules/schema-driven-data-map.js";
export { schemaDrivenDataMap as schemaMap } from "./modules/schema-driven-data-map.js";
export { Select } from "./modules/select.js";
export * as SelectionSets from "./modules/selection-sets.js";
1 change: 1 addition & 0 deletions website/pokemon/__.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as Pokemon from "./_.js";
export { schemaDrivenDataMap as schemaMap } from "./modules/schema-driven-data-map.js";