Comparing version 1.0.7 to 1.1.0
@@ -8,2 +8,4 @@ const pkg = require('../package.json') | ||
> kbme | ||
Options: | ||
@@ -32,4 +34,15 @@ | ||
can be used as a template to replace by another option value. | ||
> kbmeh | ||
Options: | ||
-r, --range Range of time to collect metrics, in days [${opt.range}] | ||
-i, --interval Interval to split metrics on, in days [${opt.interval}] | ||
Usage: | ||
> kbme -r 365 -i 15 --csv >> historical.csv | ||
` | ||
module.exports = help |
@@ -14,2 +14,4 @@ const { join } = require('path') | ||
auto: process.env.KBME_AUTO, | ||
range: process.env.KBME_RANGE || 365, | ||
interval: process.env.KBME_INTERVAL || 15, | ||
start: process.env.KBME_START || date_ago(15), | ||
@@ -16,0 +18,0 @@ finish: process.env.KBME_FINISH || date_ago(0), |
@@ -7,3 +7,4 @@ module.exports = { | ||
num_reducer, | ||
replace | ||
replace, | ||
generate_dates | ||
} | ||
@@ -69,1 +70,25 @@ | ||
} | ||
/** | ||
* Generates an array of dates | ||
* @param {Number} interval | ||
* @param {Number} period | ||
*/ | ||
function generate_dates(interval = 15, period = 365) { | ||
let top = 0 | ||
let bottom = 0 | ||
const dates = [] | ||
const limit = Math.ceil(period / interval) | ||
for (let i = 0; i < limit; i++) { | ||
top += interval | ||
bottom = top - interval | ||
dates.push({ | ||
start: date_ago(top), | ||
finish: date_ago(bottom) | ||
}) | ||
} | ||
return dates | ||
} |
{ | ||
"name": "kbme", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Gather kanban metrics from your JIRA instance", | ||
"main": "lib/index.js", | ||
"bin": { | ||
"kbme": "cli.js" | ||
"kbme": "cli.js", | ||
"kbmeh": "history.js" | ||
}, | ||
@@ -9,0 +10,0 @@ "engines": { |
@@ -11,2 +11,10 @@ # kbme | ||
This tool was inspired by one of the talks on the european Atlassian Summit 2017 | ||
[![Atlassian Summit](https://image.ibb.co/faANgk/Screen_Shot_2017_08_26_at_3_42_48_PM.png)](https://www.youtube.com/watch?v=m-w2cU_1oB8) | ||
Watch the video to understand how metrics are collected. | ||
## Installation | ||
@@ -18,6 +26,9 @@ | ||
`kbme --csv >> metrics.csv` | ||
### `kbme` | ||
Use the `kbme` command to gather information for a particular period of time | ||
### Options | ||
`kbme --csv --start 2017-08-01 --finish 2017-08-31 >> metrics.csv` | ||
#### Options | ||
-c, --csv Outputs comma separated values [false] | ||
@@ -37,2 +48,13 @@ -k, --keys Comma separated list of projects keys | ||
### `kbmeh` | ||
Use the `kbmeh` command to generate an automated historical output for a given period and intervals, for example, collect metrics for last 365 days on intervals of 15 days: | ||
`kbmeh --range 365 --interval 15 --csv >> metrics.csv` | ||
#### Options | ||
-r, --range Range of time to collect metrics, in days [365] | ||
-i, --interval Interval to split metrics on, in days [15] | ||
### Automatic environment variables detection | ||
@@ -48,2 +70,4 @@ | ||
KBME_AUTO=15 | ||
KBME_RANGE=365 | ||
KBME_INTERVAL=15 | ||
KBME_START="2017-01-01" | ||
@@ -50,0 +74,0 @@ KBME_FINISH="2017-06-01" |
@@ -1,2 +0,2 @@ | ||
const { pad, csv, date_ago, days_between, num_reducer, replace } = require('../lib/util') | ||
const { pad, csv, date_ago, days_between, num_reducer, replace, generate_dates } = require('../lib/util') | ||
@@ -79,2 +79,15 @@ | ||
}) | ||
describe('#generate_dates', () => { | ||
test('should create an array of dates for default interval and period', () => { | ||
expect(generate_dates()).toHaveLength(25) | ||
}) | ||
test('should create an array of dates for given interval and period', () => { | ||
expect(generate_dates(30, 30)).toHaveLength(1) | ||
expect(generate_dates(15, 20)).toHaveLength(2) | ||
expect(generate_dates(15, 31)).toHaveLength(3) | ||
expect(generate_dates(15, 365)).toHaveLength(25) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112672
18
1002
84
14