-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore(tooling): generation script for all language and clients APIC-221 #32
Conversation
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.
niiiiiiiiiiiiiice
package.json
Outdated
"generate:recommend": "yarn generate:js:recommend", | ||
"generate:search": "yarn generate:js:search", | ||
"generate": "yarn generate:js && yarn format:specs", | ||
"generate": "./scripts/generate.sh ${1:-all} ${2:-all} && yarn format:specs", |
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.
yarn format:specs
could maybe be a post-gen/global.sh
script or something? We might have other post gen script related to the specs etc. later.
It might also be a good thing to add a pre-gen
like in the CI, to build and validate the specs before generating, wdyt?
package.json
Outdated
"generate:recommend": "yarn generate:js:recommend", | ||
"generate:search": "yarn generate:js:search", | ||
"generate": "yarn generate:js && yarn format:specs", | ||
"lint:specs:fix": "yarn prettier --write specs", |
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.
Prettier is a formatter hence the format
instead of lint
but I don't have a strong opinion
scripts/generate.sh
Outdated
local lang=$1 | ||
local client=$2 | ||
echo "Generating code for ${lang}-${client}" | ||
yarn openapi-generator-cli generate --generator-key "${lang}-${client}" |
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 maybe silence the output of the command? I wonder if it's possible to do it only if it succeed
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.
You want to silence the openapi-generator-cli
part ?
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.
Mostly wondering if we can silent unless it fails 🤔
scripts/generate.sh
Outdated
echo "Generating code for ${lang}-${client}" | ||
yarn openapi-generator-cli generate --generator-key "${lang}-${client}" | ||
|
||
# run the post generation script if it exists (linting and additional files) |
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.
We will need to mention this part in our contribution guide
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.
love it!
🧭 What and Why
🎟 JIRA Ticket: APIC-221
Generation script to ease tooling and not bloat the
package.json
.Support multi-languages, multi-clients, and post-generation-script.
Changes included:
generate.sh
package.json
, exceptgenerate
format:spec
from the generation🧪 Test
yarn generate