Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
charliegerard committed Nov 28, 2023
1 parent 860c894 commit 7cd2a4f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 83 deletions.
18 changes: 3 additions & 15 deletions lib/commands/info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import chalk from 'chalk'
import meow from 'meow'
import fetch from 'node-fetch'
import ora from 'ora'

import { outputFlags, validationFlags } from '../../flags/index.js'
Expand Down Expand Up @@ -48,9 +47,9 @@ export const info = {
* @param {string} description
* @param {readonly string[]} argv
* @param {ImportMeta} importMeta
* @returns {Promise<void|CommandContext>}
* @returns {void|CommandContext}
*/
async function setupCommand (name, description, argv, importMeta) {
function setupCommand (name, description, argv, importMeta) {
const flags = {
...outputFlags,
...validationFlags,
Expand Down Expand Up @@ -95,19 +94,8 @@ async function setupCommand (name, description, argv, importMeta) {

let pkgVersion, pkgName
if (versionSeparator < 1) {
// Get the latest version
try {
pkgName = rawPkgName
const response = await fetch(`https://registry.npmjs.org/${rawPkgName}/latest`)
/** @type any */
const packageDetails = await response.json() || null

if (packageDetails?.version) {
pkgVersion = packageDetails.version
}
} catch (e) {
throw new Error('Issue fetching package version')
}
pkgVersion = 'latest'
} else {
pkgName = rawPkgName.slice(0, versionSeparator)
pkgVersion = rawPkgName.slice(versionSeparator + 1)
Expand Down
67 changes: 0 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"is-interactive": "^2.0.0",
"is-unicode-supported": "^1.3.0",
"meow": "^12.0.1",
"node-fetch": "^3.3.2",
"ora": "^6.1.2",
"pony-cause": "^2.1.8",
"prompts": "^2.4.2",
Expand Down

0 comments on commit 7cd2a4f

Please sign in to comment.