Skip to content

Commit

Permalink
fix: os-relevant EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 6, 2022
1 parent f643b34 commit c3d0936
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/commands/dev/convert/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as fs from 'fs';
import { EOL } from 'os';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';

Expand Down Expand Up @@ -62,12 +63,12 @@ export default class DevConvertMessages extends SfCommand<DevConvertMessagesResu

const convertValue = (key: string, value: string | string[] | Record<string, string>): string => {
if (typeof value === 'string') {
return `# ${key}\n\n${value.trim()}`;
return `# ${key}${EOL}${EOL}${value.trim()}`;
} else if (Array.isArray(value)) {
return [`# ${key}`, '\n\n- ' + value.join('\n\n- ')].join('');
return [`# ${key}`, `${EOL}${EOL}- ` + value.join(`${EOL}${EOL}- `)].join('');
} else {
return Object.entries(value)
.map(([subkey, subvalue]) => convertValue(`${key}.${subkey}`, subvalue))
.join('\n\n');
.join(`${EOL}${EOL}`);
}
};

0 comments on commit c3d0936

Please sign in to comment.