nbb

borkdude 2025-05-08T12:22:24.797699Z

I've published a test version of nbb to the jsr package registry (used by deno) and made a couple of fixes in nbb to make it run better with deno. This means you can now do a standalone script with jsr or npm dependencies in one script. Example:

deno run -A jsr:@babashka/nbb@1.3.200-test-5 /tmp/script.cljs
(ns script
  (:require
   ["npm:react@18.3.1"]
   ["npm:ink@5.2.1" :refer [render]]
   ["npm:ink-select-input$default" :as SelectInput]
   [reagent.core :as r]))

(def items (clj->js [{:label "First"
                      :value "first"}
                     {:label "Second"
                      :value "second"}]))

(declare ink-state)

(defn handle-select [i]
  ((.-clear ink-state))
  ((.-unmount ink-state))
  (js/console.log i)
  (js/process.exit 0))

(defn select []
  [:> SelectInput {:items items :onSelect handle-select}])

(js/console.log render)

(def ink-state (render (r/as-element [select])))
Test it out if you find it useful.

🔥 6