From 8d657bc83a43be56a3b145f1ac446e51e8b12e04 Mon Sep 17 00:00:00 2001 From: Robin Knipe Date: Mon, 3 Dec 2018 22:47:27 +0000 Subject: [PATCH 1/2] Version support for `npm version ` command In the most recent update the `npm` version declared didn't match the `drone` version. Rather than updating the versions manually, this addition ensures calling one of the following, updates everything automatically: - `npm version patch` a patch update: `v0.0.0` -> `v0.0.1` - `npm version minor` a minor update: `v0.0.1` -> `v0.1.0` - `npm version major` a major update: `v0.1.0` -> `v1.0.0` --- .version.js | 11 +++++++++++ package.json | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 .version.js diff --git a/.version.js b/.version.js new file mode 100755 index 0000000..777b3b8 --- /dev/null +++ b/.version.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +'use strict'; + +const fs = require('fs'); +const drone = '.drone.yml'; +const config = fs.readFileSync(drone, { encoding: 'utf8' }); +const [major, minor, patch] = require('./package.json').version.split('.'); + +fs.writeFileSync(drone, config.replace( + /^(.*MAJOR:\s*- )\d+(\s*MINOR:\s*- )\d+(\s*PATCH:\s*- )\d+(.*)$/m, `$1${major}$2${minor}$3${patch}$4`)); diff --git a/package.json b/package.json index d374b2a..177600d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "test:check-coverage": "nyc check-coverage --statements 0 --branches 0 --functions 0 --lines 0", "snyk-protect": "snyk protect", "postinstall": "npm run snyk-protect", - "prepublish": "npm run snyk-protect" + "prepublish": "npm run snyk-protect", + "version": "./.version.js && git add .drone.yml" }, "repository": { "type": "git", From aa14b2008b6e7be9d981f3bcb13d42fa76879c6e Mon Sep 17 00:00:00 2001 From: Robin Knipe Date: Wed, 5 Dec 2018 14:53:05 +0000 Subject: [PATCH 2/2] 0.6.2 --- .drone.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index a6d9c30..bb2eb9d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,7 @@ matrix: MINOR: - 6 PATCH: - - 1 + - 2 DOCKER_USERNAME: - ukhomeofficedigital+lev_api DOCKER_REPO: diff --git a/package.json b/package.json index 177600d..2e8efd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lev-api", - "version": "0.6.1", + "version": "0.6.2", "description": "Life Event Verification API", "main": "src/app.js", "scripts": {