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

Added compatibility to bundlers (closes #144 #152 #153) #154

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.1

- removed dynamic requires to allow for bundling

### 3.0

- removes node 8 support
Expand Down
24 changes: 12 additions & 12 deletions lib/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

const fs = require('fs')
const os = require('os')
const ps = require('./ps')

const platformToMethod = {
aix: 'ps',
android: 'procfile',
alpine: 'procfile',
darwin: 'ps',
freebsd: 'ps',
os390: 'ps',
linux: 'procfile',
netbsd: 'procfile',
sunos: 'ps',
win: 'wmic'
aix: ps,
android: require('./procfile'),
alpine: require('./procfile'),
darwin: ps,
freebsd: ps,
os390: ps,
linux: require('./procfile'),
netbsd: require('./procfile'),
sunos: ps,
win: require('./wmic')
}

const ps = require('./ps')
let platform = os.platform()

if (fs.existsSync('/etc/alpine-release')) {
Expand All @@ -29,7 +29,7 @@ if (platform.match(/^win/)) {

let stat
try {
stat = require('./' + platformToMethod[platform])
stat = platformToMethod[platform]
} catch (err) {}

/**
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pidusage",
"version": "3.0.0",
"version": "3.0.1",
"description": "Cross-platform process cpu % and memory usage of a PID",
"license": "MIT",
"homepage": "https://github.com/soyuka/pidusage",
Expand Down