|
An attempt to use repl-driven-development and eev together
See:
https://emacsconf.org/2023/talks/eval/
http://alhassy.com/repl-driven-development
http://anggtwu.net/e/emacs.e.html#repl-driven-development
https://github.com/alhassy/repl-driven-development
•• Make sure that there is an entry for MELPA in package-archives.
•• (find-epp package-archives)
•• (find-melpa-links)
•• Install repl-driven-development.
•• (find-epackage-links 'repl-driven-development "rdd" t)
• (package-initialize)
• (package-refresh-contents)
•• (package-delete (ee-package-desc 'repl-driven-development))
• (package-install 'repl-driven-development)
•• (find-epackage 'repl-driven-development)
• (code-c-d "rdd" "~/.emacs.d/elpa/repl-driven-development-20231123.1917/")
•• (find-rddfile "")
•• The default for text-quoting-style is usually nil:
• (text-quoting-style)
•• See: (find-evardescr 'text-quoting-style)
•• Set it to 'grave:
• (setq text-quoting-style 'grave)
• (text-quoting-style)
•• Here is the "minimal server" example:
•• (find-efunctiondescr 'repl-driven-development)
•• (find-efunctiondescr 'repl-driven-development "minimal server, and")
•• (find-efunctiondescr 'repl-driven-development "npm install -g express axios")
••
•• In the next block we to run that example in /tmp/ using
•• "npm install" instead of "npm install -g":
;;-- (ee-copy-rest '(0 ";;--snip--") '(find-fline "/tmp/o.js"))
/*
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
npm install express axios
• (eepitch-nodejs)
• (eepitch-kill)
• (eepitch-nodejs)
*/
let app = require('express')()
let clicked = 1
app.get('/hi', (req, res) => res.send(`Hello World × ${clicked++}`))
let server = app.listen(3000)
// Now visit http://localhost:3000/hi a bunch of times!
// Better yet, see the output programmatically...
let axios = require('axios')
// Press C-x C-j a bunch of times on the following expression:
// console.log((await axios.get('http://localhost:3000/hi')).data)
//
// ^ I had to replace the line above by:
(async () => {console.log((await axios.get("http://localhost:3000/hi")).data)})();
// Consider closing the server when you're done with it.
server.close()
/*
• (eepitch-nodejs)
• (eepitch-kill)
• (eepitch-nodejs)
// This yields an ECONNREFUSED because the axios.get(...) is run
// before the app.listen(...) sets up the socket:
require("./o.js")
*/
;;--snip--
•• Test the script:
• (find-fline "/tmp/o.js")
|
|