-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: miss
Root
field in npm/yarn/pnpm
- Loading branch information
fengzhangchi
committed
Aug 23, 2023
1 parent
42e46f4
commit a8ef0e9
Showing
3 changed files
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,7 @@ func (m *Pnpm) GetRootModule(path string) (*meta.Package, error) { | |
return &meta.Package{}, err | ||
} | ||
mod := &meta.Package{} | ||
mod.Root = true | ||
|
||
if pkResult["name"] != nil { | ||
mod.Name = pkResult["name"].(string) | ||
|
@@ -380,6 +381,12 @@ func extractVersion(s string) string { | |
} | ||
|
||
func splitPackageNameAndVersion(pkg string) (string, string, string) { | ||
// sample input | ||
// 1. /@byted-cmf/data-plugin-indexeddb-storage-client/2.0.4_e239e53d72e8372ca29c63c7108bdc0f | ||
// 2. /esprima/1.2.5 | ||
// 3. /@dp/sirius-view/3.7.131 | ||
// 4. /@babel/plugin-syntax-json-strings/7.8.3_@[email protected] | ||
|
||
// Remove parentheses and content inside | ||
parts := strings.Split(pkg, "(") | ||
pkg = parts[0] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters