angie-log
Advanced tools
Comparing version 0.9.12 to 0.10.0
// System Modules | ||
import fs from 'fs'; | ||
import gulp from 'gulp'; | ||
import {argv} from 'yargs'; | ||
import { argv } from 'yargs'; | ||
import eslint from 'gulp-eslint'; | ||
import jscs from 'gulp-jscs'; | ||
import istanbul from 'gulp-istanbul'; | ||
import {Instrumenter} from 'isparta'; | ||
import { Instrumenter } from 'isparta'; | ||
import mocha from 'gulp-mocha'; | ||
import cobertura from 'istanbul-cobertura-badger'; | ||
import babel from 'gulp-babel'; | ||
import esdoc from 'gulp-esdoc'; | ||
import {bold, red} from 'chalk'; | ||
import { bold, red } from 'chalk'; | ||
const bread = (str) => bold(red(str)); | ||
const bread = str => bold(red(str)); | ||
const SRC_DIR = 'src', | ||
SRC = `${SRC}/**/*.js`, | ||
TRANSPILED_SRC = 'dist', | ||
TEST_SRC = 'test/src/**/*.spec.js', | ||
DOC_SRC = 'doc', | ||
COVERAGE_SRC = 'coverage'; | ||
const SRC_DIR = './src', | ||
SRC = `${SRC_DIR}/**/*.js`, | ||
TRANSPILED_SRC_DIR = './dist', | ||
TRANSPILED_SRC = `${TRANSPILED_SRC_DIR}/**/*.js`, | ||
TEST_SRC = './test/src/**/*.spec.js', | ||
TRANSPILED_TEST_SRC = './test/dist/**/*.spec.js', | ||
DOC_SRC = './doc', | ||
COVERAGE_SRC = './coverage'; | ||
gulp.task('eslint', function () { | ||
gulp.src([ SRC, TEST_SRC ]).pipe( | ||
eslint() | ||
).pipe( | ||
eslint.format() | ||
).pipe( | ||
eslint.failOnError() | ||
); | ||
gulp.src([ SRC, TEST_SRC ]).pipe(eslint().on('error', function(e) { | ||
throw e; | ||
})); | ||
}); | ||
@@ -41,41 +38,18 @@ gulp.task('jscs', [ 'eslint' ], function () { | ||
}); | ||
gulp.task('mocha', function(cb) { | ||
let proc; | ||
new Promise(function(resolve) { | ||
proc = gulp.src(SRC).pipe( | ||
istanbul({ | ||
instrumenter: Instrumenter, | ||
includeUntested: false | ||
}) | ||
).pipe( | ||
istanbul.hookRequire() | ||
).on('finish', function() { | ||
gulp.src( | ||
[ 'test/src/testUtil.spec.js', 'test/**/!(*testUtil).spec.js' ], | ||
{ read: false } | ||
).pipe(mocha({ | ||
reporter: 'spec' | ||
}).on('error', function(e) { | ||
throw new Error(e); | ||
}).on('end', function() { | ||
resolve(); | ||
})); | ||
}); | ||
}).then(function() { | ||
return proc.pipe( | ||
// TODO fail if under accepted limit | ||
istanbul.writeReports({ | ||
reporters: [ 'text', 'text-summary', 'cobertura', 'clover' ] | ||
}) | ||
); | ||
}).then(function() { | ||
return cobertura('coverage/cobertura-coverage.xml', 'svg', cb); | ||
}); | ||
}); | ||
gulp.task('istanbul:src', [ 'jscs' ], istanbulHandler.bind(null, SRC)); | ||
gulp.task('istanbul:dist', [ 'babel' ], istanbulHandler.bind(null, TRANSPILED_SRC)); | ||
gulp.task( | ||
'mocha:src', | ||
[ 'istanbul:src' ], | ||
mochaHandler.bind(null, 'src', COVERAGE_SRC) | ||
); | ||
gulp.task( | ||
'mocha:dist', | ||
[ 'istanbul:dist' ], | ||
mochaHandler.bind(null, 'dist', undefined) | ||
); | ||
gulp.task('babel', function() { | ||
return gulp.src('src/**').pipe(babel({ | ||
return gulp.src(SRC).pipe(babel({ | ||
comments: false | ||
})).pipe(gulp.dest('dist')); | ||
})).pipe(gulp.dest(TRANSPILED_SRC_DIR)); | ||
}); | ||
@@ -87,3 +61,3 @@ gulp.task('esdoc', function() { | ||
const version = argv.version, | ||
bump = (f) => fs.writeFileSync(f, fs.readFileSync(f, 'utf8').replace( | ||
bump = f => fs.writeFileSync(f, fs.readFileSync(f, 'utf8').replace( | ||
/[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}/, | ||
@@ -103,9 +77,37 @@ version | ||
} else { | ||
throw new Error(bold(red('No version specified!!'))); | ||
throw new Error(bread('No version specified!!')); | ||
} | ||
}); | ||
gulp.task('watch', [ 'jscs', 'mocha' ], function() { | ||
gulp.watch([ SRC, TEST_SRC ], [ 'mocha' ]); | ||
gulp.task('watch', [ 'jscs', 'mocha:src' ], function() { | ||
gulp.watch([ SRC, TEST_SRC ], [ 'mocha:src' ]); | ||
}); | ||
gulp.task('test', [ 'jscs', 'mocha' ]); | ||
gulp.task('default', [ 'jscs', 'mocha', 'babel', 'esdoc' ]); | ||
gulp.task('watch:babel', [ 'babel' ], function() { | ||
gulp.watch([ 'src/**' ], [ 'babel' ]); | ||
}); | ||
gulp.task('test:src', [ 'jscs', 'mocha:src' ]); | ||
gulp.task('test:dist', [ 'mocha:dist' ]); | ||
gulp.task('test', [ 'test:src' ]); | ||
gulp.task('default', [ 'cobertura', 'babel', 'esdoc' ]); | ||
function istanbulHandler(src, cb) { | ||
gulp.src(src).pipe(istanbul({ | ||
instrumenter: Instrumenter, | ||
includeUntested: true, | ||
babel: { | ||
stage: 0 | ||
} | ||
})).pipe(istanbul.hookRequire()).on('finish', cb); | ||
} | ||
function mochaHandler(src, coverage = '/tmp') { | ||
global.TEST_ENV = src; | ||
return gulp.src(TEST_SRC).pipe(mocha({ | ||
reporter: 'spec' | ||
})).pipe(istanbul.writeReports({ | ||
dir: coverage, | ||
reportOpts: { | ||
dir: coverage | ||
}, | ||
reporters: [ 'text', 'text-summary', 'lcov' ] | ||
})); | ||
} |
{ | ||
"name": "angie-log", | ||
"version": "0.9.12", | ||
"version": "0.10.0", | ||
"author": "Joe Groseclose <@benderTheCrime>", | ||
@@ -15,3 +15,3 @@ "description": "An extremely lightweight logging utility for NodeJS built in ES6", | ||
"scripts": { | ||
"test": "gulp test", | ||
"test": "gulp test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"postinstall": "babel src --out-dir dist --comments false" | ||
@@ -43,4 +43,5 @@ }, | ||
"chai": "2.3.0", | ||
"coveralls": "^2.11.6", | ||
"gulp": "3.9.0", | ||
"gulp-babel": "^5.2.1", | ||
"gulp-babel": "5.2.1", | ||
"gulp-cli": "0.2.0", | ||
@@ -53,3 +54,2 @@ "gulp-esdoc": "0.0.3", | ||
"isparta": "3.0.3", | ||
"istanbul-cobertura-badger": "0.0.4", | ||
"simple-mock": "0.3.0", | ||
@@ -59,6 +59,6 @@ "yargs": "^3.21.0" | ||
"dependencies": { | ||
"babel": "^5.6.4", | ||
"babel-core": "^5.8.23", | ||
"babel": "5.6.4", | ||
"babel-core": "5.8.23", | ||
"chalk": "1.0.0" | ||
} | ||
} | ||
} |
@@ -11,3 +11,3 @@ ![emblem](https://rawgit.com/angie-framework/angie-log/master/svg/angie.svg "emblem") | ||
![build status](https://travis-ci.org/benderTheCrime/angie-log.svg?branch=master "build status") | ||
![code coverage](https://rawgit.com/angie-framework/angie-log/master/svg/coverage.svg "code coverage") | ||
[![Coverage Status](https://coveralls.io/repos/benderTheCrime/angie-log/badge.svg?branch=master&service=github)](https://coveralls.io/github/benderTheCrime/angie-log?branch=master) | ||
[![documentation](https://doc.esdoc.org/github.com/angie-framework/angie-log/badge.svg)](https://doc.esdoc.org/github.com/angie-framework/angie-log/ "documentation") | ||
@@ -27,5 +27,5 @@ | ||
``` | ||
#### If Used Standalone | ||
```javascript | ||
import {default as Log} from 'angie-log'; | ||
import { default as Log } from 'angie-log'; | ||
@@ -72,5 +72,17 @@ // Call a new logger with defaults | ||
For a list of Frequently Asked Questions, please see the [FAQ](https://github.com/benderTheCrime/angie-log/blob/master/FAQ.md "FAQ") and the [CHANGELOG](https://github.com/benderTheCrime/angie-log/blob/master/CHANGELOG.md "CHANGELOG") for an up to date list of changes. Contributors to this Project are outlined in the [CONTRIBUTORS](https://github.com/benderTheCrime/angie-log/blob/master/CONTRIBUTORS.md "CONTRIBUTORS") file. | ||
#### If Used in an Angie Application | ||
Include the module in the same fashion as it is above, or wherever called modules are bound: | ||
```javascript | ||
@Controller | ||
class Test { | ||
constructor($Log) { | ||
$Log.info('The log module was included in a controller'); | ||
} | ||
} | ||
``` | ||
The functions available on the Angie Log module are equivalent in either context. | ||
For a list of Frequently Asked Questions, please see the [FAQ](https://github.com/benderTheCrime/angie-log/blob/master/md/FAQ.md "FAQ") and the [CHANGELOG](https://github.com/benderTheCrime/angie-log/blob/master/md/CHANGELOG.md "CHANGELOG") for an up to date list of changes. Contributors to this Project are outlined in the [CONTRIBUTORS](https://github.com/benderTheCrime/angie-log/blob/master/md/CONTRIBUTORS.md "CONTRIBUTORS") file. | ||
### Angie | ||
Please see the [site](http://benderthecrime.github.io/angie/) for information about the project, a quickstart guide, and documentation and the [CHANGELOG](https://github.com/benderTheCrime/angie/blob/master/CHANGELOG.md) for an up to date list of changes. | ||
Please see the [site](http://benderthecrime.github.io/angie/) for information about the project, a quickstart guide, and documentation and the [CHANGELOG](https://github.com/benderTheCrime/angie/blob/master/md/CHANGELOG.md) for an up to date list of changes. |
@@ -9,3 +9,3 @@ /** | ||
import fs from 'fs'; | ||
import chalk, {bold} from 'chalk'; | ||
import chalk, { bold } from 'chalk'; | ||
@@ -185,3 +185,3 @@ const CWD = process.cwd(), | ||
*/ | ||
$setOutfile(o = 'angie.log') { | ||
$setOutfile(o = DEFAULT_LOG_FILE) { | ||
this.$$outfile = `${CWD}/${removeLeadingSlashes(o)}`; | ||
@@ -430,2 +430,10 @@ return this; | ||
// Declare the module in the Angie app space | ||
if ( | ||
typeof app === 'object' && | ||
typeof app.factory === 'function' | ||
) { | ||
app.factory('$Log', $LogProvider); | ||
} | ||
export default $LogProvider; |
@@ -0,17 +1,22 @@ | ||
// Test Modules | ||
import { expect, assert } from 'chai'; | ||
import simple, { mock, spy } from 'simple-mock'; | ||
// System Modules | ||
import fs from 'fs'; | ||
import chalk, {bold} from 'chalk'; | ||
import fs from 'fs'; | ||
import chalk, { bold } from 'chalk'; | ||
// Test Modules | ||
import {expect, assert} from 'chai'; | ||
import simple, {mock} from 'simple-mock'; | ||
global.app = { factory: spy() }; | ||
require.cache = {}; | ||
// Angie Log Modules | ||
import {default as Log} from '../../../src/services/$LogProvider'; | ||
const Log = require(`../../../${global.TEST_ENV}/services/$LogProvider`), | ||
CWD = process.cwd(); | ||
const CWD = process.cwd(); | ||
describe('$LogProvider', function() { | ||
const noop = () => false; | ||
it('expect app to self-register', function() { | ||
expect(global.app.factory.calls[0].args).to.deep.eq([ '$Log', Log ]); | ||
}); | ||
describe('constructor', function() { | ||
@@ -18,0 +23,0 @@ beforeEach(function() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
48428
945
85
4
+ Addedast-types@0.8.5(transitive)
+ Addedbabel@5.6.4(transitive)
+ Addedbabel-core@5.8.23(transitive)
+ Addedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
+ Addedleft-pad@0.0.3(transitive)
+ Addedline-numbers@0.2.0(transitive)
+ Addedrecast@0.10.24(transitive)
+ Addedregenerator@0.8.35(transitive)
+ Addedsource-map@0.4.4(transitive)
- Removedast-types@0.8.12(transitive)
- Removedbabel@5.8.38(transitive)
- Removedbabel-core@5.8.38(transitive)
- Removedrecast@0.10.33(transitive)
- Removedregenerator@0.8.40(transitive)
Updatedbabel@5.6.4
Updatedbabel-core@5.8.23