synchronize-versions.js 481 B

123456789101112131415
  1. #!/usr/bin/env node
  2. // Synchronizes the version in contracts/package.json with the one in package.json.
  3. // This is run automatically when npm version is run.
  4. const fs = require('fs');
  5. setVersion('package.json', 'contracts/package.json');
  6. function setVersion(from, to) {
  7. const fromJson = JSON.parse(fs.readFileSync(from));
  8. const toJson = JSON.parse(fs.readFileSync(to));
  9. toJson.version = fromJson.version;
  10. fs.writeFileSync(to, JSON.stringify(toJson, null, 2) + '\n');
  11. }