From 3cea0191a86961b98d357f4f9072e8bd2b34a7c0 Mon Sep 17 00:00:00 2001 From: Adam Jones Date: Thu, 11 Nov 2021 23:48:29 +0000 Subject: [PATCH 1/2] Use https URL for accessing NPM registry data Currently dts-gen is broken as it attempts to access the registry by http, which results in a 301 to https. This fixes that error by using https in the first place. --- lib/definitely-typed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/definitely-typed.ts b/lib/definitely-typed.ts index e2cd325..0bf7b12 100644 --- a/lib/definitely-typed.ts +++ b/lib/definitely-typed.ts @@ -48,7 +48,7 @@ async function getIndex(content: string, packageName: string): Promise { "(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 = JSON.parse(await loadString(`http://registry.npmjs.org/${packageName}`)); + const reg: Registry = JSON.parse(await loadString(`https://registry.npmjs.org/${packageName}`)); const { latest } = reg["dist-tags"]; const { homepage } = reg.versions[latest]; From df5c68209012b6e2432d3e98c88a2162fd1d99df Mon Sep 17 00:00:00 2001 From: Adam Jones Date: Thu, 11 Nov 2021 23:54:03 +0000 Subject: [PATCH 2/2] Update definitely-typed.ts --- lib/definitely-typed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/definitely-typed.ts b/lib/definitely-typed.ts index 0bf7b12..e4fd205 100644 --- a/lib/definitely-typed.ts +++ b/lib/definitely-typed.ts @@ -1,5 +1,5 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs'; -import { get, STATUS_CODES } from "http"; +import { get, STATUS_CODES } from "https"; import { homedir } from 'os'; import parseGitConfig = require('parse-git-config'); import { join as joinPaths } from "path";