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

Lefthook for Dart #71

Closed
igorkamyshev opened this issue Aug 23, 2019 · 15 comments
Closed

Lefthook for Dart #71

igorkamyshev opened this issue Aug 23, 2019 · 15 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@igorkamyshev
Copy link

Hello! I want to use lefthook with Dart. I can make a PR for that, but I have a couple of questions.

Do you publish all packages manaully? Who will publish new versions to pub (Dart package registry)?

P.S. Thanks for lib, it is really great! 😻

@igorkamyshev
Copy link
Author

What do you think in general about this idea?

@Arkweid Arkweid added the question Further information is requested label Aug 23, 2019
@Arkweid
Copy link
Collaborator

Arkweid commented Aug 23, 2019

Hello @igorkamyshev, that's a great idea! You can do i simple wrapper and maintain it. For example like this wrapper for pip:
https://github.com/life4/lefthook
We can add your wrapper in our documentation. Is it possible for you?

Do you publish all packages manaully?

Yep, I publish it with goreleaser + npm publish + rake.

@igorkamyshev
Copy link
Author

Nice, thanks. I will do it, and send notification for you.

@igorkamyshev
Copy link
Author

Hello! I wrote Dart-wrapper for Lefthook. Can you add that link to official repo?

https://github.com/drt-pkgz/lefthook

Also, I have one question.

In repare-commit-msg hook I found next text:

#!/bin/sh

if [ "{$LEFTHOOK}" = "0" ]; then
	exit 0
fi

# lefthook_version: d41d8cd98f00b204e9800998ecf8427e

cmd="lefthook install"

if lefthook >/dev/null 2>&1
then
	exec $cmd
elif bundle exec lefthook >/dev/null 2>&1
then
	bundle exec $cmd
elif npx lefthook >/dev/null 2>&1
then
	npx $cmd
fi

cmd="lefthook run prepare-commit-msg $@"

if lefthook >/dev/null 2>&1
then
  exec $cmd
elif bundle exec lefthook >/dev/null 2>&1
then
  bundle exec $cmd
elif npx lefthook >/dev/null 2>&1
then
  npx $cmd
else
  echo "Can't find lefthook in PATH"
fi

I guess, it may be confusing, if folk uses this tool from Dart, but Lefthook try to use npx, ruby-stuff, etc. Can you provide API to set this commands implicitly by first install? I mean something like this:

lefthook install --install-command="pub global activate lefthook"

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 26, 2019

Yep, I can do that.
Right now I have semi-vacations days, so it took a while for this feature. Sorry about that.

@igorkamyshev
Copy link
Author

It's okay, have a nice days-off.

Please, ping me, when you do this changes.

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 26, 2019

Yep, no problem.

@Arkweid Arkweid added the enhancement New feature or request label Aug 26, 2019
@igorkamyshev
Copy link
Author

Hi. What about this enhancement?

@Arkweid
Copy link
Collaborator

Arkweid commented Sep 25, 2019

Sorry for so long, planned on following week.

@igorkamyshev
Copy link
Author

Hello! Sorry for interruption. Do you plan make this enhancement? If you don't want to do this, it is okay, please just tell me about it 🤗 (because, this issue in my Things app and I can't just close any task without reason 😂)

@Arkweid
Copy link
Collaborator

Arkweid commented Nov 18, 2019

@igorkamyshev I will! I just really have a very limited time :(
Or if you want to take this(it would be great) I can guide you through the code step by step. Like this:
#72 (comment)
#64 (comment)

@igorkamyshev
Copy link
Author

@Arkweid yep. I am really bad in Go, but I want try 🤓 Please, provide instructions for me.

@Arkweid
Copy link
Collaborator

Arkweid commented Dec 2, 2019

Ye @igorkamyshev ! Lets try this flow:

  1. Add new config key, for example bin_path, like here:
    https://github.com/Arkweid/lefthook/blob/master/cmd/root.go#L16-L23
  2. Add new available flag for install command lefthook install --bin-path=./node_modules/@arkweid/lefthook
    https://github.com/Arkweid/lefthook/blob/master/cmd/root.go#L59-L60
    You can find the reference in cobra repository for that part: https://github.com/spf13/cobra
    We using it for avoid CLI boilerplate.
  3. Automatically add it into lefthook.yml config file when user provide bin_path flag. Template here:
    https://github.com/Arkweid/lefthook/blob/master/cmd/install.go#L73-L108
  4. Now we have all required things to add a hooks with desired bin_path. Template for that here:
    https://github.com/Arkweid/lefthook/blob/master/cmd/add.go#L73-L84
  5. Make the same changes for _windows.go files.
  6. (optinal) If you feel a power - write the tests!
  7. ...
  8. Profit!

@Arkweid Arkweid added help wanted Extra attention is needed and removed question Further information is requested labels Dec 21, 2019
@charlie-wasp
Copy link
Contributor

@igorkamyshev hi! Is this issue still relevant for you by any chance?

@skryukov
Copy link
Member

skryukov commented Jun 2, 2021

I've moved the resulting feature request to a separate issue so that we can close this.

@skryukov skryukov closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants