Skip to content

Commit

Permalink
Update and polish
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGriffiths committed Feb 15, 2019
1 parent 8859c17 commit f82d1e8
Show file tree
Hide file tree
Showing 9 changed files with 9,622 additions and 14,011 deletions.
14 changes: 7 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ engines:
enabled: true
config:
languages:
- javascript
- javascript
eslint:
enabled: true
config:
Expand All @@ -13,10 +13,10 @@ engines:
enabled: true
ratings:
paths:
- "src/**.js"
- "src/**.js"
exclude_paths:
- test/
- docs/
- index.js
- index.mjs
- gulpfile.js
- test/
- docs/
- index.js
- index.mjs
- gulpfile.js
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
- CC_TEST_REPORTER_ID=0b75780aa2ecb4ca547ca268f175e2f8c6600965317ace528b3bc67f6a09b255
- secure: k+PXexJeDTne3XBzuDa59S3V7lvZ1hXoivoD3AkSM30WXRFVhqvreCkpcrKcwLWD6DTJA7DYy2eQE26V4Q2NVIPSHo4cMhVKX4v6a4JITN8UCWKqa9oaDE4OuHWymVXcuS1FRDUJQEy59oRb1zM37f+3bfOEoEupgg4IDBErxiaWyLZV3d8f5mVNkZC2nhvXdfla/KNeJxCIBk8bzR9yCPgra8frwzGb0ZQazZfyy31D3JkHYNeJfIp/4ncXLiracUxzLLAevW0sb4RI3oP3KX8UKs//uT0ipjQnSqPQFM1gewDUPelk6XvI/glw6G1+nttqcyxj+LO6mlpJGXtcyNP2qziU86n2UYsxaocEtvcK4U7lKyo5tnrJr/WunZZ1k0H8YHASkHdKsef5m+lhlrKvk9ebMZER96bE1+p7gNSo9ghGNS+JSelVqs9hqNMFAAdiT8Y3Q5li5Yg81BNbLOXTYwFlXt1OKPrC2Ie3kKw/kbcYIhn9bofmsCHI2naULquISoEW94cqycpZzPfRmoWXOVqXM+jyWdQ/w1tEFuthYIiYJG1YIoptuW2ZIR6kIt8bLe6ZKCotkIfUY8fnENIq/VuNhIZWzHt5rtnqeP0XiH2aPGFXmAVGylVbUZLifQa8mS6CQiR9CTD7bOy5/odFtKrqGD1IN/QxpaLoa1I=
before_install:
- '[[ $(node -v) =~ ^v10.*$ ]] || npm install -g npm@latest'
- '[[ $(node -v) =~ ^v11.*$ ]] || npm install -g npm@latest'
- npm install -g greenkeeper-lockfile
install: npm install
before_script:
Expand Down
12 changes: 6 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

const gulp = require('gulp')
const rename = require('gulp-rename')
const strip = require('gulp-strip-comments')
const rollup = require('gulp-better-rollup')
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const babel = require('rollup-plugin-babel')

const external = ['util', 'console', 'term-ng', 'chalk', 'sparkles', '@thebespokepixel/time', '@thebespokepixel/meta']
const external = id => !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('\0')

const babelConfig = {
presets: [
Expand All @@ -20,30 +21,29 @@ const babelConfig = {
}
}]
],
comments: false,
exclude: 'node_modules/**'
}

gulp.task('cjs', () =>
gulp.src('src/index.js')
.pipe(rollup({
external,
plugins: [babel(babelConfig)]
plugins: [resolve(), commonjs(), babel(babelConfig)]
}, {
format: 'cjs'
}))
.pipe(strip())
.pipe(gulp.dest('.'))
)

gulp.task('es6', () =>
gulp.src('src/index.js')
.pipe(rollup({
external,
plugins: [babel(babelConfig)]
plugins: [resolve(), commonjs(), babel(babelConfig)]
}, {
format: 'es'
}))
.pipe(strip())
.pipe(rename('index.mjs'))
.pipe(gulp.dest('.'))
)
Expand Down
16 changes: 1 addition & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ var time = require('@thebespokepixel/time');
var meta = _interopDefault(require('@thebespokepixel/meta'));

const {
format
} = util;
const {
format,
inspect
} = util;
const metadata = meta(__dirname);
Expand Down Expand Up @@ -57,54 +55,45 @@ const consoleFactory = function (options = {}) {
_stderr: sErr,
threshold: verbosity ? verbosity : 3,
emitter: willEmit && sparkles(namespace),

matrix: {
debug: {
level: 5,
stream: sOut,

format: (pfix, msg) => `${pfix}${chalk.dim(msg)}`
},
info: {
level: 4,
stream: sOut,

format: (pfix, msg) => `${pfix}${msg}`
},
log: {
level: 3,
stream: sOut,

format: (pfix, msg) => `${pfix}${msg}`
},
warn: {
level: 2,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.yellow(msg)}`
},
error: {
level: 1,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.red(`ERROR: ${msg}`)}`
},
critical: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`CRITICAL: ${msg}`)}`
},
panic: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`PANIC: ${msg}`)}`
},
emergency: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`EMERGENCY: ${msg}`)}`
}
},
Expand Down Expand Up @@ -218,15 +207,12 @@ const consoleFactory = function (options = {}) {
});
};


function console$1(options) {
return consoleFactory(options);
}

function createConsole(options) {
return consoleFactory(options);
}

const getVersion = level => metadata.version(level);

exports.console = console$1;
Expand Down
16 changes: 1 addition & 15 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { bespokeTimeFormat } from '@thebespokepixel/time';
import meta from '@thebespokepixel/meta';

const {
format
} = util;
const {
format,
inspect
} = util;
const metadata = meta(__dirname);
Expand Down Expand Up @@ -51,54 +49,45 @@ const consoleFactory = function (options = {}) {
_stderr: sErr,
threshold: verbosity ? verbosity : 3,
emitter: willEmit && sparkles(namespace),

matrix: {
debug: {
level: 5,
stream: sOut,

format: (pfix, msg) => `${pfix}${chalk.dim(msg)}`
},
info: {
level: 4,
stream: sOut,

format: (pfix, msg) => `${pfix}${msg}`
},
log: {
level: 3,
stream: sOut,

format: (pfix, msg) => `${pfix}${msg}`
},
warn: {
level: 2,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.yellow(msg)}`
},
error: {
level: 1,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.red(`ERROR: ${msg}`)}`
},
critical: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`CRITICAL: ${msg}`)}`
},
panic: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`PANIC: ${msg}`)}`
},
emergency: {
level: 0,
stream: sErr,

format: (pfix, msg) => `${pfix}${chalk.bold.red(`EMERGENCY: ${msg}`)}`
}
},
Expand Down Expand Up @@ -212,15 +201,12 @@ const consoleFactory = function (options = {}) {
});
};


function console(options) {
return consoleFactory(options);
}

function createConsole(options) {
return consoleFactory(options);
}

const getVersion = level => metadata.version(level);

export { console, createConsole, getVersion };
Loading

0 comments on commit f82d1e8

Please sign in to comment.