/meteor-server-console

Connect to a meteor server, evaluate expressions or execute custom helper functions and browse the results/log output.

Primary LanguageJavaScriptMIT LicenseMIT

meteor-server-console

is a tool which connects to a meteor server running the meteor-server-eval smartpackage and provides a way to evaluate javascript in the server environment.

With version 0.5 starts the evolution towards a terminal like development tool with helper functions and server log. Currently implemented helper functions support git, tinytest and package skeleton creation. Please feel free to request features, suggest improvements or even add your own helpers like meteor-server-eval git helpers

I'm publishing meteor-server-console as a "Chrome DevTools" extension but its also possible to use it in other browsers (just clone the repository and open meteor_console.html).

Setup

  • OPTIONAL: install extension in your chrome (open chrome://extensions and drag and drop the .crx file)
  • add smartpackage meteor-server-eval to your app
  • start your app and open meteor-server-console (appears in "Chrome DevTools" as the new Tab "Meteor Console")

Use

Connection

  • automatically connects to localhost:3000 by default, to change the port see Input->client commands ("ws://localhost:3000/websocket")
  • polls the server and connects automatically when server starts/restarts

Evaluations

  • are executed as eval(expression) in meteor node.js container, optionally scoped to package context
  • REQUIREMENT: meteor-server-eval

Input

  • general:

    • type in a expression and hit ENTER to evaluate
    • type in an object name or part of it and press CTRL + SPACE to trigger autocomplete
    • select last evaluated expressions with the UP and DOWN keys
  • server commands (helpers):

    • type . and a popup with all supported server side helper functions shows up
      • .clear clear console output
      • .toggleLogging toggle interception of server side logs (default: ON)
      • .updateMetadata mostly internal to update metadata like supported packages/helper
      • .git basically calls git in the project repository (+ shortcut commands .gitStatus/.gitDiff/...)
      • .create-package adds a skeleton smartpackage (requires package name as parameter)
      • .test-package starts meteor test-packages in app or package scope on port 5000 (--port to change)
      • .cancel-tests-xxx automatically added to stop test runner
  • client commands:

    • type : and a popup with the following commands shows up
      • :scope=package_name sets the package in which evaluations should be scoped if supported
      • :reset-scope resets scope to global
      • :set-port=4000 sets the port to switch app instance
      • :port shows current port
      • :set-host=localhost sets the host to switch app instance
      • :host shows current host
      • :watch=expr add/refresh expression to/in watch view and open if closed
      • :watch-view toggle watch view open/closed
      • :watch-view60 change watch view width in percent (arbitrary)
      • :reload reload the page, all results before last server start will disappear
      • :max-log-entries=10 sets the maximum number of non helper logs in output and deletes if reached
      • :collapse-logs just collapses all expanded logs

Output (not stored in app db)

  • internal messages/ autocomplete

    • Error=red, Info=orange, SUCCESS=green
    • autocomplete displays object keys in a table and/or sets the input value to matching key
  • evaluation results

    • expression in first line (leading #), result below and scope with evaluation time in milliseconds on the right side
    • Strings, Numbers, Booleans directly
    • Objects as tree - different colors for different types (Function=blue, Object=green, Array=orange, Circular=red) - Objects are shown with name (if available) of constructor Function - Circular References are marked and shown with path - Errors with stacktrace (special format with the attempt of highlighting more relevant lines)
  • server log (see server commands)

    • leading green (or Error=red) label with static text 'Log' + log message (expandable if multi line)
    • if the server log is intercepted, all log entries (up to the max) will get rendered in output window
    • the calls of helper functions can also produce log entries wich are always displayed

Watch

  • watch view, refresh and remove watches
  • watches are persistent on the server and automatically refreshed if server restarts

In action...

Video coming soon...

v0.2 Screenshot which shows Package scope functionality:

ScreenShot

v0.1 Screenshot which shows common use:

ScreenShot