简体   繁体   English

分叉的npm / Angular 8软件包安装方式不同原始版本

[英]Forked npm / Angular 8 package not installing the same way Original version

I have been using git / forking / branching / pull requests and npm for a while now for standard nodejs work and have not much issue. 我已经使用git / forking / branch / pull请求和npm了一段时间,现在已经可以用于标准的nodejs工作了,没有太大的问题。 However, when I attempt to Fork an Angular repo and install this forked version in my project I get different content in the node_modules folder. 但是,当我尝试分叉Angular存储库并将此分叉版本安装到我的项目中时,在node_modules文件夹中会得到不同的内容。

The original repo - angular2-tree-diagram - https://github.com/artbelikov/angular2-tree-diagram.git 原始回购-angular2-tree-diagram- https://github.com/artbelikov/angular2-tree-diagram.git

The forked version - thxmike/angular2-tree-diagram - https://github.com/thxmike/angular2-tree-diagram.git 分叉版本-thxmike / angular2-tree-diagram- https://github.com/thxmike/angular2-tree-diagram.git

I install the original repo with the following command: 我使用以下命令安装原始存储库:

npm install angular2-tree-diagram --save

This installs the content from the src/ directory 这将从src /目录安装内容

However if I install my Forked verion using the following command: 但是,如果我使用以下命令安装Forked版本,则:

npm install thxmike/angular2-tree-diagram --save

This install the entire repo 这将安装整个仓库

The angular.json, tsconfig.app and package.json are almost identical as far as pathing so I am confused on why the differences in the installation. 从路径角度来看,angular.json,tsconfig.app和package.json几乎相同,因此我对为什么安装有所不同感到困惑。

I have tried a few different changes such as what is documented here: npm install and build of forked github repo but I have not had much success. 我尝试了一些不同的更改,例如此处记录的内容: npm安装和构建派生的github存储库,但是我没有取得太大的成功。

I am not sure if this is something specific with Angular or I am just missing a detail that I can't see. 我不确定这是否是Angular的特定功能,或者我只是缺少一个看不见的细节。

Any assistance in this matter would be appreciated. 在这方面的任何协助将不胜感激。

After more digging, thinking through the process and a little common sense, I found that the issue lies how the original project was registered and published to npm. 经过更深入的研究,仔细考虑了整个过程和一些常识,我发现问题出在原始项目如何注册并发布到npm。

Even though the original source code lives in Github, the registration/publication of the project was done from the separate /src directory. 即使原始源代码位于Github中,该项目的注册/发布也是在单独的/ src目录中完成的。 So it only included files from this direct. 因此,它仅包含此直接文件。 This means whenever I ran the following command: 这意味着每当我运行以下命令时:

npm install angular2-tree-diagram --save

This was pulling down the zip file from the npm registry and laying out the files from the /src directory, that were inside of the npm package. 这是从npm注册表中拉出zip文件,并从/ src目录中布置npm包中的文件。

Even though I forked the project, I did not have a corresponding registration/publication in npm to pull down, so when I ran the following command: 即使我分叉了该项目,我在npm中也没有相应的注册/发布来进行下拉,因此当我运行以下命令时:

npm install thxmike/angular2-tree-diagram --save

It was pulling it directly from the forked repo (ie thxmike/) and pulling down all the files I had specified in the repo. 它是直接从派生的仓库(例如thxmike /)中提取文件,并提取我在仓库中指定的所有文件。

I should have seen this earlier. 我应该早点看过。 Hopefully someone else can benefit from this obvious oversight. 希望其他人可以从这种明显的监督中受益。

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

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