Skip to content

Commit

Permalink
refactor: simplified bundle variables code
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun0157 committed Jun 8, 2024
1 parent a641c3a commit 98ae00d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/variableParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,12 @@ export function loadVariables(
if (!envName) return {};

const allBundleVariables = getBundleVariables(bundleContent);
const bundleVars: Variables = allBundleVariables.hasOwnProperty(envName)
? allBundleVariables[envName]
: {};
const bundleVars: Variables = allBundleVariables[envName] ?? {};

let envVars: Variables = {};
const envVars: Variables = {};
varFileContents.forEach((fileContents) => {
const parsedData = YAML.parse(fileContents);
if (parsedData && isDict(parsedData[envName])) {
Object.assign(envVars, parsedData[envName]);
}
if (parsedData && isDict(parsedData[envName])) Object.assign(envVars, parsedData[envName]);
});

const basicVars = Object.assign({}, envVars, bundleVars);
Expand Down

0 comments on commit 98ae00d

Please sign in to comment.