2
0
mirror of https://github.com/iconify/collections-json.git synced 2024-11-21 12:05:11 +00:00
iconify-collections-json/sync-version.cjs
2023-01-01 22:17:18 +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]);
}
}