Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing json5 parsing issue #470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/exec/extension/_lib/merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Merger {

// build environment object from --env parameter
const env = {};
(this.settings.env || []).forEach(kvp => {
(this.settings.env || []).forEach(kvp => {
const [key, ...value] = kvp.split('=');
env[key] = value.join('=');
});
Expand All @@ -118,7 +118,7 @@ export class Merger {
throw new Error(`The export function from manifest-js file ${fullJsFile} must return the manifest object`)
}
return manifestData;
}
}

/**
* Finds all manifests and merges them into two JS Objects: vsoManifest and vsixManifest
Expand All @@ -141,7 +141,7 @@ export class Merger {
promisify(readFile)(file, "utf8").then(data => {
const jsonData = data.replace(/^\uFEFF/, "");
try {
const result = this.settings.json5 ? jju.parse(jsonData) : JSON.parse(jsonData);
const result = jju.parse(jsonData);
result.__origin = file; // save the origin in order to resolve relative paths later.
return result;
} catch (err) {
Expand Down Expand Up @@ -189,7 +189,7 @@ export class Merger {
parsed["version"] = newVersionString;
newPartial = jju.update(versionPartial, parsed);
} else {
newPartial = jsonInPlace(versionPartial).set("version", newVersionString).toString();
newPartial = jsonInPlace(versionPartial).set("version", newVersionString).toString();
}
return promisify(writeFile)(partial.__origin, newPartial);
} catch (e) {
Expand Down Expand Up @@ -289,7 +289,7 @@ export class Merger {
} else {
throw new Error(
"There were errors with your extension. Address the following and re-run the tool.\n" +
validationResult,
validationResult,
);
}
});
Expand Down