This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
The following commit(s) were added to refs/heads/main by this push:
new f461a46 Prune packages before listing all dependencies (#119)
f461a46 is described below
commit f461a46e74e5fa22e9f9599a355ab4f0ac265469
Author: kezhenxu94 <[email protected]>
AuthorDate: Wed Jun 29 16:22:40 2022 +0800
Prune packages before listing all dependencies (#119)
---
pkg/deps/npm.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pkg/deps/npm.go b/pkg/deps/npm.go
index c1d97dd..129534e 100644
--- a/pkg/deps/npm.go
+++ b/pkg/deps/npm.go
@@ -143,6 +143,13 @@ func (resolver *NpmResolver) InstallPkgs() {
// Note that although the flag `--long` can show more information line like a
package's name,
// its realization and printing format is not uniform in different npm-cli
versions
func (resolver *NpmResolver) ListPkgPaths() (io.Reader, error) {
+ pruneCmd := exec.Command("npm", "prune", "--production")
+ pruneCmd.Stderr = io.Discard
+ pruneCmd.Stdout = io.Discard
+ if err := pruneCmd.Run(); err != nil {
+ logger.Log.Debug("Failed to prune npm packages")
+ }
+
buffer := &bytes.Buffer{}
cmd := exec.Command("npm", "ls", "--all", "--production", "--parseable")
cmd.Stderr = os.Stderr