r/Deno • • Oct 10 '24

Programming should be simple

274 Upvotes

50 comments sorted by

23

u/rykuno Oct 11 '24

So I just created an hono/svelte monorepo in Deno2 this evening to try it out and holy shit - it’s so fucking nice I’m at an absolute loss of words.

I was able to remove Turborepo and EVERY SINGLE CONFIG that wasn’t framework specific. It’s so incredibly clean and the imports are just a godsend.

It just works somehow. I was sooooo skeptical after trying bun and needing 200 workarounds for everything.

This is going to have an insane adoption once people actually try it.

5

u/_SteerPike_ Oct 11 '24 edited Oct 11 '24

How did you set up the Svelte project? Tried running 'deno -A npm:create-svelte-app@latest' but that doesn't seem to be the Deno equivalent of 'create svelte@latest'

Edit: turns out the command is just 'deno -A npm:create-svelte@latest'.

1

u/spy4x Oct 11 '24

I recently tried the same Hono+Svelte with Deno v1.46, workspaces and having aliases to my ./libs in deno.json.

But I had an issue with resolving paths to those libs on the Svelte side (I guess because of Vite, which sat in ./apps/frontend and couldn't "see" libs in the root folder. Hono side didn't have such problem.

Is it somehow solved now? I just used to Nrwl Nx monorepo structure and sharing code between ./apps using ./libs that I feel pain when I cant reuse such code (helpers, types, Zod schemas).

1

u/rykuno Oct 11 '24

I’ll send the GitHub link this weekend when I post it

1

u/spy4x Oct 12 '24

Thank you!

1

u/DnzzL Dec 19 '24

Do you have a link to share ? I struggle to make it work

1

u/ongamenight Oct 14 '24

Wow hope you create a repo with instruction on how you setip svelte with deno2. 😆 I know hono has clear docs about using it with Deno.

1

u/BringTheRaine01 Oct 23 '24

How do you run multiple tasks in parallel without Turborepo? Do you have an example repository I can look at?

1

u/rykuno Oct 23 '24

same way you do it in npm/yarn/pnpm.

  "tasks": {
    "dev": "deno task dev:api & deno task dev:web",
    "dev:web": "cd apps/web && deno task dev",
    "dev:api": "cd apps/api && deno task dev"
  },

2

u/shmshd Nov 13 '24

Isn't that just a list of scripts? I think u/BringTheRaine01 was referring to a concurrent build process, which can save a lot of time for larger projects.

1

u/BringTheRaine01 Nov 13 '24

Yeah. TurboRepo can run concurrent processes and cache builds. It takes mono repositories to the next level.

1

u/rykuno Nov 13 '24

Why would you need builds in deno? The point is to generally remove build steps all together. Sure if you bring in some vite project for example, but concurrency can absolutely be achieved with just a simple ‘$’ between build scripts. Generally one build will depend on another in most monorepo anyhow.

1

u/touristtam Dec 13 '24

Sometimes you don't want to build/deploy/test the project as a whole thing in a monorepo; You want your monorepo tooling to only run the task for the apps that has changed, hence caching. That helps speed up the development time.

17

u/No_Cartographer1492 Oct 10 '24

Support for SvelteKit? hell yeah!

1

u/Quiet_Drummer669988 Oct 11 '24

where could i find the info on this? I made a demo project work, but not sure if its the right way

1

u/No_Cartographer1492 Oct 11 '24

I saw it on the video! unless misread the logo there

1

u/Silgeeo Oct 11 '24

I believe you just do deno -A npm:create-svelte

4

u/No_Recording_9753 Oct 11 '24

They didnt have to take his donut too :(

3

u/Natetronn Oct 10 '24

Everyone seemed so nice, minus Rachel; she scared me.

1

u/KaliQt Oct 11 '24

Well yes but no, it does not have the Web Audio API which is an extremely powerful API that would be really nice if it was supported.

1

u/mornaq Oct 12 '24

the ad is great, promises are great, but honestly, do I really have to update all my imports or there's some config to make the node code just work?

also there's no option between compiling and shipping TS and I don't like it that much, I'd prefer to keep ready to run, tree shaked and such JS in the container next to a generic binary, though I'm probably being pedantic about it

1

u/guest271314 Oct 14 '24

How much money did you guys and gals spend on this?

-5

u/Acceptable-Fudge-816 Oct 10 '24 edited Oct 10 '24

Fine, but make imports without an extension work (for ts files) please. Having to use a Deno specific extension in VSCode just for that is weird.

EDIT: e.g. porting an existing code base that doesn't use extensions on the relative imports to Deno.

8

u/bartlomieju Oct 10 '24

You can do that - use --unstable-sloppy-imports flag and Deno will accept extensionless imports

0

u/Acceptable-Fudge-816 Oct 10 '24

Okish solution? It says there is not supported by `deno compile`, plus it is an unstable feature and they say it is "less performant" so they must by checking the existence of files or guessing the extension instead of assuming ts.

3

u/bartlomieju Oct 10 '24

That's true. We'll fix it in Deno compile in a few days. We don't plan to "stabilize" it. And yeah, it proves for files. Afaik both Node ans TS also probe for various files.

4

u/Luolong Oct 10 '24

Ever heard of import maps?

-2

u/Acceptable-Fudge-816 Oct 10 '24

Yes. Doesn't solve it.

4

u/[deleted] Oct 10 '24

-1

u/Acceptable-Fudge-816 Oct 10 '24

Doesn't solve the problem. Say I have an existing code base using relative imports on every file without extensions and I want to move to Deno. How does this fix it? I'm not going to add a mapping on every file.

5

u/[deleted] Oct 10 '24

So you're talking about moving a Node project to Deno?

And aren't you a programmer? It would be trivial to write a script than adds the extension or creates the mappings.

-3

u/Acceptable-Fudge-816 Oct 10 '24

Maybe, but it goes against the premise of the video, it ain't simple. It doesn't work out of the box. And you still need to install a LSP extension for no good reason. Now you get asked every-time you want to use the auto-formatter if you want to use TypeScript or Deno LSP for that. Yikes.

2

u/[deleted] Oct 10 '24

There are no standards in the module resolution behavior of JS runtimes. The one used in Node is just as custom as the one used in Deno. TypeScript doesn't have a resolution behavior. It's host based.

Honestly it doesn't sound like you really want to solve the problem. You could have written a script to fix the issue in the time you've spent bitching about it here.

1

u/Acceptable-Fudge-816 Oct 10 '24

My code base is just an example. Say I want to import a code base from a github repo, do I have to fork it now? It is not reasonable. There may be no official standards, but it is quite a standard practice none the less, and one that is enforced by official the TypeScript LSP.

Deno could fix it easily also, just assume ts extension if none is provided within a TS file, no extra look ups or fetches needed.

0

u/[deleted] Oct 10 '24

[deleted]

0

u/Acceptable-Fudge-816 Oct 10 '24

You're using vite.

0

u/[deleted] Oct 10 '24

[deleted]

-30

u/bagel-glasses Oct 10 '24

So, I'll make it even easier.

  • Don't use Typescript, unless you're working on a huge project with inexperienced devs it's just bloat

  • Don't overuse packages

There's I've apparently solved all the problems Deno solves.

10

u/Acceptable-Fudge-816 Oct 10 '24

What do you use instead? Rust? How do you do front-end with that? Python, PHP? Doesn't sound that great for front-end either. Java hell no. C# is way too much corporate and MS. Honestly, I don't think there is anything better out there. You could argue maybe Go/Rust for back-end, but the moment you have a front-end with a closely related back-end for it, TypeScript seems just right.

-19

u/bagel-glasses Oct 10 '24

Just use node without Typescript. Seriously, it's just not that hard.

6

u/Luolong Oct 10 '24

Sure, yes. And by the same token, why not write your own CSV parser while you’re at it. It’s not that hard.

-7

u/bagel-glasses Oct 10 '24

See, now the difference there is that if I'm just not including Typescript in my project I'm saving time instead of wasting it.

2

u/koala_with_spoon Oct 11 '24

this screams inexperienced. Chill down son you are still learning.

1

u/oravecz Oct 10 '24

I just enabled type checking on a small (250 file) Typescript codebase, and instantly saw hundreds of unsafe function calls, syntax fails, and incomplete data objects. They have been using Typescript, but never running tsc. They have been stripping the type information and disabling the ts plugin in their ide’s. This also includes bypassing git hooks on commits and prs. And this is a Fortune 20 company.

Switching their project from a complex webpack/eslint/prettier config to Vite + Biome has been so much faster and cleaner. We are using Node, but Deno will now be considered.

It took me a long time to appreciate Typescript, but now I am using it even if I am the only developer.

-30

u/dankobg Oct 10 '24

It should, so we should never use js or ts or node or deno or anything this guy makes.

There are better languages and runtimes already but yeah lets listen to this guy again

7

u/[deleted] Oct 11 '24

[removed] — view removed comment

5

u/m_hans_223344 Oct 11 '24

I'm doing this stuff for way to many years and have forgotten how hard it is for people coming into the ecosystem.

Node? Why NPM install and not Node install? What is NPM? Where do I get it? Uhhh, dude on YT is telling me about Yarn. Oh, PNPM in this blog post, is it a typo? ... and I haven't even started TS or Linting or formatting.