-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-example.js
43 lines (34 loc) · 1.36 KB
/
index-example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
"use strict";
/**
* @file
* Generate the release report for [Current Project] team.
*/
const {program} = require('commander');
const Changelog = require('./lib/changelog');
// Instructions for the program.
const config = require('./config.js');
// Collect options from the program.
program
.option('-b, --base <branch>', 'Base branch for the changelog. Required.')
.option('-h, --head <branch>', 'Most recent branch for the changelog. Required.')
.option('-r, --repo <repository>', 'A GitHub repository to look in. Overrides config settings. May be defined in config.js.')
// .option('-j, --jira <key>', 'Specify a Jira project key. May be defined in config.js.')
.option('-d, --debug', 'Run the program in debug mode for more verbose errors.')
.parse(process.argv);
/** EDIT BELOW THIS SECTION ONLY **/
// Copy these files to make them your own.
const myTasks = require('./usr/example-my-tasks');
const myReport = require('./usr/example-my-report');
const changelog = new Changelog(config, program.opts(), myTasks);
changelog.setReportClass(myReport);
changelog.run();
/** EDIT ABOVE THIS SECTION ONLY **/
// General error handler.
process.on('uncaughtException', err => {
console.error('😵️ ' + err.message);
// Display more verbose errors in debug mode.
if (changelog.debug()) {
console.error(err);
}
});