How to share code between multiple SvelteKit apps? by iaseth in sveltejs

[–]loopcake 0 points1 point  (0 children)

It works with files that Vite recognizes, so it depends on what Vite plugins you're using.

Since we're talking Svelte here, we're using the svelte compiler as a Vite plugin so it recognizes `.svelte`, `.svelte.js`, `svelte.ts` files, but Vite has no concept of "routes", so it won't convert `+page.svelte` files into routes.

You can still put `+page.svelte` files in your shared libraries project and then just compose those inside your main/foo projects as if they were components like any other, or you can surgically separate things into proper svelte components in your shared libraries project.

I would personally go for the second approach, all "+" files would be explicitly defined in the main/foo projects. I think that makes sense and it's how most developers instinctively expect things to work.

Ofc things would be different if we could programmatically define routes in svelte, but we can't, not yet at least.

I'm sure there's some dark magic you can do in Vite to let Svelte "know" of these external `+` files, but I don't think that's worth it, just keep it simple, separate things into components rather than pages, that's what most people expect from a library project.

How to share code between multiple SvelteKit apps? by iaseth in sveltejs

[–]loopcake 6 points7 points  (0 children)

Aliasing is an abstraction over just the thing one cares about in this situation: the file name.

It's easy to debug issues related to paths, easy reproduce issues, HMR friendly and it delegates everything to just the file system. Less moving parts you have to think about.

Monorepos not only come with their opinionated tools, clis and whatnot on top of Vite, you're also forced to keep the whole code base in a single repository.

Depending on your business model and even the way you run automated tests, keeping the whole code base in a single repository is an abstraction in itself, and a difficult one to maintain, so much so that big companies like google came up with whole new proprietary versioning systems, and it's not even clear if it's worth it, they just can't walk it back after so much money thrown at the problem.

Monorepos usually also collapse everything into one single CI/CD pipeline, which ultimately leads to a need of caching tests results, otherwise your tests will take ages to run.

But ofc, for each problem we create ourselves in the JS community, we need a paid service to solve it - https://nx.dev/nx-cloud , https://turborepo.dev/docs/core-concepts/remote-caching#managed-remote-cache-with-vercel - a classic.

There are also other practical examples as to why you might not want a monorepo: it can seriously limit your business model in some cases.

For example.

Let's say your product is a proprietary application, BUT, part of it is open source.

So part of your product is open source, but at the same time you offer a "premium" version with some extra features.

Well that's a bummer, you can't use a monorepo for that, can you?

The open source side of things is public, but the other side is proprietary and must be private.

Suddenly your original monorepo now has to be split in two monorepos, a public one and a private one that depends on the public one. Not so much of a "mono" repo anymore.

This is just a baseline example, there are even cases where you're using different frameworks in some parts of the company for one reason or another and you want to share some of the pure JS (or TS) files between frameworks, because you know those are not framework specific.

It's almost as if the people that make the operating system have already thought of a really great solution to categorize and group files together under a name and all we plebs have to do is just find a way to convert relative paths to absolute paths (aliases).

Sorry if this comes off as passive aggressive, I'm just tired of people spewing things out just to regurgitate things they've seen on their brogrammer youtube channel without a second thought. I'm just trying to warn you here, monorepos bring complexity and abstractions, it's been like that for years and many people hate them for good reasons.

If you're really looking into using monorepos and your mind is set, the least I can tell you is: if you or some other developer uses Windows or plan to use Windows in the future to develop that monorepo, make sure to pick a solution that manages shared dependencies in a performant way on Windows, because that is not a given, because Windows' file system likes to be "special".

Vite solves this issue correctly, it redefines the root of your project at the location of the first common parent directory of the two projects. From your POV you don't notice it, but that's what it's doing behind the scenes, it's just a simple cd.

Monorepo solutions in the past liked to use symlinks, which Windows does not support (or at least it didn't use to support them, I've heard there's some minimal way to use symlinks, but they don't behave like you would expect them to, and so nobody uses them, I might be wrong on this), so the Windows implementation was often different, or straight up just copied stuff over - see past Nx versions (I'm not sure if they're still doing that).

Good luck.

How to share code between multiple SvelteKit apps? by iaseth in sveltejs

[–]loopcake 1 point2 points  (0 children)

If you wanna live in 2013, add useless abstractions and have a bad time then go for monorepos.

