简体   繁体   English

在 react 中使用 fork 的开源项目

[英]Use forked open-source project in react

So I'm needing to fork from "react-d3-graph" in order to implement and correct some features for a project I'm working on, ie zoom and highlightDegree, and implement it into my react project.因此,我需要从“react-d3-graph”中分叉,以便为我正在处理的项目实现和更正某些功能,即缩放和高亮度,并将其实现到我的反应项目中。

I've got the project forked into my personal GitHub, I'm just unsure on how I'd implement my version instead of the original in my React project.我已将该项目分叉到我的个人 GitHub 中,我只是不确定如何在我的 React 项目中实现我的版本而不是原始版本。

You need to update your package.json to point to your forked github repo instead of the version number of react-d3-graph.您需要更新您的package.json以指向您的分叉 github 存储库,而不是 react-d3-graph 的版本号。 Replace:代替:

  "react-d3-graph": "x.y.z"

with

  "react-d3-graph": "your_github_username/react-d3-graph"

Then run npm install .然后运行npm install

From then on, it will use your version rather than the original.从那时起,它将使用您的版本而不是原始版本。

PS: note that npm's support for github dependencies is far from perfect. PS:请注意, npm 对 github 依赖项的支持远非完美。 I still run into some issues with it every once in a while.我仍然偶尔会遇到一些问题。 Obviously, you will also need to re-run npm install any time you make changes to the repo.显然,您还需要在对存储库进行任何更改时重新运行npm install But that said, it works.但这就是说,它有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM