Skip to content

Commit

Permalink
Use node-fetch rather than got to support node 6 (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone authored Feb 1, 2019
1 parent 1979021 commit bb8a2d6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/gen/nodejs-templates/package.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions pkg/gen/nodejs-templates/provider.ts.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<string>;
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());
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<string>;
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());
}
Expand Down

0 comments on commit bb8a2d6

Please sign in to comment.