(title: string, deps?: Record<string, string>)
| 225 | } |
| 226 | |
| 227 | const renderDeps = (title: string, deps?: Record<string, string>) => { |
| 228 | const names = Object.keys(deps || {}) |
| 229 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
| 230 | const someOutdatedInSection = names.some((n) => !!outdatedDeps[n]) |
| 231 | return ( |
| 232 | <div style={sectionStyle}> |
| 233 | <div |
| 234 | style={{ |
| 235 | display: 'flex', |
| 236 | alignItems: 'center', |
| 237 | justifyContent: 'space-between', |
| 238 | gap: 6, |
| 239 | }} |
| 240 | > |
| 241 | <h3 style={{ margin: 0, fontSize: 14 }}>{title}</h3> |
| 242 | {someOutdatedInSection ? <BulkActions names={names} /> : null} |
| 243 | </div> |
| 244 | <table style={tableStyle}> |
| 245 | <thead> |
| 246 | <tr> |
| 247 | <th style={thtd}>Package</th> |
| 248 | <th style={thtd}>Version</th> |
| 249 | <th style={thtd}>Status</th> |
| 250 | <th style={thtd}>Actions</th> |
| 251 | </tr> |
| 252 | </thead> |
| 253 | <tbody> |
| 254 | {Object.entries(deps || {}).map(([dep, version]) => { |
| 255 | const info = outdatedDeps[dep] as |
| 256 | | { |
| 257 | current: string |
| 258 | wanted: string |
| 259 | latest: string |
| 260 | type?: 'dependencies' | 'devDependencies' |
| 261 | } |
| 262 | | undefined |
| 263 | const isOutdated = !!info && info.current !== info.latest |
| 264 | return ( |
| 265 | <tr key={dep}> |
| 266 | <td style={thtd}>{dep}</td> |
| 267 | <td style={thtd}> |
| 268 | <VersionCell dep={dep} specified={version} /> |
| 269 | </td> |
| 270 | <td style={thtd}> |
| 271 | {isOutdated |
| 272 | ? badge('Outdated', '#e11d48') |
| 273 | : badge('OK', '#10b981')} |
| 274 | </td> |
| 275 | <td style={thtd}> |
| 276 | {isOutdated ? <UpgradeRowActions name={dep} /> : null} |
| 277 | </td> |
| 278 | </tr> |
| 279 | ) |
| 280 | })} |
| 281 | </tbody> |
| 282 | </table> |
| 283 | </div> |
| 284 | ) |
no test coverage detected