|
2 | 2 |
|
3 | 3 | import chalk from 'chalk' |
4 | 4 | import meow from 'meow' |
5 | | -import fetch from 'node-fetch' |
6 | 5 | import ora from 'ora' |
7 | 6 |
|
8 | 7 | import { outputFlags, validationFlags } from '../../flags/index.js' |
@@ -48,9 +47,9 @@ export const info = { |
48 | 47 | * @param {string} description |
49 | 48 | * @param {readonly string[]} argv |
50 | 49 | * @param {ImportMeta} importMeta |
51 | | - * @returns {Promise<void|CommandContext>} |
| 50 | + * @returns {void|CommandContext} |
52 | 51 | */ |
53 | | -async function setupCommand (name, description, argv, importMeta) { |
| 52 | +function setupCommand (name, description, argv, importMeta) { |
54 | 53 | const flags = { |
55 | 54 | ...outputFlags, |
56 | 55 | ...validationFlags, |
@@ -95,19 +94,8 @@ async function setupCommand (name, description, argv, importMeta) { |
95 | 94 |
|
96 | 95 | let pkgVersion, pkgName |
97 | 96 | if (versionSeparator < 1) { |
98 | | - // Get the latest version |
99 | | - try { |
100 | 97 | pkgName = rawPkgName |
101 | | - const response = await fetch(`https://registry.npmjs.org/${rawPkgName}/latest`) |
102 | | - /** @type any */ |
103 | | - const packageDetails = await response.json() || null |
104 | | - |
105 | | - if (packageDetails?.version) { |
106 | | - pkgVersion = packageDetails.version |
107 | | - } |
108 | | - } catch (e) { |
109 | | - throw new Error('Issue fetching package version') |
110 | | - } |
| 98 | + pkgVersion = 'latest' |
111 | 99 | } else { |
112 | 100 | pkgName = rawPkgName.slice(0, versionSeparator) |
113 | 101 | pkgVersion = rawPkgName.slice(versionSeparator + 1) |
|
0 commit comments