refactor: adjust code to updated dependencies

This commit is contained in:
Karl-Philipp Wulfert
2019-05-27 12:57:26 +02:00
parent 0986b42897
commit 5fc36ad28c
6 changed files with 50 additions and 54 deletions

View File

@@ -22,17 +22,15 @@ import {remind} from './tasks/remind';
import {tidy} from './tasks/tidy';
import {unlabel} from './tasks/unlabel';
const logger = new Logger();
// add default handler for unhandled rejections
process.on('unhandledRejection', (err) => {
logger.error('UNHANDLED REJECTION', err.stack);
Logger.error('UNHANDLED REJECTION', err.stack);
process.exit(1);
});
// check that environment variable GITLAB_PRIVATE_TOKEN is set
if (typeof process.env.GITLAB_PRIVATE_TOKEN !== 'string' || process.env.GITLAB_PRIVATE_TOKEN.length === 0) {
logger.error('Environment variable GITLAB_PRIVATE_TOKEN is not set!');
Logger.error('Environment variable GITLAB_PRIVATE_TOKEN is not set!');
process.exit(1);
}
@@ -46,21 +44,21 @@ commander
.command('unlabel')
.action(async () => {
await unlabel(gitlabApi);
logger.ok('Done!');
Logger.ok('Done!');
});
commander
.command('tidy')
.action(async () => {
await tidy(gitlabApi);
logger.ok('Done!');
Logger.ok('Done!');
});
commander
.command('remind')
.action(async () => {
await remind(gitlabApi);
logger.ok('Done!');
Logger.ok('Done!');
});
commander