@justeat/fozzie-updater
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -13,4 +13,3 @@ const vorpal = require('vorpal')() | ||
command, | ||
state, | ||
vorpal | ||
state | ||
}) | ||
@@ -17,0 +16,0 @@ } |
@@ -1,30 +0,23 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const log = base.require('log') | ||
const changelog = base.require('services/changelog') | ||
const logFilePath = path.join(process.cwd(), 'CHANGELOG.md') | ||
const changeLog = fs.readFileSync(logFilePath, 'utf8') | ||
module.exports = { | ||
name: 'run', | ||
description: 'run package update', | ||
actions({ command, vorpal }) { | ||
actions({ command, state }) { | ||
command.action((args, cb) => { | ||
vorpal.exec('summary', (summary) => { | ||
const firstInstance = /v\d+.\d+.\d+\n/ | ||
const result = changeLog.replace(firstInstance, match => `${summary}\n\n${match}`) | ||
fs.writeFile(logFilePath, result, 'utf8', err => { | ||
if (err) { | ||
return log.error(err) | ||
} | ||
changelog | ||
.compose(state) | ||
.then( | ||
() => { | ||
log.success('Changelog successfully updated') | ||
process.exit(0) | ||
}) | ||
}) | ||
}, | ||
err => log.error(err) | ||
) | ||
cb() | ||
}) | ||
cb() | ||
}) | ||
} | ||
} |
@@ -1,24 +0,3 @@ | ||
const formatLineItem = (type, items=[]) => ( | ||
// capitalise line item title | ||
// followed by line items in new line | ||
`### ${type.substr(0, 1).toUpperCase() + type.substr(1)} | ||
${items.map(item => ('- ' + item)).join('\n')}` | ||
) | ||
const changelog = base.require('services/changelog') | ||
const parseLineItems = (lineItems) => ( | ||
Object | ||
.keys(lineItems) | ||
.filter(type => lineItems[type].length) | ||
.map(type => formatLineItem(type, lineItems[type])) | ||
.join('\n\n') | ||
) | ||
const summarise = (version, date, lineItems) => ( | ||
`v${version} | ||
------------------------------ | ||
*${date}* | ||
${parseLineItems(lineItems)}` | ||
) | ||
module.exports = { | ||
@@ -29,12 +8,8 @@ name: 'summary', | ||
command.action((args, cb) => { | ||
const output = summarise( | ||
state.version, | ||
state.date, | ||
state.lineItems | ||
) | ||
cb(output) | ||
const output = changelog.summarise(state) | ||
// add some padding for more readable output | ||
cb(`\n${output}\n`) | ||
}) | ||
} | ||
} | ||
} |
{ | ||
"name": "@justeat/fozzie-updater", | ||
"description": "Common update for use in Fozzie projects.", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"files": [ | ||
@@ -33,2 +33,5 @@ "bin", | ||
], | ||
"scripts": { | ||
"start": "node bin/fozzie-updater.js" | ||
}, | ||
"preferGlobal": true, | ||
@@ -35,0 +38,0 @@ "bin": { |
@@ -47,7 +47,6 @@ # Fozzie Updater | ||
- Create tag | ||
- Publish to npm on | ||
- Create a release on GitHub on | ||
- Create CHANGELOG.md if missing from directory | ||
- Publish to npm | ||
- Create a release on GitHub | ||
- Allow inline modifier commands e.g. `added "this feature"` | ||
- Version validation | ||
- Tests |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8867
16
242
0
51