g-plane / zsh-yarn-autocompletions Goto Github PK
View Code? Open in Web Editor NEWZsh plugin for Yarn autocompletions.
License: MIT License
Zsh plugin for Yarn autocompletions.
License: MIT License
When I attempt to run install.sh, I get the following error:
/Users/jawilson/Downloads/yarn-autocompletions_macos-latest/install.sh: line 7: [: /Users/jawilson/Library/Mobile: binary operator expected
It would be nice to also get suggestions of installed binary packages
Steps to reproduce:
I used these steps to overcome https://support.apple.com/en-us/HT202491
I'm by no means a zsh expert but I've been using zplug lately. I wanted to install your plugin using zplug and I ran into some issues:
.zshrc
:zplug "g-plane/zsh-yarn-autocompletions", hook-build:"mkdir -p src && mv yarn-deps src/ && mv yarn-scripts src/ && cd src/yarn-deps && cargo build --release && cd ../yarn-scripts && cargo build --release && cd ../.. && mv src/yarn-deps/target/release/yarn-deps . && mv src/yarn-scripts/target/release/yarn-scripts ."
In order to move the compiled yarn-deps
and yarn-scripts
to the plugin's root folder, the folders of the same name can't exist, so I'm moving those to src
. It's kind of hacky so a better way would be nice.
yarn
and hit tab, I get:_yarn_autocompletions_scripts:1: no such file or directory: /plugins/yarn-autocompletions/yarn-scripts
_yarn_autocompletions_scripts:1: no such file or directory: /plugins/yarn-autocompletions/yarn-scripts
_yarn_autocompletions_scripts:1: no such file or directory: /plugins/yarn-autocompletions/yarn-scripts
Looking at the code, it's interpolating $ZSH_CUSTOM
to the empty string, so I guess that's not supported by default. The plugin gets installed to ~/.zplug/repos/g-plane/zsh-yarn-autocompletions
so $ZSH_CUSTOM/plugins/yarn-autocompletions
, like the plugin code currently uses, doesn't seem like the generic approach.
Happy to have a stab at a PR but I wanted to check first. ๐
Hi,
just installed the plugin using zplug, but the hook fails due to a 404.
It tries to download https://github.com/g-plane/zsh-yarn-autocompletions/releases/download/v2.0.1/yarn-autocompletions_linux.zip
But there is only a yar-autocompletions_ubuntu-latest.zip for v2.0.1.
I just installed Fig on my Macbook and it's working as expected. I then installed this package using the "community plugins" section in Fig. After installing the package I restarted the terminal. However, I can't get this to work. There's no autocomplete at all.
What did I do wrong?
As title.
$ yarn _yarn_autocompletions_scripts:1: exec format error: /Users/mathieutu/.oh-my-zsh/custom/plugins/yarn-autocompletions/yarn-scripts
_yarn_autocompletions_scripts:1: exec format error: /Users/mathieutu/.oh-my-zsh/custom/plugins/yarn-autocompletions/yarn-scripts
_yarn_autocompletions_scripts:1: exec format error: /Users/mathieutu/.oh-my-zsh/custom/plugins/yarn-autocompletions/yarn-scripts
yarn
Just after installing the plugin and restarting zsh.
$ la $ZSH_CUSTOM/plugins/yarn-autocompletions
total 20992
-rw-r--r--@ 1 mathieutu staff 1.0K Mar 21 09:43 LICENSE
-rw-r--r--@ 1 mathieutu staff 796B Mar 21 09:43 README.md
-rw-r--r--@ 1 mathieutu staff 1.1K Mar 21 09:43 yarn-autocompletions.plugin.zsh
-rwxr-xr-x@ 1 mathieutu staff 5.1M Mar 21 09:43 yarn-deps*
-rwxr-xr-x@ 1 mathieutu staff 5.1M Mar 21 09:43 yarn-scripts*
Hi,
I'm seeing your install.sh.
It can't work if you don't specify the $ZSH_CUSTOM folder as argument.
zsh-yarn-autocompletions/install.sh
Lines 1 to 4 in 5c57b53
Maybe you should update the doc (or the script!).
Thanks for you work.
Hi,
I cannot make it work for the new version 2. Do I need any extra dependency? I'm using macos version.
Thanks a lot,
Cheers
Since v1.0.0 this plugin supports yarn add
command, like this:
Now I am going to add more frequently installed packages, which will provide better out-of-the-box for most users.
Those packages can be both dependencies
and dev_dependencies
(in package.json
it is devDependencies
).
Anyone can add comments to share some frequently installed packages or famous packages.
Also you can send a PR directly. The packages names are defined in https://github.com/g-plane/zsh-yarn-autocompletions/blob/master/src/deps/packages.rs . Remember adding trailing comma for better git diff.
Hello,
Per the docs: https://yarnpkg.com/getting-started/qa#how-to-share-scripts-between-workspaces, a script containing :
is available from other workspaces (but only if is is defined only once, else yarn doesn't know which one to resolve).
Do you think the plugin could also:
:
in their nameThanks in advance and have a nice day
The release workflow using github actions doesn't insert the version in the filename for the release assets. This breaks the zplug.sh
hook build script.
Also, looks like the OS in the file names generated by the release workflow have a -latest
suffix as well.
Hi there!
I'm curious what the differences in goals and current features are between this and https://github.com/mklabs/yarn-completions?
Thanks,
Olly
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
Download https://github.com/g-plane/zsh-yarn-autocompletions/releases/download/v2.0.0/yarn-autocompletions_linux.tar.gz
Extract files, and look at the contents of yarn-autocompletions.plugin.zsh
.
It does not contain the fix made in #22.
Actual content of file is:
YARN_AUTO_COMP_PATH="$(dirname $0)/yarn-autocompletions"
_yarn_autocompletions() {
compls=$($YARN_AUTO_COMP_PATH $1)
completions=(${=compls})
compadd -- $completions
}
_yarn() {
case $words[2] in
add)
if [[ $words[3] == "--dev" ]]
then
_yarn_autocompletions "add-dev"
else
_yarn_autocompletions "add"
fi
;;
remove)
_yarn_autocompletions "remove"
;;
upgrade)
_yarn_autocompletions "remove"
;;
why)
_yarn_autocompletions "why"
;;
*)
_yarn_autocompletions "scripts"
;;
esac
}
I haven't checked the other release artifacts, but they could have the same problem?
Will be great to automate installation as Homebrew formulare distribution, so it could be installed on Mac OS with one command brew install zsh-yarn-autocompletions
.
For example, if I run
yarn ts-node -- ./s<tab>
I get no completion suggestions
Pressing yarn run <tab> <tab>
does not list commands that have a :
in their name. For example a package.json
with the following scripts
does not display the start:dev
and test:watch
commands.
{
"scripts": {
"start": "node .",
"start:dev": "webpack-dev-server",
"test": "jest",
"test:watch": "yarn test --watch",
}
}
You are a careless man. You lose the "-latest" in url="https://github.com/g-plane/zsh-yarn-autocompletions/releases/download/v$version/yarn-autocompletions_$platform.zip"
. So installed by plugin-manager show 404.
It should be:
url="https://github.com/g-plane/zsh-yarn-autocompletions/releases/download/v$version/yarn-autocompletions_$platform-latest.zip
Hey, this is a very cool plugin!
However when I type yarn a
it doesn't autocomplete it to yarn add
. This is a pitty, as autocompletion for custom yarn scripts works just fine. Would it be possible to add the built-in commands like add
and remove
to the list?
This should be the complete list of built-in commands:
access, add, audit, autoclean, bin, cache, check,
config, create, exec, generate-lock-entry, global,
help, import, info, init, install, licenses, link,
list, login, logout, node, outdated, owner, pack,
publish, remove, run, tag, team, unlink, unplug,
upgrade, upgrade-interactive, version, versions,
why, workspace, workspaces
Hi, @g-plane. Thanks for this plugin, it's really useful.
I was just wondering, why you didn't publish the compiled files?
I'm not sure if everyone will be willing to install Rust in order to use the plugin. (I was, but a co-worker wasn't, I sent him the compiled files and he's using it too)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.