From bb8a2d615b50d112f4cab648907489507ed407ab Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Fri, 1 Feb 2019 12:52:10 -0700 Subject: [PATCH] Use `node-fetch` rather than `got` to support node 6 (#390) --- pkg/gen/nodejs-templates/package.json.mustache | 4 ++-- pkg/gen/nodejs-templates/provider.ts.mustache | 6 +++--- sdk/nodejs/package.json | 4 ++-- sdk/nodejs/provider.ts | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/gen/nodejs-templates/package.json.mustache b/pkg/gen/nodejs-templates/package.json.mustache index 056c21c53e..68f988fdec 100644 --- a/pkg/gen/nodejs-templates/package.json.mustache +++ b/pkg/gen/nodejs-templates/package.json.mustache @@ -23,8 +23,8 @@ "@types/glob": "^5.0.35", "mocha": "^5.2.0", "@types/mocha": "^5.2.5", - "got": "^9.5.0", - "@types/got": "^9.2.2" + "node-fetch": "^2.3.0", + "@types/node-fetch": "^2.1.4" }, "devDependencies": { "typescript": "^2.6.2", diff --git a/pkg/gen/nodejs-templates/provider.ts.mustache b/pkg/gen/nodejs-templates/provider.ts.mustache index fe0d4b24d8..50dbaba056 100644 --- a/pkg/gen/nodejs-templates/provider.ts.mustache +++ b/pkg/gen/nodejs-templates/provider.ts.mustache @@ -8,7 +8,7 @@ import * as inputApi from "./types/input"; import * as outputApi from "./types/output"; import * as jsyaml from "js-yaml"; import * as glob from "glob"; -import * as got from "got"; +import fetch from "node-fetch"; export namespace yaml { export interface ConfigGroupOpts { @@ -197,10 +197,10 @@ export namespace yaml { export class ConfigFile extends CollectionComponentResource { constructor(name: string, config?: ConfigFileOpts, opts?: pulumi.ComponentResourceOptions) { super("kubernetes:yaml:ConfigFile", name, config, opts); - const fileId = config && config.file || name + const fileId = config && config.file || name; let text: Promise; if (fileId.startsWith("http://") || fileId.startsWith("https://")) { - text = got(fileId).then(r => r.body) + text = fetch(fileId).then(r => r.text()) } else { text = Promise.resolve(fs.readFileSync(fileId).toString()); } diff --git a/sdk/nodejs/package.json b/sdk/nodejs/package.json index 056c21c53e..68f988fdec 100755 --- a/sdk/nodejs/package.json +++ b/sdk/nodejs/package.json @@ -23,8 +23,8 @@ "@types/glob": "^5.0.35", "mocha": "^5.2.0", "@types/mocha": "^5.2.5", - "got": "^9.5.0", - "@types/got": "^9.2.2" + "node-fetch": "^2.3.0", + "@types/node-fetch": "^2.1.4" }, "devDependencies": { "typescript": "^2.6.2", diff --git a/sdk/nodejs/provider.ts b/sdk/nodejs/provider.ts index 83f97d4583..9de1a17e1d 100755 --- a/sdk/nodejs/provider.ts +++ b/sdk/nodejs/provider.ts @@ -8,7 +8,7 @@ import * as inputApi from "./types/input"; import * as outputApi from "./types/output"; import * as jsyaml from "js-yaml"; import * as glob from "glob"; -import * as got from "got"; +import fetch from "node-fetch"; export namespace yaml { export interface ConfigGroupOpts { @@ -2041,10 +2041,10 @@ export namespace yaml { export class ConfigFile extends CollectionComponentResource { constructor(name: string, config?: ConfigFileOpts, opts?: pulumi.ComponentResourceOptions) { super("kubernetes:yaml:ConfigFile", name, config, opts); - const fileId = config && config.file || name + const fileId = config && config.file || name; let text: Promise; if (fileId.startsWith("http://") || fileId.startsWith("https://")) { - text = got(fileId).then(r => r.body) + text = fetch(fileId).then(r => r.text()) } else { text = Promise.resolve(fs.readFileSync(fileId).toString()); }