-
-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract Logger class to own package (#151)
* Extract Logger class to own package * Add README.md for logger package
- Loading branch information
Showing
13 changed files
with
171 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Babel config for Node | ||
// Compiles sources, gulpfile and tests | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { "node": 4 }, | ||
"exclude": [ | ||
// Node 4 supports all the generator features that we use so there is no need in Regenerator | ||
"transform-regenerator" | ||
] | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-class-properties" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<div align="center"> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
<h1>@webpack-bundle-analyzer/logger</h1> | ||
<p>Logging implementation used in webpack-bundle-analyzer.</p> | ||
</div> | ||
|
||
<h2 align="center">Install</h2> | ||
|
||
```bash | ||
npm install --save @webpack-bundle-analyzer/logger | ||
``` | ||
|
||
<h2 align="center">Usage</h2> | ||
|
||
```js | ||
const Logger = require('@webpack-bundle-analyzer/logger'); | ||
|
||
// Possible logging levels are 'info', 'warn', 'error' and 'silent'. | ||
const logger = new Logger('info'); | ||
|
||
logger.info('Informative message'); | ||
logger.warn('Warning, something is not right!'); | ||
logger.error('An error happened!'); | ||
``` | ||
|
||
<h2 align="center">Options</h2> | ||
|
||
```js | ||
new Logger(level: LogLevel); | ||
``` | ||
|
||
|Name|Type|Description| | ||
|:--:|:--:|:----------| | ||
|**`level`**|One of: `info`, `warn`, `error`, `silent`|The logging level to use. `info` displays all log messages, `warn` displays only `.warn` and `.error` logs, `error` displays only `.error` logs and `silent` displays none.| | ||
|
||
|
||
<h2 align="center">Maintainers</h2> | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars3.githubusercontent.com/u/302213?v=4&s=150"> | ||
</br> | ||
<a href="https://github.com/th0r">Yuriy Grunin</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars3.githubusercontent.com/u/482561?v=4&s=150"> | ||
</br> | ||
<a href="https://github.com/valscion">Vesa Laakso</a> | ||
</td> | ||
</tr> | ||
<tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
|
||
const NODE_SRC = './src/**/*.js'; | ||
const NODE_DEST = './lib'; | ||
|
||
gulp.task('clean', gulp.parallel(cleanNodeScripts)); | ||
gulp.task('build', gulp.series('clean', compileNodeScripts)); | ||
gulp.task('watch', gulp.series('build', watch)); | ||
gulp.task('default', gulp.task('watch')); | ||
|
||
function watch() { | ||
gulp | ||
.watch(NODE_SRC, gulp.series(cleanNodeScripts, compileNodeScripts)) | ||
// TODO: replace with `emitErrors: false` option after https://github.com/gulpjs/glob-watcher/pull/34 will be merged | ||
.on('error', () => {}); | ||
} | ||
|
||
function cleanNodeScripts() { | ||
const del = require('del'); | ||
return del(NODE_DEST); | ||
} | ||
|
||
function compileNodeScripts() { | ||
const babel = require('gulp-babel'); | ||
|
||
return gulp | ||
.src(NODE_SRC) | ||
.pipe(babel()) | ||
.pipe(gulp.dest(NODE_DEST)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@webpack-bundle-analyzer/logger", | ||
"version": "3.0.0-alpha.1", | ||
"description": "Logger class used by webpack-bundle-analyzer", | ||
"author": "Yury Grunin <[email protected]>", | ||
"contributors": [ | ||
"Yury Grunin <[email protected]>", | ||
"Vesa Laakso <[email protected]> (http://vesalaakso.com)" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/webpack-contrib/webpack-bundle-analyzer", | ||
"changelog": "https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/CHANGELOG.md", | ||
"bugs": { | ||
"url": "https://github.com/webpack-contrib/webpack-bundle-analyzer/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/webpack-contrib/webpack-bundle-analyzer.git" | ||
}, | ||
"main": "lib/index.js", | ||
"engines": { | ||
"node": ">= 4" | ||
}, | ||
"scripts": { | ||
"start": "gulp watch", | ||
"build": "gulp build", | ||
"test": "mocha --exit --require babel-core/register", | ||
"test-dev": "mocha --watch --require babel-core/register" | ||
}, | ||
"files": [ | ||
"src", | ||
"lib" | ||
], | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
"babel-core": "6.26.0", | ||
"babel-preset-env": "1.6.1", | ||
"babel-plugin-transform-class-properties": "6.24.1", | ||
"gulp": "4.0.0", | ||
"gulp-babel": "7.0.1", | ||
"mocha": "5.0.0" | ||
}, | ||
"keywords": [ | ||
"webpack", | ||
"bundle", | ||
"analyzer", | ||
"logger" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../../../.eslintrc.json", | ||
"env": { | ||
"mocha": true | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
packages/plugin/test/Logger.js → packages/logger/test/Logger.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters