checkPlugin: Make sure `package.json` ends with a newline

image-example
Richard Hansen 2021-01-09 18:28:11 -05:00 committed by John McLear
parent bf8d55ab8e
commit bba47ea2df
1 changed files with 5 additions and 2 deletions

View File

@ -42,8 +42,11 @@ const execSync = (cmd, opts = {}) => (childProcess.execSync(cmd, {
...opts, ...opts,
}) || '').toString().replace(/\n+$/, ''); }) || '').toString().replace(/\n+$/, '');
const writePackageJson = const writePackageJson = (obj) => {
(obj) => fs.writeFileSync(`${pluginPath}/package.json`, JSON.stringify(obj, null, 2)); let s = JSON.stringify(obj, null, 2);
if (s.length && s.slice(s.length - 1) !== '\n') s += '\n';
return fs.writeFileSync(`${pluginPath}/package.json`, s);
};
const prepareRepo = () => { const prepareRepo = () => {
let branch = execSync('git symbolic-ref HEAD'); let branch = execSync('git symbolic-ref HEAD');