2
0
mirror of https://github.com/iconify/collections-json.git synced 2024-11-22 20:45:12 +00:00
iconify-collections-json/sync-version.js
2021-11-09 10:40:15 +02:00

20 lines
602 B
JavaScript

const fs = require('fs');
// Get version number from package.json
const version = JSON.parse(
fs.readFileSync(__dirname + '/package.json', 'utf8')
).version;
// Files to update
const files = ['composer.json'];
for (let i = 0; i < files.length; i++) {
const filename = __dirname + '/' + files[i];
const content = JSON.parse(fs.readFileSync(filename, 'utf8'));
if (content.version !== version) {
content.version = version;
const newContent = JSON.stringify(content, null, '\t');
fs.writeFileSync(filename, newContent, 'utf8');
console.log('Updated version in', files[i]);
}
}