saas-boilerplate
saas-boilerplate copied to clipboard
Bug in GraphQL Code Generation for New webapp-lib: Incorrect Path in codegen.ts
Describe the bug
When creating a new webapp-lib using the command pnpm nx g @sb/tools:webapp-lib --directory webapp-libs mylib
, the generated file mylib/graphql/codegen.ts
contains an incorrect path reference. Specifically, the path is incorrectly set to webapp-lib-mylib instead of mylib.
This incorrect path results in the pnpm nx run webapp:graphql:generate-types:watch
command not functioning as expected. It fails to regenerate documents and types related to the newly created webapp-lib, leading to potential issues in development and use of GraphQL queries and mutations within the library.
Steps to reproduce
- Run the command to create a new webapp-lib:
pnpm nx g @sb/tools:webapp-lib --directory webapp-libs mylib
- Navigate to the generated file:
<project-root>/packages/webapp-libs/mylib/graphql/codegen.ts
- Observe the incorrect path reference within the file, which is set to
webapp-lib-mylib
instead of the expectedmylib
. - Run the command to generate GraphQL types:
pnpm nx run webapp:graphql:generate-types:watch
- Notice that the command does not regenerate documents and types related to the
webapp-lib
due to the incorrect path incodegen.ts
. - Attempt to use GraphQL queries or mutations within the newly created
webapp-lib
. - Encounter issues in development due to missing or incorrect GraphQL types and documents that were not generated.
System Info
System:
OS: macOS 14.1.2
CPU: (8) arm64 Apple M2
Memory: 48.22 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.0.0 - /usr/local/bin/node
npm: 9.6.4 - /usr/local/bin/npm
pnpm: 8.7.6 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 120.0.6099.129
Safari: 17.1.2
npmPackages:
@apollo/client: ^3.8.4 => 3.8.4
@apollo/rover: ^0.19.0 => 0.19.0
@aws-sdk/client-cloudformation: ^3.414.0 => 3.414.0
@aws-sdk/client-codebuild: ^3.414.0 => 3.414.0
@aws-sdk/client-ecr: ^3.414.0 => 3.414.0
@aws-sdk/client-ecs: ^3.414.0 => 3.414.0
@aws-sdk/client-iam: ^3.414.0 => 3.414.0
@aws-sdk/client-s3: ^3.417.0 => 3.417.0
@aws-sdk/client-ses: ^3.414.0 => 3.414.0
@aws-sdk/client-sfn: ^3.414.0 => 3.414.0
@aws-sdk/client-sts: ^3.414.0 => 3.414.0
@babel/preset-react: ^7.22.15 => 7.22.15
@graphql-codegen/cli: ^5.0.0 => 5.0.0
@graphql-typed-document-node/core: ^3.2.0 => 3.2.0
@iconify-icons/ion: ^1.2.10 => 1.2.10
@iconify/react: ^4.1.1 => 4.1.1
@nx/devkit: 16.8.1 => 16.8.1
@nx/eslint-plugin: 16.8.1 => 16.8.1
@nx/jest: 16.8.1 => 16.8.1
@nx/js: 16.8.1 => 16.8.1
@nx/linter: 16.8.1 => 16.8.1
@nx/node: 16.8.1 => 16.8.1
@nx/plugin: 16.8.1 => 16.8.1
@nx/react: 16.8.1 => 16.8.1
@nx/web: 16.8.1 => 16.8.1
@nx/webpack: 16.8.1 => 16.8.1
@sb/cli: * => 2.3.0
@sb/core: * => 2.3.0
@sentry/react: ^7.70.0 => 7.70.0
@storybook/addon-actions: ^7.4.3 => 7.4.3
@storybook/react: ^7.4.3 => 7.4.3
@supercharge/strings: ^2.0.0 => 2.0.0
@svgr/webpack: ^8.1.0 => 8.1.0
@tailwindcss/typography: ^0.5.10 => 0.5.10
@testing-library/dom: ^9.3.3 => 9.3.3
@testing-library/jest-dom: ^6.1.3 => 6.1.3
@testing-library/react: 14.0.0 => 14.0.0
@testing-library/react-hooks: ^8.0.1 => 8.0.1
@testing-library/user-event: ^14.5.1 => 14.5.1
@trivago/prettier-plugin-sort-imports: ^4.2.0 => 4.2.0
@types/gtag.js: ^0.0.14 => 0.0.14
@types/jest: ^29.5.5 => 29.5.5
@types/node: ^18.15.3 => 18.17.17
@types/ramda: ^0.28.25 => 0.28.25
@types/react: 18.2.22 => 18.2.22
@types/react-dom: 18.2.7 => 18.2.7
@types/react-router: ^5.1.20 => 5.1.20
@types/react-router-dom: 5.3.3 => 5.3.3
@types/react-test-renderer: ^18.0.2 => 18.0.2
@typescript-eslint/eslint-plugin: 5.62.0 => 5.62.0
@typescript-eslint/parser: 5.62.0 => 5.62.0
@typescript-eslint/scope-manager: 5.62.0 => 5.62.0
@vitejs/plugin-react: ^4.0.4 => 4.0.4
aws-cdk: ^2.96.2 => 2.96.2
aws-cdk-lib: ^2.96.2 => 2.96.2
babel-jest: 29.7.0 => 29.7.0
constructs: ^10.2.70 => 10.2.70
eslint: ^8.49.0 => 8.49.0
eslint-config-prettier: ^9.0.0 => 9.0.0
eslint-import-resolver-typescript: ^3.6.0 => 3.6.0
eslint-plugin-formatjs: ^4.10.5 => 4.10.5
eslint-plugin-import: 2.28.1 => 2.28.1
eslint-plugin-jsx-a11y: ^6.7.1 => 6.7.1
eslint-plugin-react: 7.33.2 => 7.33.2
eslint-plugin-react-hooks: 4.6.0 => 4.6.0
eslint-plugin-testing-library: ^6.0.1 => 6.0.1
graphql: ^16.8.1 => 16.8.1
husky: ^8.0.3 => 8.0.3
jest: 29.7.0 => 29.7.0
jest-environment-jsdom: 29.7.0 => 29.7.0
jest-matcher-utils: ^29.7.0 => 29.7.0
jest-watch-typeahead: ^2.2.2 => 2.2.2
lint-staged: ^14.0.1 => 14.0.1
nx: 16.8.1 => 16.8.1
nx-cloud: 16.4.0 => 16.4.0
plop: ^4.0.0 => 4.0.0
prettier: ^3.0.3 => 3.0.3
prettier-plugin-tailwindcss: ^0.5.4 => 0.5.4
ramda: ^0.28.0 => 0.28.0
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-helmet-async: ^1.3.0 => 1.3.0
react-hook-form: ^7.46.1 => 7.46.1
react-intl: ^6.4.7 => 6.4.7
react-loading-skeleton: ^3.3.1 => 3.3.1
react-markdown: ^8.0.7 => 8.0.7
react-router: ^6.16.0 => 6.16.0
react-router-dom: 6.16.0 => 6.16.0
regenerator-runtime: ^0.14.0 => 0.14.0
styled-components: 6.0.8 => 6.0.8
tailwindcss: ^3.3.3 => 3.3.3
tailwindcss-animate: ^1.0.7 => 1.0.7
ts-jest: 29.1.1 => 29.1.1
ts-node: 10.9.1 => 10.9.1
tsconfig-paths: ^4.2.0 => 4.2.0
tslib: ^2.6.2 => 2.6.2
typescript: 5.2.2 => 5.2.2
vite: ^4.4.9 => 4.4.9
vite-plugin-eslint: ^1.8.1 => 1.8.1
vite-plugin-svgr: ^3.3.0 => 3.3.0
vite-tsconfig-paths: ^4.2.1 => 4.2.1
Logs
No response
Validations
- [x] Follow our Code of Conduct.
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.