@justeat/fozzie-updater
Advanced tools
Comparing version 0.3.5 to 0.4.0
@@ -6,2 +6,13 @@ # Changelog | ||
v0.4.0 | ||
------------------------------ | ||
*August 16, 2018* | ||
### Changed | ||
- Allowing inline declaration of modifier commands | ||
### Fixed | ||
- Patch version number defaults to 0 | ||
v0.3.5 | ||
@@ -8,0 +19,0 @@ ------------------------------ |
@@ -9,5 +9,7 @@ module.exports = { | ||
command | ||
.command(line, `include in ${line} changelog`) | ||
.action(function(args, cb) { | ||
lineItemAddition.bind(this)(line, state, cb) | ||
.command(`${line} <description...>`, `include in ${line} changelog`) | ||
.action(function({ description }, cb) { | ||
const result = description.join(' ').trim() | ||
result && state.lineItems[line].push(result) | ||
cb() | ||
}) | ||
@@ -17,15 +19,2 @@ }) | ||
} | ||
} | ||
function lineItemAddition(line, state, cb) { | ||
const prompts = [{ | ||
type: 'input', | ||
name: 'item', | ||
message: `What was ${line}?: ` | ||
}] | ||
this.prompt(prompts, ({ item }) => { | ||
item && state.lineItems[line].push(`${item.trim()}`) | ||
}) | ||
.then(() => cb()) | ||
} | ||
} |
@@ -0,18 +1,19 @@ | ||
const { formatLiteral } = base.require('utils') | ||
module.exports = { | ||
name: 'version', | ||
name: 'version [version]', | ||
description: 'set version manually', | ||
actions({ command, state }) { | ||
command.action(function(args, cb) { | ||
this.prompt([ | ||
{ | ||
type: 'input', | ||
name: 'version', | ||
message: `Version (${state.version}): ` | ||
} | ||
], ({ version }) => { | ||
if (version) { | ||
state.version = version | ||
} | ||
}) | ||
.then(() => cb()) | ||
command.action(function({ version }, cb) { | ||
if (version) { | ||
state.version = version | ||
} | ||
const message = formatLiteral(` | ||
Current version: ${state.currentVersion} | ||
Proposed version: ${state.version} | ||
`) | ||
cb(`\n${message}\n`) | ||
}) | ||
@@ -19,0 +20,0 @@ } |
module.exports = { | ||
dateFormat: 'MMMM D, YYYY', | ||
delimiter: 'package-update$', | ||
lineItems: [ | ||
'added', | ||
'changed', | ||
'fixed', | ||
'removed' | ||
], | ||
versionBump: 'minor' | ||
} |
@@ -33,6 +33,8 @@ exports.app = () => { | ||
state.currentVersion = version; | ||
// NOTE: this is a mess, cleanup | ||
state.version = version | ||
// NOTE: easiest way to make change to version partial | ||
state._version[config.versionBump]++ | ||
state._version.patch = 0 | ||
@@ -39,0 +41,0 @@ // bootstrap all registered commands |
@@ -1,3 +0,2 @@ | ||
// use formatLiteral to free yourself of string torment | ||
const formatLiteral = str => str.replace(/^\x20+|\x20+$/gm, '').trim() | ||
const { formatLiteral } = base.require('utils') | ||
const parseLineItems = (lineItems) => ( | ||
@@ -4,0 +3,0 @@ Object |
const dayjs = require('dayjs') | ||
const { dateFormat } = base.require('config') | ||
const { dateFormat, lineItems } = base.require('config') | ||
@@ -23,2 +23,3 @@ module.exports = { | ||
}, | ||
currentVersion: null, | ||
_date: new Date(), | ||
@@ -31,7 +32,8 @@ get date() { | ||
}, | ||
lineItems: { | ||
added: [], | ||
changed: [], | ||
removed: [] | ||
} | ||
// cast each line item to array | ||
lineItems: lineItems.reduce((p, c) => { | ||
p[c] = [] | ||
return p; | ||
}, {}) | ||
} |
{ | ||
"name": "@justeat/fozzie-updater", | ||
"description": "Common update for use in Fozzie projects.", | ||
"version": "0.3.5", | ||
"version": "0.4.0", | ||
"files": [ | ||
@@ -6,0 +6,0 @@ "bin", |
@@ -32,12 +32,15 @@ # Fozzie Updater | ||
### added | ||
### added <description...> | ||
Adds a line to the `Added` changelog section | ||
### changed | ||
### changed <description...> | ||
Adds a line to the `Changed` changelog section | ||
### removed | ||
### fixed <description...> | ||
Adds a line to the `Changed` changelog section | ||
### removed <description...> | ||
Adds a line to the `Removed` changelog section | ||
### version | ||
### version <semver...> | ||
Sets the new version of the package being updated. The `minor` version is bumped up one version by default | ||
@@ -49,4 +52,3 @@ | ||
- Create a release on GitHub | ||
- Allow inline modifier commands e.g. `added "this feature"` | ||
- Version validation | ||
- Tests |
10325
18
52
275