Skip to content

Commit 958b10e

Browse files
authored
fix: move config.list to a getter (#8761)
There is no need to build this every time for a single command that needs it (`npm config list`). It will also allow us to mutate this.data without having to worry about this.
1 parent 7da8fdd commit 958b10e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

workspaces/config/lib/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,21 @@ class Config {
132132

133133
this.sources = new Map([])
134134

135-
this.list = []
136135
for (const { data } of this.data.values()) {
137136
this.list.unshift(data)
138137
}
139-
Object.freeze(this.list)
140138

141139
this.#loaded = false
142140
}
143141

142+
get list () {
143+
const list = []
144+
for (const { data } of this.data.values()) {
145+
list.unshift(data)
146+
}
147+
return list
148+
}
149+
144150
get loaded () {
145151
return this.#loaded
146152
}

0 commit comments

Comments
 (0)