-
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
fix: install local folder use npm pack #330
Conversation
return await utils.copyInstall(filepath, options); | ||
try { | ||
// use npm pack to ensure npmignore/gitignore/package.files work fine | ||
const res = await cp.exec('npm pack', { cwd: filepath }); |
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.
万一 npm 命令不存在呢?
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.
不存在会 fallback 到老的逻辑
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.
老的逻辑安装是没问题的,不过在有些场景下会比较慢。
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.
我们自己去实现 pack 的过滤逻辑,要读 files/.npmignore/.gitignore,还有各种默认打包进去的规则,不太靠谱,而且绝大部分的运行环境肯定有 npm 的,只要有 node 就有 npm。
CI 过了, @fengmk2 |
Codecov Report
@@ Coverage Diff @@
## master #330 +/- ##
==========================================
+ Coverage 93.04% 93.08% +0.03%
==========================================
Files 30 30
Lines 1928 1938 +10
==========================================
+ Hits 1794 1804 +10
Misses 134 134
Continue to review full report at Codecov.
|
4.9.1 |
之前的目录中可能有 node_modules 等不需要的文件,通过 npm pack 来打包,如果没有 npm,fallback 到直接 copy