anonimitoraf / skerrick

REPL-driven development for NodeJS
GNU General Public License v3.0
103 stars 6 forks source link
emacs interactive interactive-development javascript js lisp node nodejs repl repl-driven repl-driven-development vscode

Skerrick

noun: skerrick
the smallest bit.
"there's not a skerrick of food in the house"

REPL-driven development for NodeJS

Inspired by (check them out!):

:warning: DISCLAIMERS :warning:

VSCode

:sparkles: Documentation :sparkles:

Emacs

MELPA

Demos

Basic

Basic usage

Module support

Module support

Requirements

Installation

skerrick is in MELPA

Or, if you're using Quelpa:

(quelpa '(skerrick :repo "anonimitoraf/skerrick" :fetcher github))

;; Needs to be run on the very first install of skerrick. Or when you want to upgrade.
(unless (equal (shell-command-to-string "type skerrick") "skerrick not found\n")
  (skerrick-install-or-upgrade-server-binary))

;; Should be run in a JS buffer; it is buffer specific.
;; (skerrick-start-server)

;; Now main function, entry point is:
;; M-x skerrick-eval-region

It may also be helpful to provide a quick keyboard shortcut. E.g., C-x C-e evaluates ELisp, so let's mimic that for JS buffers:

;; Evaluate a region, if any is selected; otherwise evaluate the current line.
(bind-key
 "C-x C-e"  (lambda ()
              (interactive)
              (if (use-region-p)
                  (skerrick-eval-region)
                (beginning-of-line)
                (set-mark-command nil)
                (end-of-line)
                (skerrick-eval-region)
                (pop-mark)))
 'js-mode-map)

Configuration

Configuration Desc Default
skerrick-server-port Port to run the skerrick server on 4321
skerrick-result-overlay-face Face used to display evaluation results
skerrick-result-overlay-char-count-trunc Results with char count longer than this are truncated 120
skerrick-pop-result-buffer-for-stdout Show result buffer if stdout is non-empty t
skerrick-pop-result-buffer-for-stderr Show result buffer if stderr is non-empty t

Usage

Command Desc
skerrick-install-or-upgrade-server-binary Needs to be run on the very first install of skerrick. Or when you want to upgrade.
skerrick-start-server Starts the server. Note that your current buffer will be evaluated, so you probably want to run this command while being on your program's entry point file.
skerrick-stop-server Stops the server.
skerrick-eval-region Evaluates the selected region. Shows the eval result as an overlay. Stdout/stderr get written to the buffer *skerrick-stdout-stderr*.

Write a plug-in for your editor/IDE!

NPM