deno icon indicating copy to clipboard operation
deno copied to clipboard

how to set up so all code can be easily instrumented?

Open bkerin opened this issue 1 year ago • 2 comments

I'd like the entirety of everything being used to notice if I stick console.log("something") in it but if I have to re-run deno task dev or something after instrumenting something that's fine too.

So far I found deno info and deno vendor but the first doesn't go down to source-level for npm packages:

deno info "npm:@hono/auth-js"
dependencies: 13 unique
size: 4.79MB

npm:/@hono/[email protected] (50.04KB)
├─┬ npm:/@auth/[email protected][email protected] (1.51MB)
│ ├── npm:/@panva/[email protected] (12.33KB)
│ ├── npm:/@types/[email protected] (9.84KB)
│ ├── npm:/[email protected] (23.18KB)
│ ├── npm:/[email protected] (495.36KB)
│ ├── npm:/[email protected] (149.44KB)
│ ├── npm:/[email protected] (1.09MB)
│ └─┬ npm:/[email protected][email protected] (350.21KB)
│   ├── npm:/[email protected] (1.09MB)
│   └── npm:/[email protected] (17.72KB)
├── npm:/[email protected] (801.25KB)
└─┬ npm:/[email protected] (310.65KB)
  └─┬ npm:/[email protected] (5.68KB)
    └── npm:/[email protected] (14.72KB)

And the latter didn't seem to get picked up automatically (though maybe I failed to reset a cache or something if that has to be done manually). And per-module vendor isn't really what I want anyway, I'd like it to just all be there 100% of the time.

I'd be fine with the right cp -r if that's the best way. Any advice appreciated.

bkerin avatar May 22 '24 19:05 bkerin

Add "vendor": true in your deno.json (note that this is different from the deno vendor command). Enabling that option in deno.json will put all npm modules in a local node_modules folder and all other dependencies in a vendor/ folder in your project.

marvinhagemeister avatar May 22 '24 22:05 marvinhagemeister

Thanks. One small thing:

If node_modules doesn't already exist an unhelpful error happens:

$ rm -rf node_modules/
---------------------------------------------------------------------------
$ deno task dev
error: No such file or directory (os error 2)
[ble: exit 1]
---------------------------------------------------------------------------

Just naming the missing file would mostly mitigate this.

Manually creating node_modules/ fixes it.

I didn't check if the same issue exists for vendor/

bkerin avatar May 25 '24 17:05 bkerin

Where is that error coming from @bkerin? How did you create the node_modules/ folder then?

lucacasonato avatar Jun 08 '24 14:06 lucacasonato

Besides what I showed I don't know more about where it was coming from. IIRC I just did mkdir node_modules and then it worked.

bkerin avatar Jun 08 '24 18:06 bkerin

Closing as I'm not able to reproduce any errors anymore.

marvinhagemeister avatar Jan 19 '25 21:01 marvinhagemeister