From 90413e75f11d57bfafcba72d752f9fe906a5f9f8 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Wed, 25 Apr 2018 20:32:09 -0300 Subject: [PATCH] add version script to update ethpm.json (#906) --- package.json | 3 ++- scripts/version.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 scripts/version.js diff --git a/package.json b/package.json index 613b38c8a..e69e50410 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "lint:all": "npm run lint && npm run lint:sol", "lint:all:fix": "npm run lint:fix && npm run lint:sol:fix", "console": "truffle console", - "coverage": "scripts/coverage.sh" + "coverage": "scripts/coverage.sh", + "version": "scripts/version.js" }, "repository": { "type": "git", diff --git a/scripts/version.js b/scripts/version.js new file mode 100755 index 000000000..1fcc07354 --- /dev/null +++ b/scripts/version.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +// Synchronizes ethpm.json version number with package.json. +// Useful to run as an npm script alogn with `npm version`. + +const fs = require('fs'); +const cp = require('child_process'); + +const pkg = require('../package.json'); +const ethpm = require('../ethpm.json'); + +ethpm.version = pkg.version; + +fs.writeFileSync('ethpm.json', JSON.stringify(ethpm, null, 2) + '\n'); + +cp.execSync('git add ethpm.json');