Learn how to use Node.js packages in the Deno JavaScript runtime with its new NPM specifier. #typescript #nodejs #javascript Deno NPM support blog post deno.com/blog/v1.28 Fireship CLI Tutorial • I created a Command Li...
Eh, while all the compat stuff is available for the npm modules, they’re not available in your code, aka you’ll never have to use module.exports/require and such.
I learned Javascript and I’m thankful to js. Now, I can finally learn a low level language. I used it as a tool to learn to code and That’s where I want to draw the line.
You can actually compile deno to a self contained executable with "deno compile". But that feature is unstable and I think that npm support will soon be coming to that feature
babel has a standalone package that does runtime transpilation, meaning you can write JSX/TS/SCSS and the transpilation step will happen after DOM load, directly in the browser.
@@1000percent1000 I know but the original commenter does not want to introduce a JavaScript runtime environment with proper bundlers and transpilers so it's always an option.
I don’t like seeing npm written in the source code. I would’ve liked to have a config file that would point to the npm registry url instead. Sort of what gradle does. Maybe could’ve leveraged import maps for that.
If we can already import packages from any registry using import maps, then why have they added the “npm:” import to deno? Seems redundant unless there’s some npm-specific reason for not using import maps. Why should deno make an exception for npm?
1:04 Is this a good thing? Where do you store (serializible) project metadata in deno codebases? While `package.json` can become an unwieldy dumping ground for unrelated keys, it also provides a place to store serializible data which would be all over the codebase otherwise. How does deno scope local and global packages without `node_modules`?
You're comment actually made me think quite a bit. Some really good questions you're asking here. After digging around a bit, I think the answer is yes, it's a good thing that package.json is gone. And no, I don't think you can install modules globally/locally for deno, since that's not how deno works. I also can't think of a scenario where globally/locally installed modules are more sensible than deno's default sandboxing with setting explicit permissions when required, but am happy to change my mind, if you have one :). I could probably not explain it better than Ryan Dahl does himself in the talk he gave on why Deno came to exist in the first place: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-M3BM9TB-8yA.html
I wonder what's the best way to manage package versions in deno. If you use the package more than once and wish to change its version, you have to change it across the whole app. I've seen some ideas with declaring a single file that imports a versioned package and reexports it for the app. I've also seen some native way to keep track of versions in importMap, though I've had trouble providing types for packages that don't ship with them. Any idea?
@@vintprox what was also bothering me a bit is that one of the selling points of deno (even mentioned in this video) is that it doesn't need a package.json file. In my eyes, importMap is pretty much the same package.json file...
This is great to hear but I don't think I'll be switching anytime soon because it doesn't really have the community & ecosystem Node has. At least not yet.
I already switched, as soon as Deno 1.0 launched, and I'm definitely NOT coming back to insecure node. The security model in Deno is just that important.
Seems like the way to go to me. Although the desire to call it "package.ts" is a little bit strong... at that point you kind of lose the "advantage" of not having a package.json
@@fltfathin Ryan literally announced deno by apologizing for strange packaging patterns. Let's review. He said that Isaac created package.json, but he (Ryan) designed `require` around it. Making it mandatory. He said that he regretted how node_modules is resolved. Then finally, the point that "index.js" became the default entrypoint.
I think Ryan was dead wrong about being upset about node_modules being local and vendored-by-default. It's a very good pattern. I can't stand using pip because I need extra tools to isolate my dependencies. Tell me the last time you used python with more than two dependencies that you didn't reach for a virtual environment.
@@codeman99-dev when working with JVM languages, gradle does this too by containing the cached deps in the .gradle folder, honestly don't see what is so wrong about node_modules, the package.json is definitely something that could use some work though
No just export all your dependencies in a deps.ts file and then use it in any of your project files That's how a standard deno project looks like, ofc they don't use import in every file with a URL that long Just make a central deps file exporting all the dependcies
Could say the same about creating a backend with node, being with express or even Nest, no gains with tons of extra work. And where do you see the extra work from this video ?
So. If I use Lodash functions in multiple files in my project I either have to omit the version and hope the latest doesn't break stuff or set the version in every import and then update each and every import if I want to upgrade Lodash? (You can replace Lodash with any other 3rd-party library if you don't like Lodash.)
Great and all that you can specify package using links inline but the reason we have a package-lock.json. What happens when I want reproducable builds?
Deno also has a built in test runner and a testing framework that is pretty good straight out of the box. It also has the linter built into it and the lsp server too. I'm loving this a heck ton over node js which I never touched because it was ugly from the beginning imo Deno's imports however are trash because obviously it's hard to see what's being imported from a single place. Yes import maps are there but there's no enforcement to only allow imports from the map. It is very well possible to import things outside of the import map
Yeah I like deno's imports but I don't like the idea of having to copy and paste the exact same import everywhere in my code, especially with version limits
the convenience of node makes it incredibly difficult for me to ever consider switching. this is a 3min video to show us how to accomplish the equivalent of "npm install x"
@@lydianlights Just like the guy above you clearly missed the point of the video, it's not about the fact that you don't need to install but about the fact that deno is now compatible with npm packages. Your smartness is indeed incredible.
All I need is to figure out a central way to update all packages used in deno without need to go to every file. Package json might be overused, but it still serves as a central location to manage app dependencies.
it is cached locally, otherwise it wouldn't be called a cache. It is just not cached within the project root but rather to a global directory somewhere in your PC. That being said, you can get a node-like node_modules by executing the commands with --node-modules-dir
Would honestly be using deno a lot more if they had backwards compatibility planned as bun does... Having to port a project to a new runtime altogether is painful, and a lot of packages do not really support deno well.
@@crowlkats whoops you’re right, but If I’m not mistaken the formatting that deno does come with a default of 2 spaces (and I just found that a bit cursed)
Proton works really nicely, and it's not steamOS but just Linux, given some limitations like non compatible anti cheats etc, you're obviously exaggerating. And If you're a Dev and can't follow 3 instructions on proton DB then that's problematic, it's easier than your basic 3 liners "get started" for any npm package.
My experience with deno is really bad. I wanted to use it with firebase admin package. Even though I tried to setup it under the guidance of people from the discord server, i couldn't manage to set it up. They also couldn't help about this. So i ended up with netlify functions which is pretty easy if you compare with deno.
I doubt it solves peer-dependencies problem and I am already tired of reverting package updates because of TS compilation errors. I'll give it a pass unless someone can prove Deno can handle a large Nuxt app and monorepo.
It's definitely interesting but considering there's no place to define installed packaged besides imports themselves I'd imagine auto-imports wouldn't be possible...nor can I get over thr syntax of the type directive 🤮