-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat(store-api): Add codegen #960
Conversation
✔️ Deploy Preview for storeui ready! 🔨 Explore the source changes: b8bfcfe 🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/61425ed9487717000857224c 😎 Browse the preview: https://deploy-preview-960--storeui.netlify.app |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b8bfcfe:
|
"test": "tsdx test", | ||
"lint": "tsdx lint" | ||
"lint": "tsdx lint", | ||
"generate": "graphql-codegen --config codegen.yml" |
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.
How about adding a clean
script here too?
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.
for cleaning the dist
folder you mean?
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.
I was actually thinking about the generated types... but yeah! Hahahah the dist folder makes more sense
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.
Oh, every time we generate the typings it actually clean the types, so it's kinda already built into the "generate" command
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.
LGTM, but I left a question below.
"@graphql-tools/schema": "^8.2.0", | ||
"graphql": "^15.5.3", | ||
"isomorphic-unfetch": "^3.1.0", |
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.
Why were these dependencies added?
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.
It was already importing these on the code but it wasn't really defined in store-api's deps.
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.
Can we prevent that from happening? Like, scoping dependencies per package?
What's the purpose of this pull request?
Adds graphql codegen for auto generating TypeScript typings after the graphql typeDefs for store-api.
This is important for the future once we start using these typings on our typescript code base
How it works?
Graphql codegen is a cli. This cli is hooked into the
generate
script of package.json. To generate types just:To watch for file changes:
Also, the
yarn build
command nows does two things: