| 9 | const packagePath = `${cwd}/package.json`; |
| 10 | |
| 11 | async function getOutdated() { |
| 12 | return /** @type {Promise<object | null>} */(new Promise((resolve, reject) => { |
| 13 | exec('npm outdated --json', {cwd}, (error, stdout) => { |
| 14 | const packages = JSON.parse(stdout.toString()); |
| 15 | if (typeof packages !== 'object') { |
| 16 | log.error('Failed to check for dependencies'); |
| 17 | reject(); |
| 18 | return; |
| 19 | } |
| 20 | if (Object.keys(packages).length === 0) { |
| 21 | log.error('All dependencies are already up to date'); |
| 22 | reject(); |
| 23 | return; |
| 24 | } |
| 25 | resolve(packages); |
| 26 | }); |
| 27 | })); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * |