MCPcopy Create free account
hub / github.com/npm/cli / packagesChangedMessage

Function packagesChangedMessage

lib/utils/reify-output.js:177–221  ·  view source on GitHub ↗
(npm, { added, removed, changed, audited })

Source from the content-addressed store, hash-verified

175}
176
177const packagesChangedMessage = (npm, { added, removed, changed, audited }) => {
178 const msg = ['\n']
179 if (added === 0 && removed === 0 && changed === 0) {
180 msg.push('up to date')
181 if (audited) {
182 msg.push(', ')
183 }
184 } else {
185 if (added) {
186 msg.push(`added ${added} package${added === 1 ? '' : 's'}`)
187 }
188
189 if (removed) {
190 if (added) {
191 msg.push(', ')
192 }
193
194 if (added && !audited && !changed) {
195 msg.push('and ')
196 }
197
198 msg.push(`removed ${removed} package${removed === 1 ? '' : 's'}`)
199 }
200 if (changed) {
201 if (added || removed) {
202 msg.push(', ')
203 }
204
205 if (!audited && (added || removed)) {
206 msg.push('and ')
207 }
208
209 msg.push(`changed ${changed} package${changed === 1 ? '' : 's'}`)
210 }
211 if (audited) {
212 msg.push(', and ')
213 }
214 }
215 if (audited) {
216 msg.push(`audited ${audited} package${audited === 1 ? '' : 's'}`)
217 }
218
219 msg.push(` in ${ms(Date.now() - npm.started)}`)
220 output.standard(msg.join(''))
221}
222
223const packagesFundingMessage = (npm, { funding }) => {
224 if (!funding) {

Callers 1

reifyOutputFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected