Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using webpack with pino for serverside builds: #2 #201

Merged
merged 4 commits into from Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions bin.js
@@ -0,0 +1,29 @@
#! /usr/bin/env node

'use strict'

var pretty = require('./pretty')

module.exports = pretty

if (require.main === module) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we no longer need this check - safe to remove since we won't be requiring bin.js

if (arg('-h') || arg('--help')) {
usage().pipe(process.stdout)
} else if (arg('-v') || arg('--version')) {
console.log(require('./package.json').version)
} else {
process.stdin.pipe(pretty({
timeTransOnly: arg('-t'),
levelFirst: arg('-l')
})).pipe(process.stdout)
}
}

function usage () {
return require('fs')
.createReadStream(require('path').join(__dirname, 'usage.txt'))
}

function arg (s) {
return !!~process.argv.indexOf(s)
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,7 +5,7 @@
"main": "pino.js",
"browser": "./browser.js",
"bin": {
"pino": "./pretty.js"
"pino": "./bin.js"
},
"files": [
"pino.js",
Expand Down
24 changes: 0 additions & 24 deletions pretty.js
@@ -1,5 +1,3 @@
#! /usr/bin/env node

'use strict'

var split = require('split2')
Expand Down Expand Up @@ -139,25 +137,3 @@ function pretty (opts) {
}

module.exports = pretty

if (require.main === module) {
if (arg('-h') || arg('--help')) {
usage().pipe(process.stdout)
} else if (arg('-v') || arg('--version')) {
console.log(require('./package.json').version)
} else {
process.stdin.pipe(pretty({
timeTransOnly: arg('-t'),
levelFirst: arg('-l')
})).pipe(process.stdout)
}
}

function usage () {
return require('fs')
.createReadStream(require('path').join(__dirname, 'usage.txt'))
}

function arg (s) {
return !!~process.argv.indexOf(s)
}