This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add optional graphql-codegen
step to build
executors
#98
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bc87718
feat: add & dependencies
domjtalbot 400df50
feat(nx-mesh): add step to the build executors
domjtalbot b358ed6
docs(readme): add `graphql-codegen` to the features list
domjtalbot 33aacec
fix(nx-mesh): run before the typescript and swc compilers
domjtalbot d8ac4f2
feat(nx-mesh): add graphql-codegen to sdk generator
domjtalbot 3eff9a6
fix(nx-mesh): temporarily disable neo4j example
domjtalbot ee17865
fix(nx-mesh): add codegen to build config in the sdk generator
domjtalbot 5994781
fix(nx-mesh): no codegen documents for examples without graphql files
domjtalbot bc8c182
fix(nx-mesh): rfam codegen generator
domjtalbot 6814d94
build: add changeset
domjtalbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
.cache | ||
.cache-loader | ||
.codegen | ||
.docusaurus | ||
.mesh | ||
.next | ||
|
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,16 @@ | ||
import type { CodegenConfig } from '@graphql-codegen/cli'; | ||
|
||
const config: CodegenConfig = { | ||
overwrite: true, | ||
schema: 'libs/example/sdk/graphql/star-wars-api/.mesh/schema.graphql', | ||
documents: | ||
'libs/example/sdk/graphql/star-wars-api/src/graphql/**/*.*.graphql', | ||
generates: { | ||
'libs/example/sdk/graphql/star-wars-api/.codegen/': { | ||
preset: 'client', | ||
plugins: [], | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
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 @@ | ||
export * from '../../.codegen'; |
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
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 |
---|---|---|
|
@@ -4,7 +4,10 @@ import { logger } from '@nrwl/devkit'; | |
import { tscExecutor } from '@nrwl/js/src/executors/tsc/tsc.impl'; | ||
import { resolve } from 'path'; | ||
|
||
import { createPackageJson, runMeshCli } from '../../utils'; | ||
import { createPackageJson } from '../../utils'; | ||
import { runCodegenCli } from '../../utils/graphql-codegen-cli'; | ||
import { runMeshCli } from '../../utils/mesh-cli'; | ||
|
||
import { BuildExecutorSchema } from './schema'; | ||
|
||
export default async function* buildExecutor( | ||
|
@@ -33,6 +36,7 @@ export default async function* buildExecutor( | |
); | ||
|
||
logger.info(''); | ||
logger.info('Running Typescript compiler...'); | ||
|
||
const tsc = tscExecutor( | ||
{ | ||
|
@@ -51,6 +55,9 @@ export default async function* buildExecutor( | |
} | ||
|
||
if (success) { | ||
logger.info(''); | ||
logger.info('Creating package.json...'); | ||
|
||
await createPackageJson( | ||
{ | ||
dir: options.dir, | ||
|
@@ -61,6 +68,21 @@ export default async function* buildExecutor( | |
); | ||
} | ||
|
||
if (options.codegen?.config) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
logger.info(''); | ||
logger.info('Running GraphQL Codegen...'); | ||
|
||
await runCodegenCli( | ||
{ | ||
...options.codegen, | ||
debug: options.debug, | ||
verbose: true, | ||
watch: options.watch, | ||
}, | ||
context | ||
); | ||
} | ||
|
||
yield { | ||
success, | ||
}; | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.