You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ke...@apache.org on 2022/06/29 08:16:38 UTC
[skywalking-eyes] branch npm/prune created (now 004a683)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a change to branch npm/prune
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
at 004a683 Prune packages before listing all dependencies
This branch includes the following new commits:
new 004a683 Prune packages before listing all dependencies
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[skywalking-eyes] 01/01: Prune packages before listing all dependencies
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch npm/prune
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
commit 004a683a225534e78b8060d677a5cf33f5248209
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Jun 29 16:16:27 2022 +0800
Prune packages before listing all dependencies
---
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