REPL-driven development for NodeJS
GPL-3.0 License
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!):
✨ Documentation ✨
node
/npm
installed and accessible by Emacsskerrick
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 | 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 |
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* . |
npm install -g skerrick
- this installs the bin skerrick
Invoked like so: skerrick PORT ENTRYPOINT_FULL_FILE_PATH
The REST protocol is as simple as it can be:
/eval
payloads of shape:
{
"modulePath": "/full/path/to/file/of/code/to/eval",
"code": "const x = 42; console.log(x); x + x;"
}
{
"result": "84",
"stdout": "42",
"stderr": ""
}
🚀 Tell me about your plug-in so I can add it to this README! 🚀