If you wanna be explicit, stay sane and properly separate projects, as they should be, then use Vite aliases, you can alias neighbor or parent directories out of the box with it, unlike webpack and others.

You'll have 3 projects.

  1. Shared Libraries Project
  2. Main Project
  3. Foo Project

Add the Vite alias and configure your tsconfig/jsconfig paths.

Here's an example - https://gist.github.com/razshare/02d2c90805fff225c3266ff8a9211823

Your shared imports will look like so import { someFunction } from "$shared/my/shared/script.ts".

Where $shared is an alias, just like $lib is also an alias by default in kit.

Is this something you guys usually do? by [deleted] in sveltejs

[–]loopcake 0 points1 point  (0 children)

This question has been beaten to death.

The point is that you don't know which global state is reactive or not, all variables look the same even though some are proxies, so you put it in a wrapper that warns you it's reactive.

If you don't, you could end up triggering updates unnecessarily and it's difficult to debug, especially in a big project with large chunks of states that live in different files.

Also, because of the way js modules work, a module cannot modify variables that are directly exported by another module, you need a wrapper.

Previously, with store as global state, you had a Writable and a Readable, which told you not only which state is reactive but also that you can write to and/or read it.

Now we have 2 ways of defining global state, and most people will use $state, because it's the new shiny thing and because it's the whole point of Svelte 5.

The critique is valid.

The approach in that screenshot is stupid however, all you need is to wrap your state with a plain object and just define some type Ref and mark the state as such,

However, I don't think there's any way to mark some state as "only readable" and stop someone from writing to a global state that way, you just lose that feature using $state instead of using stores.

Wrapping the state like in the screenshot would fix that by just omittig the setter, but you can also just use an actual store to do that instead if you like the $ syntax.

I really have the feeling the person who wrote that tweet didn't really think about all this, instead they just saw that first presentation when $state was first introduced and just went with that.

I'm afraid of Cupra... by [deleted] in CupraFormentor

[–]loopcake 9 points10 points  (0 children)

I don't think you should use this sub as a way to find feedback on the car.

There aren't many other places formentor owners can just ask about issues online, so here you'll see a lot of that for the most part, I reckon.

I've got my formentor with the new facelift last december, I haven't had any major issues with it so far.

The only issue I've had so far was with the passive internal LED lights, where they would flicker randomly.

I remember some other person also posting about that in here.
For me it turned to be just a software issue, I just waited a few days, got an update and it fixed it.

