Skip to content

Commit

Permalink
Add a sort to the directory read for helm fetch
Browse files Browse the repository at this point in the history
fs.readdirSync() currently will return an ordered array, but it's not
expected behaviour (see nodejs/node#3232)

In order to bring parity to all the SDKs, I've added an explicit sort to
the returned array
  • Loading branch information
jaxxstorm committed Apr 7, 2020
1 parent e268dfa commit 87bc3c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/gen/nodejs-templates/helm/v2/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class Chart extends yaml.CollectionComponentResource {
version: cfg.version
});
fetch(chartToFetch, fetchOpts);
const fetchedChartName = fs.readdirSync(chartDir.name)[0];
const fetchedChartName = fs.readdirSync(chartDir.name).sort()[0];
chart = path.quotePath(nodepath.join(chartDir.name, fetchedChartName));
defaultValues = path.quotePath(
nodepath.join(chartDir.name, fetchedChartName, "values.yaml")
Expand Down
2 changes: 1 addition & 1 deletion sdk/nodejs/helm/v2/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class Chart extends yaml.CollectionComponentResource {
version: cfg.version
});
fetch(chartToFetch, fetchOpts);
const fetchedChartName = fs.readdirSync(chartDir.name)[0];
const fetchedChartName = fs.readdirSync(chartDir.name).sort()[0];
chart = path.quotePath(nodepath.join(chartDir.name, fetchedChartName));
defaultValues = path.quotePath(
nodepath.join(chartDir.name, fetchedChartName, "values.yaml")
Expand Down

0 comments on commit 87bc3c2

Please sign in to comment.