From ef79104385dfe1252861f32cf3a696b35ed78238 Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Wed, 6 Feb 2019 18:49:44 +0100 Subject: [PATCH] fix: use reporter from helpers-engine --- src/cmds/javascript.js | 2 +- src/config.js | 3 ++- src/files.js | 2 +- src/git.js | 2 +- src/log.js | 23 ----------------------- src/prettier.js | 2 +- 6 files changed, 6 insertions(+), 28 deletions(-) delete mode 100644 src/log.js diff --git a/src/cmds/javascript.js b/src/cmds/javascript.js index dcdc3857..a085007f 100644 --- a/src/cmds/javascript.js +++ b/src/cmds/javascript.js @@ -4,7 +4,7 @@ const fs = require('fs') // support crew const { collectFiles, whitelisted } = require('../files.js') -const log = require('../log.js') +const log = require('@dhis2/cli-helpers-engine').reporter // heavy lifters const prettify = require('../prettier.js') diff --git a/src/config.js b/src/config.js index 878b0615..09588e3a 100644 --- a/src/config.js +++ b/src/config.js @@ -3,7 +3,8 @@ const path = require('path') const fs = require('fs') -const log = require('./log.js') +const log = require('@dhis2/cli-helpers-engine').reporter + const { readFile, writeFile } = require('./files.js') function wipe_prop_cfg(repo) { diff --git a/src/files.js b/src/files.js index d9b5003d..0a7bd8ee 100644 --- a/src/files.js +++ b/src/files.js @@ -1,7 +1,7 @@ const fs = require('fs') const path = require('path') -const log = require('./log.js') +const log = require('@dhis2/cli-helpers-engine').reporter const whitelist = ['.js', '.json', '.css', '.scss', '.md', '.jsx'] const blacklist = ['node_modules', 'build', 'dist', 'target'] diff --git a/src/git.js b/src/git.js index 5f0c3ebd..c5c92f57 100644 --- a/src/git.js +++ b/src/git.js @@ -4,7 +4,7 @@ const { execSync } = require('child_process') -const log = require('./log.js') +const log = require('@dhis2/cli-helpers-engine').reporter function stage(files, dir) { log.info(`Stage ${files.length} file(s).`) diff --git a/src/log.js b/src/log.js deleted file mode 100644 index 3f20e382..00000000 --- a/src/log.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * log level options - * ----------------- - * 0 = nothing - * 1 = error - * 2 = info - * 3 = debug - * 4 = trace - */ - -const loglevel = 2 -const log = { - error: (msg, ...args) => - loglevel > 0 ? console.error('[CODESTYLE]', msg, ...args) : null, - info: (msg, ...args) => - loglevel > 1 ? console.info('[CODESTYLE]', msg, ...args) : null, - debug: (msg, ...args) => - loglevel > 2 ? console.log('[CODESTYLE]', msg, ...args) : null, - trace: (msg, ...args) => - loglevel > 3 ? console.trace(msg, ...args) : null, -} - -module.exports = log diff --git a/src/prettier.js b/src/prettier.js index ba438fd0..34acb7d1 100644 --- a/src/prettier.js +++ b/src/prettier.js @@ -1,7 +1,7 @@ const prettier = require('prettier') const path = require('path') -const log = require('./log.js') +const log = require('@dhis2/cli-helpers-engine').reporter const { readFile, writeFile } = require('./files.js')