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

chore(rules): add yarn alias #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

chore(rules): add yarn alias #119

wants to merge 1 commit into from

Conversation

rodweb
Copy link

@rodweb rodweb commented Feb 25, 2021

Add missing alias for yarn config

@doron-cohen
Copy link
Owner

Thanks @rodweb . Could you link to any reference for this CLI flag? Documentation or commit.

@rodweb
Copy link
Author

rodweb commented Feb 25, 2021

--use-yarnrc specifies a yarnrc file that Yarn should use (.yarnrc only, not .npmrc) (default: )```

I got it from running yarn help

$ yarn --version
1.22.10

edit: https://github.com/yarnpkg/yarn/blob/3119382885ea373d3c13d6a846de743eca8c914b/src/cli/index.js#L74-L79
It seems this option is for v1 only, I haven't tested yarn v2 yet.

@doron-cohen
Copy link
Owner

Question is if yarn v2 will fail to launch over bad usage for that. Kind of risky.

@rodweb
Copy link
Author

rodweb commented Feb 26, 2021

Yean, it fails.

❯ alias yarn
yarn='yarn --use-yarnrc /home/rod/.config/yarn/config'
❯ yarn --version
Unknown Syntax Error: Command not found; did you mean one of:

The current migration of .yarnrc only applies to v1 too. In v2 it is called .yarnrc.yml

But I'm not sure how you'd like to handle multiple versions.

Another related problem, antidot clean can't remove the dir ~/.yarn because there is a bin folder inside, which does not seem to be part of the XDG efforts on yarn. You have to configure the bin dir on yarn config file.

@doron-cohen
Copy link
Owner

First, we can add a rule for .yarnrc.yml to cover yarn v2 as well. Second, we can always use the migrate action with symlink: true which will create a symlink to the new location.

About the bin dir. I never expect all files to be safely migratable. I focus on the apps that actually give yo the option to move their files. For the rest I just open issues in their repos.

@Grafcube
Copy link
Contributor

Adding this to rules.yaml seems to work for .yarnrc for me

      - type: alias
        alias: yarn
        command: yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"

However, running clean on .yarn results in this output

File $HOME/.yarn/link doesn't exist. Skipping action
File $HOME/.yarn/global doesn't exist. Skipping action
File $HOME/.yarn/config doesn't exist. Skipping action
WARNING: Failed to run rule yarn: remove $HOME/.yarn: directory not empty

I've only ever used yarn for building AUR packages and installing language servers for neovim. I'm not very familiar with it so I don't know how to fix 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.

3 participants