-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* unit test * refactor * pass test * add mutation tests * fix integration test * refactor * reorganize * separate field definition functions * pull out boolean arg * pull out other boolean arg * refactor * refactor * bun version * set up docs workspace * undo * fix copywright headers
- Loading branch information
1 parent
11097d5
commit ff1811a
Showing
34 changed files
with
602 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ jobs: | |
|
||
- name: Integration Test | ||
run: bun integration | ||
|
||
- name: Build Docs | ||
run: bun docs:build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bun lint && bun format && git add . | ||
bun lint:fix && bun format && git add . |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Glob } from "bun"; | ||
|
||
const filePaths = new Glob("src/**/*.ts").scan(); | ||
|
||
let filesWithoutCopyrightHeader: string[] = []; | ||
for await (const filePath of filePaths) { | ||
const fileContents = await Bun.file(filePath).text(); | ||
if (!fileContents.startsWith("/*\nCopyright")) { | ||
filesWithoutCopyrightHeader.push(filePath); | ||
} | ||
} | ||
|
||
if (filesWithoutCopyrightHeader.length) { | ||
console.error( | ||
`\nThe following files are missing a valid copyright header:${filesWithoutCopyrightHeader.map((file) => `\n • ${file}`).join()}`, | ||
); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Glob } from "bun"; | ||
|
||
const copyrightHeader = `/* | ||
Copyright 2024 Expedia, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
`; | ||
|
||
const filePaths = new Glob("src/**/*.ts").scan(); | ||
for await (const filePath of filePaths) { | ||
const fileContents = await Bun.file(filePath).text(); | ||
if (!fileContents.startsWith("/*\nCopyright")) { | ||
await Bun.write(filePath, `${copyrightHeader}${fileContents}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 15 additions & 2 deletions
17
src/helpers/build-description-annotation.ts → ...notations/build-description-annotation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2024 Expedia, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { GraphQLKotlinCodegenConfig } from "../plugin"; | ||
import { buildPackageNameFromPath } from "@graphql-codegen/java-common"; | ||
import { dirname, normalize } from "path"; | ||
import { merge } from "ts-deepmerge"; | ||
|
||
export function buildConfigWithDefaults( | ||
config: GraphQLKotlinCodegenConfig, | ||
outputFile: string, | ||
) { | ||
const defaultConfig = { | ||
packageName: buildPackageNameFromPath(dirname(normalize(outputFile))), | ||
includeDependentTypes: true, | ||
unionGeneration: "MARKER_INTERFACE", | ||
extraImports: ["com.expediagroup.graphql.generator.annotations.*"], | ||
} as const satisfies GraphQLKotlinCodegenConfig; | ||
|
||
return merge(defaultConfig, config) as GraphQLKotlinCodegenConfig & | ||
typeof defaultConfig; | ||
} | ||
|
||
export type CodegenConfigWithDefaults = ReturnType< | ||
typeof buildConfigWithDefaults | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright 2024 Expedia, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode } from "graphql"; | ||
import { CodegenConfigWithDefaults } from "./build-config-with-defaults"; | ||
|
||
export function findTypeInResolverInterfacesConfig( | ||
node: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, | ||
config: CodegenConfigWithDefaults, | ||
) { | ||
return config.resolverInterfaces?.findLast( | ||
(resolverInterface) => resolverInterface.typeName === node.name.value, | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.