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

fix(cli): fix pnpm fail to create bin on install #106

Merged
merged 2 commits into from
Mar 17, 2023
Merged

fix(cli): fix pnpm fail to create bin on install #106

merged 2 commits into from
Mar 17, 2023

Conversation

jrson83
Copy link
Contributor

@jrson83 jrson83 commented Mar 17, 2023

Related ISSUE

None

Type Of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ“ Document (This change requires a documentation update)
  • 🎨 Theme style (Theme style beautification)
  • ⚠ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • πŸ”¨ Workflow (Workflow changes)

Clear Describe

fix: pnpm fail to create bin when running pnpm install

Description

When running pnpm install in the repo root for the first time, pnpm can't create node_modules\.bin folders, cause they do not exist (cause they are not build yet) and throws warnings:

 WARN  Failed to create bin at D:\test\cz-git\node_modules\.bin\czg. The source file at D:\test\cz-git\node_modules\czg\bin\index.js does not exist.
 WARN  Failed to create bin at D:\test\cz-git\node_modules\.bin\git-czg. The source file at D:\test\cz-git\node_modules\czg\bin\index.js does not exist.

Test Case

No need for additional test case.

@netlify
Copy link

netlify bot commented Mar 17, 2023

βœ… Deploy Preview for cz-git canceled.

Name Link
πŸ”¨ Latest commit 06ef913
πŸ” Latest deploy log https://app.netlify.com/sites/cz-git/deploys/64142bf94e67230007f86425

Co-authored-by: Zhengqbbb <1074059947@qq.com>
@Zhengqbbb
Copy link
Owner

Zhengqbbb commented Mar 17, 2023

@jrson83 LGTM. πŸš€ But current in my other repo has not been reproduced yet.
I have been release a next version 1.6.1-beta.1 to provide your. Please have a try, let me known is that have any ISSUE.

pnpm install -D czg@next 

@jrson83
Copy link
Contributor Author

jrson83 commented Mar 17, 2023

@jrson83 LGTM. πŸš€ But current in my other repo has not been reproduced yet. I have been release a next version 1.6.1-beta.1 to provide your. Please have a try, let me known is that have any ISSUE.

pnpm install -D czg@next 

@Zhengqbbb I did not have any issues when installing the NPM package with pnpm. The issue exists only in the cz-git monorepo.

To reproduce:

git clone https://github.com/Zhengqbbb/cz-git.git
cd cz-git
pnpm install

Then you should see the console warnings.

@Zhengqbbb
Copy link
Owner

Then you should see the console warnings.

Yep Thx ~

CleanShot 2023-03-17 at 17 15 40@2x

@Zhengqbbb
Copy link
Owner

I thought it had an impact on your project, so it this is directed at my project is it lol. thx 🀣
Actually I'd like to know if czg is working properly in your project, I'd like to know if working well in windows ?

@jrson83
Copy link
Contributor Author

jrson83 commented Mar 17, 2023

@Zhengqbbb Ah okay 😁 Yeah it is working very well on windows and I like it very much cause it has so small install size!

The only issue I had was related to husky/prepare-commit-msg hook. Cause windows terminal does not support interaction, I use the following workaround to run czg in a new terminal when running git commit:

#!/usr/bin/env sh

FILE=commit.cmd
if test -f "$FILE"; then
    echo "$FILE exists."
    rm commit.cmd
    exit 0;
fi
case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*)
        echo "npx czg && exit" > commit.cmd
        start commit.cmd
    exit 1;
esac
. "$(dirname "$0")/_/husky.sh"
exec < /dev/tty && npx czg --hook || true

@Zhengqbbb
Copy link
Owner

The only issue I had was related to husky/prepare-commit-msg hook. Cause windows terminal does not support interaction, I use the following workaround to run czg in a new terminal when running git commit:

So you handled show editor after czg interaction end ?

@jrson83
Copy link
Contributor Author

jrson83 commented Mar 17, 2023

The only issue I had was related to husky/prepare-commit-msg hook. Cause windows terminal does not support interaction, I use the following workaround to run czg in a new terminal when running git commit:

So you handled show editor after czg interaction end ?

No 😁 before running czg it checks if the terminal is interactive. If not (windows), it opens a new terminal and runs czg inside. If you want to read more about, here is the issue at husky.

@Zhengqbbb
Copy link
Owner

The only issue I had was related to husky/prepare-commit-msg hook. Cause windows terminal does not support interaction, I use the following workaround to run czg in a new terminal when running git commit:

So you handled show editor after czg interaction end ?

No 😁 before running czg it checks if the terminal is interactive. If not (windows), it opens a new terminal and runs czg inside. If you want to read more about, here is the issue at husky.

lol OK ~ there are only way you can hide editor. Alias your git command

  • when you use git commit will use git commit -m ''
  • But I don't known work well on windows. I am a POSIX SHELL developer

Follow this thread #87

add .bashrc or .zshrc

git() {
  local _cmd="$*"
  if [ "$1" = "commit" ] && [ "${_cmd%%"--help"}" = "$_cmd"  ]; then
    shift 1; command git commit -m ''
  else
    command git "$@"
  fi
}

Anyway thx your support and point out the problem 🀜 πŸ€›

@jrson83
Copy link
Contributor Author

jrson83 commented Mar 17, 2023

Anyway thx your support and point out the problem 🀜 πŸ€›

No problem 😁 You gonna merge the PR? I gonna do another after.

@Zhengqbbb Zhengqbbb merged commit 3b5ecb3 into Zhengqbbb:main Mar 17, 2023
@jrson83 jrson83 deleted the fix/bin-pnpm-warn branch March 17, 2023 09:49
@Zhengqbbb
Copy link
Owner

The only issue I had was related to husky/prepare-commit-msg hook. Cause windows terminal does not support interaction, I use the following workaround to run czg in a new terminal when running git commit:

So you handled show editor after czg interaction end ?

No 😁 before running czg it checks if the terminal is interactive. If not (windows), it opens a new terminal and runs czg inside. If you want to read more about, here is the issue at husky.

@jrson83 !!!

#87 (comment)

git config core.editor cat
git commit # try it !

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

2 participants