-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: support dependencies tree #287
Conversation
生成的依赖树长这样: https://github.com/cnpm/npminstall/pull/287/files#diff-5dfb1861470b074a897f48b8ceebe59d @welladamm 其实 npminstall 在安装的时候就保留好信息了,你看看这份数据是否可以替换掉 @ali/deps-tree 的生成?后面我们也只需要生成一份了。 |
Codecov Report
@@ Coverage Diff @@
## master #287 +/- ##
==========================================
- Coverage 92.9% 92.84% -0.06%
==========================================
Files 27 27
Lines 1916 1943 +27
Branches 325 329 +4
==========================================
+ Hits 1780 1804 +24
- Misses 136 139 +3
Continue to review full report at Codecov.
|
lib/local_install.js
Outdated
|
||
const cache = {}; | ||
for (const key in options.cache) { | ||
if (!key.match(/^npm:resolve:version:/)) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key startsWith 会更快吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恩,之前不记得 node 4 支不支持了。
把这些缓存单独放到 cache.dependenciesTree
上了,更合理一点。
@coolme200 用来解决快速修复问题的迭代?不重新安装依赖? |
closes #286 |
@fengmk2 还有异步构建 source map 的场景也需要复原 node_modules |
对 |
+1 |
--save-dependencies-tree
开启依赖树生成,生成的依赖树位于node_modules/.dependencies_tree.json
--dependencies-tree=.dependencies_tree.json
来指定从生成的依赖树恢复注意:只会保存 npm resolve 的依赖树,从远程地址或者 git 仓库拉下来的没有 semver,也不会保存下来,生成的依赖树文件在 1~5MB 左右,所以生成保存后打包时要清理掉。
/cc @coolme200