Skip to content

feat(scripts): git hook to format generators #856

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

Merged
merged 3 commits into from
Jul 25, 2022
Merged

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented Jul 21, 2022

🧭 What and Why

🎟 JIRA Ticket: APIC-592

I'm tired of seeing the CI fail because of the generators being unformatted, so here is a hook to format generators everytime there are changes.

We need the docker:no-tty script because we don't have a tty inside the hook.

Changes included:

  • Refacto hooks folder
  • Add format-generators script

🧪 Test

Try modifying a generator file and commit it.

@millotp millotp requested a review from a team July 21, 2022 15:31
@millotp millotp self-assigned this Jul 21, 2022
@millotp millotp requested review from damcou and shortcuts and removed request for a team July 21, 2022 15:31
@netlify
Copy link

netlify bot commented Jul 21, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit 988836d
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/62de651b0b619c00082d2658

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jul 21, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice

@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./scripts/ci/husky/pre-commit.js
./scripts/husky/pre-commit.js
./scripts/husky/format-generators.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the JSON one too? You can have a common format

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good idea

package.json Outdated
@@ -13,6 +13,7 @@
"clean": "rm -rf **/dist **/build **/node_modules **/.gradle **/vendor || true",
"cli": "yarn workspace scripts ts-node --transpile-only ./cli/index.ts",
"docker": "docker exec -it dev yarn cli $*",
"docker:no-tty": "docker exec -t dev yarn cli $*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's only used in the script maybe it's worth having the raw command, wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good idea again !

@millotp millotp changed the title feat(cli): git hook to format generators feat(scripts): git hook to format generators Jul 21, 2022
@shortcuts shortcuts force-pushed the feat/hook-generators branch from c45181d to 988836d Compare July 25, 2022 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants