Comparing version 0.0.1 to 0.0.2
#!/usr/bin/env node | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const argv = require('yargs').argv; | ||
const profileLoader = require('../lib/profile-loader'); | ||
const config = require('rc')('cutwood', {}); | ||
const profileName = argv.profile || argv.p || config.p || config.profile || null; | ||
const profileName = argv.profile || argv.p || config.p || config.profile || 'default'; | ||
console.log('Loading cutwood profile', profileName); | ||
const profile = profileLoader.load(profileName); | ||
const settingsPath = path.join(process.cwd(), '.cutwood.js'); | ||
if (fs.existsSync(settingsPath)) { | ||
const settings = require(settingsPath); | ||
console.log('CW::settings', settings); | ||
profileLoader.load(settings); | ||
} | ||
console.log("CW::profile", profileName); | ||
const profile = profileLoader.get(profileName); | ||
const { CutWood } = require('../lib/cutwood'); | ||
@@ -15,0 +22,0 @@ |
'user strict'; | ||
const echo = (cutWood) => { | ||
return cutWood.write(); | ||
const profiles = { | ||
echo: (cutwood) => cutwood.write() | ||
}; | ||
exports.load = (profileName) => { | ||
exports.load = (newProfiles) => { | ||
Object.assign(profiles, (newProfiles || {}).profiles); | ||
}; | ||
exports.get = (profileName) => { | ||
if (!profileName) { | ||
return echo; | ||
return profiles.echo; | ||
} | ||
if (profileName.toLowerCase() === 'server') { | ||
return (cutWood) => { | ||
return cutWood | ||
.evict(/^{"event":"ops"/) | ||
.colour(/error/, 'red') | ||
.write(); | ||
}; | ||
if (typeof profileName === 'function') { | ||
return profileName; | ||
} | ||
return echo; | ||
return profiles[profileName] || profiles.echo; | ||
}; |
{ | ||
"name": "cutwood", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Yet another logger", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
36080
12
178
3