Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorganise codebase a bit #6297

Merged
merged 3 commits into from
Aug 26, 2022
Merged

reorganise codebase a bit #6297

merged 3 commits into from
Aug 26, 2022

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Aug 25, 2022

This started out with me working on #4051 and immediately wanting to move packages/kit/src/hooks.js to packages/kit/src/hooks/sequence.js so that we could have a sequence.spec.js alongside it, but not wanting to do that because it would make src even more raggedy than it currently is.

As of this PR, the contents of src look like this...

src/
├ core/     # the dev/build logic
├ exports/  # stuff exposed as the `@sveltejs/kit` package
├ runtime/  # code that runs when people use a SvelteKit app
├ utils/    # self-explanatory
└ cli.js    # self-explanatory

...which I think makes more sense than src/vite, src/node etc. There's definitely more that could be done here (the runtime directory in particular has become a bit chaotic), but sorting out the top level feels like a good start, and would make me feel calmer when I'm working in the codebase.

No changeset because this change should be invisible to users. I used git mv to preserve history and minimise the chance of merge conflicts.

@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2022

⚠️ No Changeset found

Latest commit: bef2aba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@benmccann
Copy link
Member

This seems pretty good overall.

The contributing guide would need to be updated.

It feels a little weird to me that core doesn't contain the most important code paths. Should it be called build or something?

(the directory tree in the description gave me a chuckle. I think someone's been typing src/routes a few too many times 😄)

@dummdidumm
Copy link
Member

I agree with core being somewhat clunky right now - for example, sync is much closer to runtime yet it's in a separate tree. But we can do this in a separate PR.

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures seem unrelated/due to flakyness. Will do one rerun to be sure.

Edit: All test failures except one (which looks like flakyness) are related to the $env thing - not sure why it fails this consistently now, it didn't do that before I believe.

@Rich-Harris
Copy link
Member Author

The $env thing is a red herring. We should probably make it less noisy. It's actually #6306

@Rich-Harris
Copy link
Member Author

The distinction between core and runtime is roughly this: runtime is the stuff that runs through Vite during dev and is included in the app once it's built, core is the stuff that runs in Node and only during dev/build time. It definitely wouldn't make sense for sync to be in runtime, for example.

@Rich-Harris Rich-Harris merged commit 1418c94 into master Aug 26, 2022
@Rich-Harris Rich-Harris deleted the reorganise branch August 26, 2022 14:00
@ignatiusmb ignatiusmb mentioned this pull request Aug 29, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants