nodejs-dashboard icon indicating copy to clipboard operation
nodejs-dashboard copied to clipboard

Support for Meteor

Open srbdev opened this issue 8 years ago • 3 comments

This is more of an idea and/or feature request, if at all possible. It would be useful to have this data while developing a Meteor application.

Thanks for the tool!

srbdev avatar Oct 14 '16 14:10 srbdev

I work with Meteor too, would be really nice to see it there

jbonigomes avatar Oct 28 '16 21:10 jbonigomes

I was able to get this module working with Meteor. All it needs to do is to modify the Meteor's execution script:

  • The script is: /Users/username/.meteor/meteor (if you are on MacOS)
  • Replace the last line used to start node server at the bottom with these lines:
function npm_package_is_installed {
  # set to 1 initially
  local return_=1
  # set to 0 if not found
  ls node_modules | grep $1 >/dev/null 2>&1 || { local return_=0; }
  # return value
  echo "$return_"
}

NODEJS_DASHBOARD="$(which nodejs-dashboard)"
ARR=("" "run" "--settings")

if [[ $1 == "--dashboard" ]] && [[ " ${ARR[*]} " == *" $2 "* ]]; then
  if [[ ! -n "${NODEJS_DASHBOARD}" ]]; then
    echo "nodejs-dashboard is not installed globally"
    exit 1
  fi
  if [[ "$(npm_package_is_installed nodejs-dashboard)" == "0" ]]; then
    echo "Please install nodejs-dashboard to you project"
    exit 1
  fi
  shift
  exec "$NODEJS_DASHBOARD" "--" "$DEV_BUNDLE/bin/node" "-r" "nodejs-dashboard" ${TOOL_NODE_FLAGS} "$METEOR" "$@"
else
  exec "$DEV_BUNDLE/bin/node" ${TOOL_NODE_FLAGS} "$METEOR" "$@"
fi

Then you will need to add --dashboard option to meteor command to run with nodejs-dashboard. Without --dashboard, it will works normally.

meteor --dashboard
meteor --dashboard --settings settings.json
meteor --dashboard run
meteor --dashboard run --settings settings.json

Also, your Meteor project should have version 1.4., otherwise the measurement for cpu and memory may not work. This is because Meteor 1.3 and older run with Node 0.10. which seems uncompatible with this module.

nlhuykhang avatar Nov 05 '16 06:11 nlhuykhang

@nlhuykhang That would be a pretty nice addition to Meteor. Do you intend to push a PR on their repo?

PEM-- avatar Dec 23 '16 15:12 PEM--