question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to auto link dependencies of a dependency?

See original GitHub issue

I want to share components of one app with the other and therefore moved them to a separate NPM package. The structure of this package looks like this:

- src
--- components
----- component A
----- component B
- package.json

Some components use other 3rd party libraries and they are listed in the package.json.

Now when installing that shared package to the second project these 3rd party dependencies are not auto linked. For example, when calling pod install they’re not installed.

Is it possible somehow install these 3rd party dependencies?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

7reactions
react-native-botcommented, Nov 21, 2019

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

👉 Click here if you want to report a reproducible bug or regression in React Native.

2reactions
phamducgiamcommented, Sep 28, 2020

We can patch function findDependencies in @react-native-community/cli as follow to enable auto link dependencies of dependency

function findDependencies(root) {
  let pjson;

  try {
    pjson = JSON.parse(_fs().default.readFileSync(_path().default.join(root, 'package.json'), 'UTF-8'));
  } catch (e) {
    return [];
  }

  const dependencies = Object.keys(pjson.dependencies || []);
  const subDeps = dependencies.reduce(function(accumulator, currentValue) {
    if (!currentValue.includes('your_dependency')) {
      return accumulator;
    }
    const subRoot = `${root}/node_modules/${currentValue}`;
    return accumulator.concat(findDependencies(subRoot));
  }, []);

  const deps = [...Object.keys(pjson.dependencies || {}), ...Object.keys(pjson.devDependencies || {}), ...subDeps];
  return deps;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to auto link dependencies of a dependency in React ...
We can patch function findDependencies in @react-native-community/cli as follow to enable auto link dependencies of dependency
Read more >
Dependencies on monday.com – Support
To start working with dependencies, you'll first need to add the Dependency Column onto your board. Using the Dependency Column, you'll be able ......
Read more >
Linking Dependencies in React Native: A Best Practices Guide
We'll go over the most beneficial practices to keep in mind to execute dependency when using the react native link tool.
Read more >
Adding package dependencies to your app - Apple Developer
Add a package dependency. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and...
Read more >
Creating task dependencies | Product guide ... - Asana
To remove a dependency, hover over an existing indication banner and click the X symbol that appears. Notifications. The assignee of the dependent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found