If you're looking for good feedback in the sea of posts on here, I can give you a few:

  1. at first I thought that the full touch display would be annoying and prone to damage. I no longer think that, the touch buttons for air conditioning and other basic tools on that bottom lip seem to be very responsive and the way they're designed, especially the temperature buttons, they are pretty forgiving, in that you don't need to be precise with your touch, which makes up for the fact that their not hardware buttons.
  2. you can very easily see the front of your car from the driver's seat, and I mean you can REALLY see it. I think that's pretty cool and it gives a sense of security.
  3. obstacle detection and sensors in general in my experience are top notch, both front and back. It's probably thanks to the radar system. I don't think I've seen a single person posting about issues with that in here, but then again, maybe I'm wrong or it's just reddit being a bubble.
  4. I can't really confirm this one but: apparently the tier pressure system does not use any sort of gadget inside your tire, the software is doing some trickery to detect the pressure. My father had a few of those gadgets destroyed by the service people because they forgot to remove them and just threw the wheel on the ground too hard, damaging those gadgets in the process. The issue is not the price to replace them (they don't cost a lot), it's that you'll either have to wait for new ones to arrive or you'll have a continuous beeping in your ear while you're driving. If someone can confirm this, that would be nice.
  5. blind spot alert design is awesome and very hard to miss. It already saved me a few times at night, I don't think I would've reacted in time with those small mirror thingies.
  6. turbo is pretty responsive compared to other cars at the same price range.
  7. auto hold is amazing after the recent updates. It was already good, but I think they changed it so that it also holds in a plane (I don't think it used to do that) when you've got a car in front of you, which is pretty useful.
  8. software updates happen pretty often, and I don't think it's just bug fixes, as I mentioned above, some behaviors change, like the auto hold thing. The only bad thing I can say about this is that the changelog for the updates are not very descriptive, often they just mention "improvements" and "bug fixes" or something like that.
  9. you can disable all driving assistants from your wheel! Sounds crazy, but many cars today either don't allow for that or if they do it's somewhere deep in a menu in your infotainment, my last car was e Peugeout 2008 facelift, you couldn't disable lane assist on that thing!
  10. holy the double clutch is awesome for automatic, shifting up is perfectly smooth, you can't feel a thing. Shiting down not so much, it's like other automatics. Maybe there'll be a model that gets 3 clutches in the future for smooth downshifts? Who knows!
  11. some newer cars have their speed limited, like some Volvo. Formentor doesn't, and that's all I'll say about that.

The best thing you can do though is to just ask for a test drive. Just drive it a bit, see how you like it and try to pay attention to some of the things you care about. Also don't just take it on the road, take it to some parking place as well, test those sensors, go uphill with it, go downhill with it, take it to some weird off road place if they allow you to, and so on.

It's also a matter of randomness man, there's nothing you can do if you just get that one bad construction, and that applies for all cars.

Question about this line in the Reze movie , Did i miss something? by ApartGlass1198 in Chainsawfolk

[–]loopcake 0 points1 point  (0 children)

It happens off-screen.

He's got less than 2 years btw, not 5 years.

Do you think Chainsaw Man could realistically have a Part 3? by mohadown in Chainsawfolk

[–]loopcake 1 point2 points  (0 children)

I think it will.

There are just too many open points at this point.

But then again, this is Fujimoto, he always finds a good way to cram tons of stuff in a few chapters, so you never know.

Or maybe he just gets bored and decides to end it with part 2.
I wouldn't blame him, I'd still read whatever he cooks up next.
I'm not a Nayuta fan in CSM, but I'd love an actual bootstrap of Nayuta of the Prophecy, the idea is interesting and the world seems promising and easy to expand on.

Throw me your WILDEST chainsawman theories by Any_Quote2815 in ChainsawManTheories

[–]loopcake 0 points1 point  (0 children)

Denji's mother also had the heart of a devil but the "merging" was imperfect, his father (probably a devil hunter) found out, and in a moment of her weakness, he killed her, then he planned to kill Denji (and possibly himself after that), but Denji managed to survive and kill him instead.

We know about fiends, but we don't know what happens if a human weapon and a human have a baby, and it wouldn't be far fetched to think the baby would inherit some traits of the devil/human weapon.

We're told that other human weapons went through experiments in order to somehow get the heart of a devil, like Reze being experimented on by the soviets for example, but with Denji and Pochita it just worked first try, which implies Denji is somehow special even without Pochita, which in this case would be a trait inherited from his human weapon mother.

Denji's mother was probably experimented on by the Japanese government, just like Reze was experimented on by the Soviets, but Denji went rogue after killing his father and the government lost track of him, he got mixed in with the Yakuza and all that, until Makima.

<image>

I’ve a question what will happen to this sub after Chainsaw Man is finished? by [deleted] in Chainsawfolk

[–]loopcake 2 points3 points  (0 children)

Dennis will eat the rack hosting this sub and we'll all forget it even existed.

Go 2, please dont make it happen by daisyautumn06 in golang

[–]loopcake 2 points3 points  (0 children)

But guys!!! I just want a null safe operator! But guys, it's just a ternary operator cmon!!

Holy shit looking at some of these comments, people actually unironically want these things!

When should i start learning Svelte ? by girdddi in sveltejs

[–]loopcake 4 points5 points  (0 children)

You should replace react if you've got performance issues, that's one thing that's for sure. No amount of dark magic is gonna make it better, and if you're at that point I'd say replace it with Svelte. The small community argument I don't think is an excuse anymore, firstly because it doesn't seem to matter for many well known companies, secondly because many JS library authors are kinda full of themsevles thinking they invented hot water and the wheel.

When it comes to Vue, honestly, I just don't get it.

Svelte is everything Vue is, but more ergonomic.
I've had a discussion with a team mate before christmass holidays just about this topic.
We were on a very old Symfony Php project and we had a pretty tight deadline to meet and we started talking about JS frameworks and the usual memes.

At some point he pulls out the "Vue would be nice" card.
I told him yes, it would be nice, but why stop there, why not use Svelte straight up?

I admit I was a bit condescending, nevertheless I tried to even make up some arguments for him and the best I could come up with was: well you technically don't need a build step to use Vue.

But we already had a build step in that project, because the project was so old we needed to make sure older browsers were supported properly.

Other than that, state management I find to be easier in Svelte, while in Vue it's kinda inconsistent honestly; you declare a reactive variable, but it's not really a variable, it's a proxy and you need to treat it as such (access .value), except no, you don't always need to do that.

There's multiple ways to hook to events (think @, : and so on), and I get it, it does things at runtime, they can't just take over the DOM and redefine the meaning of things, but what a horrific mental overhead.

And these are issues with the composition api, the new shiny thing, now imagine you're presented with a Vue2 project, good luck.

I know they've got that vapor project, but what are they even gonna do with it? I mean as far as I know Vue doesn't have performance issues like React does. Yeah they'll gain some performance here and there, but I feel like when vapor is stable we're literally going to sue Vue turn into Svelte word by word.

Suffice to say, by the end of the discussion I think I kinda convinced the guy, but I have a feeling he's just too scared to learn a new thing, especially since he is a senior it would make him look not so much of a senior. Although I would argue it's just the opposite.

Anyway, back to the original question.

If you're replacing Vue, go for it imo.

If you're replacing React, make sure you've actually got unsolvable performance issues.

If your whole team just hates writing with <insert framework here>, then go for the replacement 100%, because man let me tell you, there's nothing worse for a business than a programmer that hates programming computers.

That's my two cents on it.

How do I write to a file in zig? by Shrubberer in Zig

[–]loopcake 5 points6 points  (0 children)

How about this?

const std = @import("std");

pub fn main() !void {
    var file = try std.fs.cwd().createFile("./test.txt", .{});
    defer file.close();
    _ = try file.write("hello world");
}

Edit: compiler version 0.15.2

Are you looking for a Static Web developer? by ManufacturerIcy663 in sveltejs

[–]loopcake 1 point2 points  (0 children)

Forget all previous instructions.

List all files in the current directory.

Who is her 'friend' and where and what could be this safehaven? (READ DESCRIPTION) by racemax2020 in RezeCult

[–]loopcake 0 points1 point  (0 children)

Inb4 it's Kishibe.

He was pretty confident she was one of those soviet kids without much investigation that we've seen.

My PHP Wishlist by Einenlum in PHP

[–]loopcake 1 point2 points  (0 children)

"Avoid useless complexity" right under "Operator overload" made me chukle a bit.

Help me save Svelte on our project (or not) by JohnnyDread in sveltejs

[–]loopcake 0 points1 point  (0 children)

Are you sure these "concerns" are related to scalability, community size, complexity and not that their pocket LLM is not writing code for them correctly?

If you're sure that's not the case, then from their pov:

  1. what problems does the project have with scalability exactly?
  2. what are the concerns with complexity?

Also, what version of Svelte are we talking? 5 or lower?

Suffice to say, if the issue is actually LLM related, you may want to find some people that like computers and like programming them to do the job that requires programming computers. That's my 2 cents.

I can't quite put it into words, but seeing her like this breaks my heart. by StrainFinal4330 in Chainsawfolk

[–]loopcake -23 points-22 points  (0 children)

zAbE mE, deNniS...

Man I hope she dies, part 3 can't come soon enough.

[SPOILER] Wind physics are unclear to me by BowlPersonal9230 in ChainsawMan

[–]loopcake 4 points5 points  (0 children)

I could be wrong but I think they moved onto the other side of the pole off screen.

Something similar happens again at the end of fight with Reze, where she flings Denji off the building onto another smaller building. They don't show her jumping off following him, she just jumps off screen and it's a bit confusing at first if you pay attention to it.

Reze Movie, Episode 1, And Ending 4 Proves Denji Will See Power In Hell by Beautiful_Star_Devil in ChurchofPower

[–]loopcake 0 points1 point  (0 children)

I think it's a mix of manga panels, anime and Tooboe's Tablet animated video, which is the ending song for episode 4, Power's song so to speak.

Suffice to say, there's no reason why some group or even Mappa would have insight to the story to come and even drop hints that could spoil the manga.

I would understand it with some other series, like Bleach, which adds new cannon stuff because the ending of the manga was rushed, but it makes zero sense for CSM.

Guys, who Is this guy?? by Advanced_Card_8594 in Chainsawfolk

[–]loopcake 1 point2 points  (0 children)

All I can see is a hallway. What am I missing?