Skip to content

Commit

Permalink
chore: fix update-plugin-xml.js
Browse files Browse the repository at this point in the history
  • Loading branch information
silkimen committed Jul 14, 2020
1 parent 7661e02 commit dc6cf4d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/update-plugin-xml.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const args = process.argv.slice(2);
const fs = require('mz/fs');
const fs = require('fs');
const path = require('path');
const xml2js = require('xml2js');
const xmlPath = path.join(__dirname, '..', 'plugin.xml');
Expand All @@ -22,10 +22,12 @@ const stringify = obj => {
return builder.buildObject(obj);
};

fs.readFile(xmlPath, 'utf-8')
.then(xml => parse(xml))
.then(parsed => {
parsed.plugin.$.version = args[0];
const update = async (version) => {
const xml = fs.readFileSync(xmlPath, 'utf-8');
const parsed = await parse(xml);

return fs.writeFile(xmlPath, stringify(parsed));
});
parsed.plugin.$.version = version;
fs.writeFileSync(xmlPath, stringify(parsed));
};

return update(args[0]);

0 comments on commit dc6cf4d

Please sign in to comment.