|
1 | | -import { exec as _exec } from 'child_process'; |
2 | | -import { promisify } from 'util'; |
| 1 | +import { execSync } from 'child_process'; |
3 | 2 | import { ToolkitError } from '@aws-cdk/toolkit-lib'; |
4 | 3 |
|
5 | | -const exec = promisify(_exec); |
6 | | - |
7 | 4 | /* c8 ignore start */ |
8 | 5 | export async function execNpmView(currentVersion: string) { |
9 | 6 | try { |
10 | | - // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism |
11 | | - const [latestResult, currentResult] = await Promise.all([ |
12 | | - exec('npm view aws-cdk@latest version', { timeout: 3000 }), |
13 | | - exec(`npm view aws-cdk@${currentVersion} name version deprecated --json`, { timeout: 3000 }), |
14 | | - ]); |
| 7 | + const latestResult = execSync('npm view aws-cdk@latest version', { timeout: 3000 }).toString(); |
| 8 | + const currentResult = execSync(`npm view aws-cdk@${currentVersion} name version deprecated --json`, { timeout: 3000 }).toString(); |
15 | 9 |
|
16 | | - if (latestResult.stderr && latestResult.stderr.trim().length > 0) { |
17 | | - throw new ToolkitError(`npm view command for latest version failed: ${latestResult.stderr.trim()}`); |
| 10 | + if (latestResult && latestResult.trim().length > 0) { |
| 11 | + throw new ToolkitError(`npm view command for latest version failed: ${latestResult.trim()}`); |
18 | 12 | } |
19 | | - if (currentResult.stderr && currentResult.stderr.trim().length > 0) { |
20 | | - throw new ToolkitError(`npm view command for current version failed: ${currentResult.stderr.trim()}`); |
| 13 | + if (currentResult && currentResult.trim().length > 0) { |
| 14 | + throw new ToolkitError(`npm view command for current version failed: ${currentResult.trim()}`); |
21 | 15 | } |
22 | 16 |
|
23 | | - const latestVersion = latestResult.stdout; |
24 | | - const currentInfo = JSON.parse(currentResult.stdout); |
| 17 | + const latestVersion = latestResult; |
| 18 | + const currentInfo = JSON.parse(currentResult); |
25 | 19 |
|
26 | 20 | return { |
27 | 21 | latestVersion: latestVersion, |
|
0 commit comments