cli icon indicating copy to clipboard operation
cli copied to clipboard

Make package name required for "link"

Open grabbou opened this issue 7 years ago • 47 comments

When you don't pass a package name to the "react-native link", it will try to look for all packages to link from your node_modules.

This is causing us a lot of issues, such as linking wrong packages or the ones that someone doesn't want to link (e.g. decided to use a different way of linking that is out of scope for this command).

We should simply stick to requiring package name.

grabbou avatar Dec 15 '18 10:12 grabbou

Maybe having a react-native link assets command so we could link fonts would be good?

And what will happen when one installs a package named "assets"? boom

vandervidi avatar Mar 26 '19 18:03 vandervidi

Maybe let link without arguments link assets by default, and simply stop linking all other things. That seems most sensual to me

RWOverdijk avatar Mar 26 '19 18:03 RWOverdijk

Sensible*... Phones.

RWOverdijk avatar Mar 26 '19 18:03 RWOverdijk

If you look closely into the PR (https://github.com/react-native-community/react-native-cli/pull/101) it already introduces link-assets command.

Esemesek avatar Mar 26 '19 18:03 Esemesek

@vandervidi it was just an example. I agree that link-assets is better.

josmithua avatar Mar 26 '19 20:03 josmithua

I did link all because I needed to reset my project since I'm upgrading from a somewhat old version.

RichardLindhout avatar Mar 26 '19 22:03 RichardLindhout

agree with @sm1th link-assets is a better option

ghost avatar Mar 27 '19 08:03 ghost

It shouldn't be deprecated. The current commands are better. Those who want to to link any specific packages can link individually, while others could do it all at once with a single command.

ebin-es avatar Mar 27 '19 12:03 ebin-es

Why to deprecate? We have the option if someone want to link particular package then he/she can do that also. If you have 30 libraries and you want to link them all in one go then you can do it with react-native link and if you want specific then you can do that also, then what is the need of removal?????

For Assets i feel there should be option, if someone only want to link assets.

rf1804 avatar Mar 28 '19 13:03 rf1804

We decided not to introduce this change because the link command will be deprecated soon in favor of autolinking feature. Right now we are working on it, and it should be available in 0.60.0.

Esemesek avatar Mar 28 '19 18:03 Esemesek

I use it because some things need to be linked but I never really know what

carinlynchin avatar Apr 25 '19 13:04 carinlynchin

When you have a react native project and have to migrate to a new installation one run react-native link to link all dependencies, imagine if you have to linked them all manually, or when you want to copy bunch of package from an old package.json to a new package.json and some of them need to be linked, react-native link is a great tool

epileftro85 avatar May 07 '19 12:05 epileftro85

for a most of my new react native project i add a bunch of dependency which is some of that require to linking after that i just one time use react native link and it resolve all native issues.

expect that we are linking custom font with react native link. how can be link custom font with package name ??

hemedani avatar May 08 '19 07:05 hemedani

如果移除了,那么 react-native-template 项目怎么办

youngjunning avatar May 28 '19 03:05 youngjunning

@Esemesek what's the path moving forward for autolinking? I'm having linking issues with local fonts, could be a race condition in 0.59.8.

I get a lot of, changes font file names listed on every run

debug Error: EBUSY: resource busy or locked, unlink

skhameneh avatar Jun 03 '19 17:06 skhameneh

I double checked, 0.59.X and higher give me race conditions when linking on Windows.
0.58.X has the pathing bug on windows that causes Windows paths (\) to be linked.

skhameneh avatar Jun 03 '19 20:06 skhameneh

@skhameneh whole you're investigating that, would you mind sending a PR with a fix? We don't use Windows for development unfortunately and that would much appreciated

thymikee avatar Jun 04 '19 06:06 thymikee

@thymikee I don't have a fix at the moment.
I found killing adb.exe releases some of the file locks on my fonts.

Here's some extra info for possible repro:

$ adb --version
Android Debug Bridge version 1.0.41
Version 28.0.3-5475833
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.59.8

skhameneh avatar Jun 04 '19 15:06 skhameneh

react-native link doesn't link fonts for now. react-native: 0.59.8

justynasowinska avatar Jun 12 '19 09:06 justynasowinska

@justynasowinska can you share a minimal repro so we can investigate what's the issue?

thymikee avatar Jun 12 '19 11:06 thymikee