MCPcopy
hub / github.com/serverless/serverless / printSummary

Function printSummary

packages/serverless/lib/utils/log-deprecation.js:103–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101export const defaultMode = 'warn:summary'
102
103export const printSummary = async () => {
104 if (!bufferedDeprecations.length) {
105 try {
106 await fsp.unlink(healthStatusFilename)
107 } catch {
108 // ignore
109 }
110 return
111 }
112
113 try {
114 const healthStatus = []
115
116 deprecationLogger.warning()
117
118 if (bufferedDeprecations.length === 1) {
119 healthStatus.push('1 deprecation triggered in the last command:', '')
120 deprecationLogger.warning(
121 style.aside(
122 "1 deprecation found: run 'serverless doctor' for more details",
123 ),
124 )
125 } else {
126 healthStatus.push(
127 `${bufferedDeprecations.length} deprecations triggered in the last command:`,
128 '',
129 )
130 deprecationLogger.warning(
131 style.aside(
132 `${bufferedDeprecations.length} deprecations found: run 'serverless doctor' for more details`,
133 ),
134 )
135 }
136 for (const { code, message } of bufferedDeprecations) {
137 healthStatus.push(message)
138 if (!code.startsWith('EXT_')) {
139 healthStatus.push(
140 style.aside(
141 `More info: https://serverless.com/framework/docs/deprecations/#${code}`,
142 ),
143 )
144 }
145 }
146
147 const tmpDir = await fsp.mkdtemp('sls-ld')
148
149 const tmpHealthStatusFilename = path.resolve(tmpDir, 'health-status')
150 await Promise.all([
151 fse.ensureDir(path.dirname(healthStatusFilename)),
152 fsp.writeFile(tmpHealthStatusFilename, healthStatus.join('\n')),
153 ])
154 try {
155 await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename)
156 } catch (error) {
157 if (error.code === 'EACCES') {
158 log.error(
159 'Cannot store information on approached deprecation. Please ensure process has write access to the ~/.serverless directory',
160 )

Callers

nothing calls this directly

Calls 6

safeMoveFileFunction · 0.85
warningMethod · 0.80
asideMethod · 0.80
resolveMethod · 0.80
writeFileMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…