Skip to content

Commit

Permalink
add unplugged to berry dependency metadata struct (vercel#2646)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-olszewski authored Nov 9, 2022
1 parent 79bb351 commit bd0864b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cli/internal/lockfile/berry_lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ type BerryLockfile struct {

// BerryDependencyMetaEntry Structure for holding if a package is optional or not
type BerryDependencyMetaEntry struct {
Optional bool `yaml:"optional,omitempty"`
Optional bool `yaml:"optional,omitempty"`
Unplugged bool `yaml:"unplugged,omitempty"`
}

var _ Lockfile = (*BerryLockfile)(nil)
Expand Down Expand Up @@ -681,14 +682,17 @@ func _stringifyDepsMeta(meta map[string]BerryDependencyMetaEntry) string {
sort.Strings(keys)

lines := make([]string, 0, len(meta))
addLine := func(name string) {
lines = append(lines, fmt.Sprintf(" %s:\n optional: true", _wrapString(name)))
addLine := func(name string, key string) {
lines = append(lines, fmt.Sprintf(" %s:\n %s: true", _wrapString(name), key))
}

for _, name := range keys {
optional := meta[name]
if optional.Optional {
addLine(name)
addLine(name, "optional")
}
if optional.Unplugged {
addLine(name, "unplugged")
}
}

Expand Down
3 changes: 3 additions & 0 deletions cli/internal/lockfile/testdata/berry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,9 @@ eslint-config-turbo@latest:
resolution: "eslint-module-utils@npm:2.7.4"
dependencies:
debug: ^3.2.7
dependenciesMeta:
[email protected]:
unplugged: true
peerDependenciesMeta:
eslint:
optional: true
Expand Down

0 comments on commit bd0864b

Please sign in to comment.