1module.exports = { 2 readVersion( contents ) { 3 return ''; // The plugin.info.txt does not contain a semantic version 4 }, 5 6 writeVersion( contents ) { 7 const options = contents 8 .trim() 9 .split("\n") 10 .map(line => { 11 const indexOfFirstSpace = line.indexOf(' '); 12 return [line.slice(0, indexOfFirstSpace), line.slice(indexOfFirstSpace + 1)] 13 .map( piece => piece.trim()) }) 14 .reduce( (carry, [key, value]) => { return { ...carry, [key]: value};}, {} ); 15 16 options.date = (new Date()).toISOString().substr(0, 10); 17 18 const longestKey = Object.keys(options).reduce( (carry, key) => Math.max(carry, key.length), 0); 19 return Object.entries(options) 20 .map( ([key, value]) => key.padEnd(longestKey) + ' ' + value) 21 .join("\n"); 22 }, 23}; 24