Skip to content
Snippets Groups Projects
Commit e29c2d5a authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: detect quotation mark in .travis.yml

parent d9f9e469
No related branches found
No related tags found
No related merge requests found
...@@ -8,9 +8,14 @@ function setNewValue(currentFileContent, upgrade) { ...@@ -8,9 +8,14 @@ function setNewValue(currentFileContent, upgrade) {
try { try {
logger.debug(`node.setNewValue: ${upgrade.newVersion}`); logger.debug(`node.setNewValue: ${upgrade.newVersion}`);
const indent = detectIndent(currentFileContent).indent || ' '; const indent = detectIndent(currentFileContent).indent || ' ';
const quote =
currentFileContent.split(`'`).length >
currentFileContent.split(`"`).length
? `'`
: `"`;
let newString = `\nnode_js:\n`; let newString = `\nnode_js:\n`;
upgrade.newVersion.forEach(version => { upgrade.newVersion.forEach(version => {
newString += `${indent}- '${version}'\n`; newString += `${indent}- ${quote}${version}${quote}\n`;
}); });
return currentFileContent.replace(/\nnode_js:(\n\s+[^\n]+)+\n/, newString); return currentFileContent.replace(/\nnode_js:(\n\s+[^\n]+)+\n/, newString);
} catch (err) { } catch (err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment