Skip to content
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: add recursive do option #861

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mrexox
Copy link
Member

@mrexox mrexox commented Oct 31, 2024

Closes #132

⚡ Summary

  • Add actions and group new options, so recursive piped/parallel flows could be built
  • Implement the same run logic for actions as for commands and scripts
  • Properly merge actions options with lefthook-local.yml and extends
  • Add unit tests
  • Add integration tests
  • Add docs

Old syntax

pre-commit:
  parallel: true
  commands:
    lint:
      run: yarn lint
      stage_fixed: true
    fix-typos:
      run: typos
    migrate:
      run: lefthook run migrate
  scripts:
    "graphql-generate.sh":
      runner: bash

migrate:
  piped: true
  commands:
    setup:
      run: yarn setup
      priority: 1
    migrate:
      run: yarn migrate
      priority: 2

New syntax

pre-commit:
  parallel: true
  actions:
    - name: lint
      run: yarn lint
      stage_fixed: true
    - run: typos
    - script: graphql-generate.sh
      runner: bash
    - group:
        name: migrate
        piped: true
        actions:
          - run: yarn setup
          - run: yarn migrate

@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from 48e1ead to 3b478c7 Compare October 31, 2024 07:48
@VanTanev
Copy link

VanTanev commented Nov 1, 2024

Hey, a question here: Re do[].group.do[] items the same as do[] items?

In this case, the nested items don't have a name - is it valid for the top level items to also omit a name, and what happens then, is the name just the value of run?

btw I think this new config format is pretty neat.

@mrexox
Copy link
Member Author

mrexox commented Nov 2, 2024

Yes, name is optional. The only mandatory options are either run, script, or group. run or script value will be used if name is empty, and for a group without a name it will be the index of a group - [3]

@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from bd4c85e to 722b6aa Compare November 6, 2024 07:36
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.

Order of scripts and command
2 participants