mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Don't print out a stacktrace when a package is not on NPM. (#13342)
This commit is contained in:
parent
3a73c98ef7
commit
50f1ae86af
@ -49,7 +49,7 @@ function getIndex() {
|
||||
let version = "x.x";
|
||||
let project = "https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)";
|
||||
try {
|
||||
const reg = yield loadString(`http://registry.npmjs.org/${newPackageName}`).then(JSON.parse);
|
||||
const reg = JSON.parse(yield loadString(`http://registry.npmjs.org/${newPackageName}`));
|
||||
const { latest } = reg["dist-tags"];
|
||||
const { homepage } = reg.versions[latest];
|
||||
version = latest.split(".").slice(0, 2).join(".");
|
||||
@ -57,7 +57,7 @@ function getIndex() {
|
||||
project = homepage;
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(`Could not retrieve version/homepage information: ${e.stack}`);
|
||||
console.warn(`Warning: could not retrieve version/homepage information: ${e.message}`);
|
||||
}
|
||||
return `// Type definitions for ${newPackageName} ${version}
|
||||
// Project: ${project}
|
||||
|
||||
@ -55,7 +55,7 @@ async function getIndex() {
|
||||
let version = "x.x"
|
||||
let project = "https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)"
|
||||
try {
|
||||
const reg: Registry = await loadString(`http://registry.npmjs.org/${newPackageName}`).then(JSON.parse)
|
||||
const reg: Registry = JSON.parse(await loadString(`http://registry.npmjs.org/${newPackageName}`))
|
||||
|
||||
const { latest } = reg["dist-tags"]
|
||||
const { homepage } = reg.versions[latest]
|
||||
@ -63,7 +63,7 @@ async function getIndex() {
|
||||
version = latest.split(".").slice(0, 2).join(".")
|
||||
if (homepage !== undefined) project = homepage
|
||||
} catch (e) {
|
||||
console.warn(`Could not retrieve version/homepage information: ${e.stack}`)
|
||||
console.warn(`Warning: could not retrieve version/homepage information: ${e.message}`)
|
||||
}
|
||||
|
||||
return `// Type definitions for ${newPackageName} ${version}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user