g-plane / zsh-yarn-autocompletions

Zsh plugin for Yarn autocompletions.
MIT License
578 stars 18 forks source link

Include instructions for building from source? #17

Closed karlhorky closed 4 years ago

karlhorky commented 4 years ago

Hi, thanks for this project, very cool!

I wanted to install this by building from source instead of installing the pre-packaged binary.

Is this the right way to do it (on macOS, from the root directory of the repo)?

brew install rust
cargo build --release
cp target/release/yarn-autocompletions ./
./install.sh $ZSH_CUSTOM/plugins
# Trust program from Unidentified developer (macOS Catalina Gatekeeper)
spctl --add $ZSH_CUSTOM/plugins/yarn-autocompletions/yarn-autocompletions
rm yarn-autocompletions
g-plane commented 4 years ago

If you're going to build from source, you don't need to copy and execute the install.zsh.

karlhorky commented 4 years ago

Ok. Is this the right way to do it though? The built binary doesn't seem to do anything for me...

I did try doing spctl --add $ZSH_CUSTOM/plugins/yarn-autocompletions/yarn-autocompletions to disable the Gatekeeper / Unidentified Developer check on macOS Catalina, but that didn't help either.

And can this be documented in the readme?

g-plane commented 4 years ago

I'll update readme in the next few days if I'm not busy.

karlhorky commented 4 years ago

I think my steps above are missing something. The plugin doesn't offer any autocompletions...

g-plane commented 4 years ago

Make sure the binary and the .plugin.zsh file are placed in the same directory.

karlhorky commented 4 years ago

Yep, they are both there (install.sh script put them there):

➜  plugins git:(master) cd $ZSH_CUSTOM/plugins/yarn-autocompletions
➜  yarn-autocompletions git:(master) ls
yarn-autocompletions            yarn-autocompletions.plugin.zsh

My plugins config from .zshrc:

plugins=(git yarn-autocompletions)
karlhorky commented 4 years ago

Trying out https://github.com/chrisands/zsh-yarn-completions for now, seems to work, also better than https://github.com/mklabs/yarn-completions.

g-plane commented 4 years ago

Closing now. I still recommend you to use pre-built package from "Release" page.

karlhorky commented 4 years ago

Is is possible to still provide some instructions for those who want to build it themselves? I'm not sure why it was failing on my machine...

g-plane commented 4 years ago

I will update readme.

g-plane commented 4 years ago

Readme is updated. Please read here.

karlhorky commented 4 years ago

Thanks @g-plane! I'll try to give the instructions a try in the next while.

Seems like there's nothing new though, except for the part about rustup. Hm... wonder what my issue was. Would be cool if it just worked now.

I guess if users have macOS Catalina, they may need the spctl command I mentioned above to disable the Unidentified Developer check.

g-plane commented 4 years ago

Can you tell me what issue you've encountered? (However, I'm not using macOS).

karlhorky commented 4 years ago

The built binary doesn't seem to do anything for me...

The plugin doesn't offer any autocompletions...

These were the issues I mentioned above when I was trying it out.


While I was trying to build, I did notice that macOS Catalina flashed a quick Unidentified Developer error when I first tried to run the program. One that looks like this:

MacOS-Gateway-Warning

So I tried to "trust" the executable in Gatekeeper by running the spctl --add command.

However, I think it may also need the xattr -d com.apple.quarantine <name-of-executable> command to remove it from the quarantine first.

Reference: https://docwhat.org/upgrading-to-catalina


I will try both of those things when I try building again.

g-plane commented 4 years ago

I don't know why, too. I'm sorry about that I'm not using and not familiar with macOS. However, I did a successful setup in a macOS machine two years ago, ever.

g-plane commented 4 years ago

This program shouldn't and won't ask a high system permission, since it's only invoked by Zsh, and there's no need to run it manually.

karlhorky commented 4 years ago

Yeah, as far as I know, it's not about system permissions - Gatekeeper checks whether the app has been a) signed and b) notarized by an Apple ID:

https://scriptingosx.com/2019/10/notarization-for-macadmins/

The requirements have been changed in macOS 10.15 Catalina:

Starting with Catalina, all software needs to be notarized to pass Gatekeeper when the first launch or installation is initiated by a user.

Additional references:

  1. Build scripts for signing / notarization in a Rust project: https://github.com/maidsafe/safe-api/blob/06e1f48db36d1604a15cf287b3cfeb9cea09d658/resources/notarize.sh
  2. List of things one has to do to build software for Catalina: https://twitter.com/fasterthanlime/status/1115949498927407104
  3. More information about Gatekeeper: https://support.apple.com/en-gb/HT202491
adi518 commented 4 years ago

I conclude that this plugin wasn't tested properly on a Mac, so it just won't work and none of the issues have a solution. Great work though. As previously mentioned this plugin works and installation is easier.