This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-04
Channels
- # announcements (5)
- # babashka (2)
- # beginners (53)
- # biff (11)
- # calva (5)
- # cider (4)
- # clojure (32)
- # clojure-austin (2)
- # clojure-dev (5)
- # clojure-europe (17)
- # clojure-norway (22)
- # clojurescript (23)
- # core-logic (1)
- # cryogen (1)
- # datomic (1)
- # dev-tooling (7)
- # emacs (6)
- # fulcro (63)
- # guix (1)
- # hyperfiddle (14)
- # integrant (2)
- # lsp (6)
- # missionary (4)
- # nbb (42)
- # overtone (9)
- # reitit (8)
- # specter (3)
- # sql (2)
- # squint (7)
- # tools-build (9)
Hi everyone! I started to use nbb with Deno 😃 ( I like dinosaurs 🦕 😂 ) because I understand that bebo is not than mature that nbb but I have problems to use npm modules if I not use package.json and node_modules folder. What is the better approach to use nbb with deno? Can be use deno compile? The project that I started is a azure pipeline generator
The "bebo" project doesn't seem to be necessary anymore since nbb now works with deno
The problem is only that when I try to require a npm library nbb not found it if I don’t do before npm install library. I try to use a ts file when import nbb and all the npm libraries before loadfile nbb’s method
I’ll try to create a repo to show the example
ah this is maybe because nbb used dynamic import which deno doesn't support that well? thanks, I'll look forward to the repro
I don’t know squint, it looks an interesting project 😃. I’m a noob of clojure and all the clojure’s ecosystem but I’ll try to use it in my new proyects for learning it. I like the concept of babashka and nbb because I can use it for a cli development this is the reason because I start my journey with nbb 😃
And nbb because I need a template engine and try to use nunjucks. I don’t know if exists something similar that I can use with bb
Jejeje I’m really noob in this world sorry if I don’t know something obvious
can you maybe try
async function foo() {
import('my-library');
}
await foo();
in a .js file in deno?
without having my-library
inside node_modules / package.json?
I think this will fail in deno and this is similar to how nbb behaves.
With squint however, it first generates source code and then that is executed by deno, which is more like:
import * as my_lib from 'my-library'
Ohhh thanks! I’ll try to use it and I’ll tell to you the result of the testing 😃
Hi again! I finally found the way to my code works. This is the repo: https://github.com/ulthuan/test_nbb If you execute with deno run -A run_bb.ts don’t work but if you run with the —node-modules-dir flag deno itself create the node_module directory and all works 😃. I hope this example helps to others 😃
It would be helpful if you could add to the README how to actually run it. I tried a bunch of different things like:
deno run —-node-modules-dir run_bb.ts
Sorry I suppose that I do something wrong 😑. I updated the repo with a Readme file and config file of deno that help to run the example easily
I try again to run my example to detect the errors
I updated a little bit the Readme for help to understand better the options and the example I hope that now works when you run it
@U063PEZMD7Y I'm seeing this now:
$ deno run -A --node-modules-dir --lock run_bb.ts
error: the following required arguments were not provided:
[SCRIPT_ARG]...
Usage: deno run --allow-all --node-modules-dir[=<node-modules-dir>] --lock [<FILE>] [SCRIPT_ARG]...
For more information, try '--help'.
What is your deno version for try to reproduce it?
It’s strange because I try again cleaning cache before just in case
$ deno --version
deno 1.37.2 (release, aarch64-apple-darwin)
v8 11.8.172.13
typescript 5.2.2
Try to run it without extra flags
And with the deno.json
deno run -A run_bb.ts
It’s works!!
The configuration file use the lock file and the node_modules directory … it’s the same that the flags but I suppose that don’t work as I expected 😓
I’ll try again and fix the documentation with the use of the explicit name of the file in the lock parameter. Thanks for your time! I hope that this example help to more user of deno + nbb 😃
ok, but I guess this only works because you added import "npm:nunjucks"
to the start file right?
Yes I think so
Another option for that it’s a use of deps.ts file with all the dependencies and cache it before run nbb in the same folder
Yes it’s another option of course I try it before and works too
I think that a little “wrapper” for use deno with nbb it’s the load of deps.ts it’s a default convention in deno
I’ll try a little more because I don’t know all the options that the deno runtime provides but at this moment with my knowledge those are the best options that I know
I’ll glad to write that .md when I finished a little bit more research and we’ll can discuss the content of the file through here or a direct message or after the first push in the PR
Hi again! I updated the example repo with the compromise solution that I think that helps more to develop with Deno. The workflow will be like that: change deno.json with new dependencies, run the task update_cache and after that you can use the nbb task to run your code. If you want to distribute your code you can use the nbb_compile task to generate a self contained binary. You’ll need the jq utility to run the update_cache task