From cade00d5db628d9eafc6d54dcc3c5f9bb7b587df Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 10 Dec 2018 12:55:00 -0700 Subject: [PATCH] Scaffold: Normalize repository --- .editorconfig | 1 + .gitattributes | 1 + .npmrc | 1 + .travis.yml | 4 +++- LICENSE | 2 +- README.md | 26 ++++++++++++++++++++++++-- appveyor.yml | 26 ++++++++++++++++++++++++++ index.js | 6 +++--- package.json | 20 +++++++++++++------- test/.eslintrc | 6 ++++++ test/index.js | 14 +++++++------- 11 files changed, 86 insertions(+), 21 deletions(-) create mode 100644 .gitattributes create mode 100644 .npmrc create mode 100644 appveyor.yml create mode 100644 test/.eslintrc diff --git a/.editorconfig b/.editorconfig index 5760be5..e000b0c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +end_of_line = lf [*.md] trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fcadb2c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml index 9af41a7..7e14b19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ sudo: false language: node_js node_js: - - '9' + - '10' - '8' - '6' - '4' - '0.12' - '0.10' +after_script: + - npm run coveralls diff --git a/LICENSE b/LICENSE index 2d92a2b..3a58630 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Blaine Bublitz +Copyright (c) 2014, 2015, 2018 Blaine Bublitz and Eric Schoffstall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1cf8bae..897e105 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ +

+ + + +

+ # glogg -[![Travis Build Status](https://img.shields.io/travis/js-cli/glogg/master.svg?label=travis&style=flat-square)](https://travis-ci.org/js-cli/glogg) +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] -Global logging utility +Global logging utility. ## Usage @@ -90,3 +96,19 @@ the logger methods. ## License MIT + +[downloads-image]: http://img.shields.io/npm/dm/glogg.svg +[npm-url]: https://www.npmjs.com/package/glogg +[npm-image]: http://img.shields.io/npm/v/glogg.svg + +[travis-url]: https://travis-ci.org/gulpjs/glogg +[travis-image]: http://img.shields.io/travis/gulpjs/glogg.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glogg +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glogg.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/glogg +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/glogg/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..bd65027 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +# http://www.appveyor.com/docs/appveyor-yml +# http://www.appveyor.com/docs/lang/nodejs-iojs + +environment: + matrix: + # node.js + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "4" + - nodejs_version: "6" + - nodejs_version: "8" + - nodejs_version: "10" + +install: + - ps: Install-Product node $env:nodejs_version + - npm install + +test_script: + - node --version + - npm --version + - cmd: npm test + +build: off + +# build version format +version: "{build}" diff --git a/index.js b/index.js index e8a15c4..6e34bcf 100644 --- a/index.js +++ b/index.js @@ -8,13 +8,13 @@ var levels = [ 'debug', 'info', 'warn', - 'error' + 'error', ]; function getLogger(namespace) { var logger = sparkles(namespace); - levels.forEach(function(level){ + levels.forEach(function(level) { logger[level] = makeLogLevel(logger, level); }); @@ -22,7 +22,7 @@ function getLogger(namespace) { } function makeLogLevel(self, level) { - return function(msg){ + return function(msg) { if (typeof msg === 'string') { msg = format.apply(null, arguments); } diff --git a/package.json b/package.json index 40717a6..6d1a8f7 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,11 @@ "name": "glogg", "version": "1.0.1", "description": "Global logging utility", - "author": "Blaine Bublitz (http://iceddev.com/)", - "contributors": [], - "repository": "js-cli/glogg", + "author": "Gulp Team (http://gulpjs.com/)", + "contributors": [ + "Blaine Bublitz " + ], + "repository": "gulpjs/glogg", "license": "MIT", "engines": { "node": ">= 0.10" @@ -17,16 +19,20 @@ "scripts": { "lint": "eslint .", "pretest": "npm run lint", - "test": "mocha --async-only" + "test": "mocha --async-only", + "cover": "istanbul cover _mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls" }, "dependencies": { "sparkles": "^1.0.0" }, "devDependencies": { - "eslint": "^1.7.3", - "eslint-config-gulp": "^2.1.0", + "eslint": "^2.13.0", + "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", - "mocha": "^2.5.3" + "istanbul": "^0.4.3", + "istanbul-coveralls": "^1.0.3", + "mocha": "^3.5.3" }, "keywords": [ "global", diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 0000000..c8cdccd --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "gulp/test", + "rules": { + "no-console": 0 + } +} diff --git a/test/index.js b/test/index.js index 6d504b0..b3d2611 100644 --- a/test/index.js +++ b/test/index.js @@ -19,7 +19,7 @@ describe('glogg', function() { }); it('emits a debug event when debug method is called', function(done) { - logger.on('debug', function(msg){ + logger.on('debug', function(msg) { expect(msg).toEqual('test'); done(); }); @@ -28,7 +28,7 @@ describe('glogg', function() { }); it('emits a info event when info method is called', function(done) { - logger.on('info', function(msg){ + logger.on('info', function(msg) { expect(msg).toEqual('test'); done(); }); @@ -37,7 +37,7 @@ describe('glogg', function() { }); it('emits a warn event when warn method is called', function(done) { - logger.on('warn', function(msg){ + logger.on('warn', function(msg) { expect(msg).toEqual('test'); done(); }); @@ -46,7 +46,7 @@ describe('glogg', function() { }); it('emits a error event when error method is called', function(done) { - logger.on('error', function(msg){ + logger.on('error', function(msg) { expect(msg).toEqual('test'); done(); }); @@ -55,7 +55,7 @@ describe('glogg', function() { }); it('formats a string message with util.format syntax', function(done) { - logger.on('debug', function(msg){ + logger.on('debug', function(msg) { expect(msg).toEqual('test something'); done(); }); @@ -66,7 +66,7 @@ describe('glogg', function() { it('does not format a non-string message', function(done) { var expected = { test: 'something' }; - logger.on('debug', function(msg){ + logger.on('debug', function(msg) { expect(msg).toEqual(expected); done(); }); @@ -77,7 +77,7 @@ describe('glogg', function() { it('allows you to "destructure" the individual log-level functions', function(done) { var debug = logger.debug; - logger.on('debug', function(msg){ + logger.on('debug', function(msg) { expect(msg).toEqual('test'); done(); });