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

Allows lefthook to work when node_modules is not in root folder for npx #224

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

spearmootz
Copy link
Contributor

npx will automatically install the module if not present. yarn does not do this and complains when the package.json is not found.

npx will automatically install the module if not present. yarn does not do this and complains when the package.json is not found.
@spearmootz spearmootz closed this Sep 2, 2021
@spearmootz spearmootz reopened this Sep 2, 2021
@spearmootz
Copy link
Contributor Author

the reason for this is that my project has a main folder and a /src folder. the package.json and node_modules is found in the src folder and therefore npx lefthook is not found but it is also not automatically installed because it is missing the @Arkweid

@Envek Envek merged commit d65edc8 into evilmartians:master Sep 6, 2021
@Envek
Copy link
Member

Envek commented Sep 6, 2021

Thank you!

@spearmootz
Copy link
Contributor Author

can this be released?

@@ -21,7 +21,7 @@ call_lefthook()
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook $1
elif npx lefthook -h >/dev/null 2>&1
elif npx @arkweid/lefthook -h >/dev/null 2>&1
then
npx lefthook $1
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this line be updated too?

Copy link
Member

Choose a reason for hiding this comment

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

It may be updated and may be not updated. npx seems to search for binaries both in node_modules and in system PATH, so if if statement above if passes then there will be lefthook binary in node_modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, that wont work. maybe both should be checked. this is for the case when the module is not in the root of the git project. so doing npx lefthook wont run it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, my bad. The line below also needs to be npx @arkweid/lefthook

PikachuEXE added a commit to PikachuEXE/lefthook that referenced this pull request Sep 29, 2021
Envek pushed a commit that referenced this pull request Oct 2, 2021
Envek pushed a commit that referenced this pull request Oct 2, 2021
…px (#224)

npx will automatically install the module if not present. yarn does not do this and complains when the package.json is not found.
Envek pushed a commit that referenced this pull request Oct 2, 2021
@Envek
Copy link
Member

Envek commented Oct 2, 2021

Released in 0.7.7

Envek added a commit that referenced this pull request Jun 6, 2022
* origin/0-7-stable:
  0.7.7: Fix arguments passing and various NPM-related fixes
  Fix incorrect npx command in git hook script template (#236)
  Update project URLs in NPM package.json (#235)
  Pass all arguments to downstream hooks (#231)
  Allows lefthook to work when node_modules is not in root folder for npx (#224)
  Do not initialize git config on `help` and `version` commands (#209)
  node: fix postinstall: process.cwd is a function and should be called
mrexox added a commit that referenced this pull request Jun 9, 2022
* master:
  Account for GOAMD64 suffix in directory names in NPM and GEM packages [ci skip]
  Include version into RPM/DEB packages on release [ci skip]
  0.8.0: Skip hooks in merge/rebase, hide summary, NPM installer package
  Split NPM package to two: bundled and installer (#273)
  Include archived binaries in the releases (#189)
  docs: s/agrs/args (#265) [ci skip]
  chore(lint): Fix golangci-lint complains
  docs(usage): Add commitlint example in full_guide (#201)
  Fix unreachable conditional in hook template (#242)
  fix(hook.tmpl): adds cpu arch and os arch to `lefthook`'s filepath (#260)
  Replace deprecated `File.exists?` with `exist?` for Ruby wrapper (#263)
  Fix typo in docs/full_guide.md (#256)
  0.7.7: Fix arguments passing and various NPM-related fixes
  Fix incorrect npx command in git hook script template (#236)
  Update project URLs in NPM package.json (#235)
  Pass all arguments to downstream hooks (#231)
  Allows lefthook to work when node_modules is not in root folder for npx (#224)
  Do not initialize git config on `help` and `version` commands (#209)
  node: fix postinstall: process.cwd is a function and should be called

Signed-off-by: Valentin Kiselev <[email protected]>
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.

None yet

3 participants