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
update svelte skeleton #12350
update svelte skeleton #12350
Conversation
I can see this table would need updating too |
Loved this change! Update the docs(that table). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
const subIsReady = true; // remove this line if you want to use the code below | ||
// no need to publish/subscribe as there is autopublish package installed | ||
// let subIsReady = false; | ||
// $m: { | ||
// const handle = Meteor.subscribe('links.all'); // todo: setup the server-side publication | ||
// subIsReady = handle.ready(); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, skeletons no longer have autopublish. It might be good to have this uncommented.
Personally I like to separate those two lines into their own statements like this, though it doesn't really matter.
$m: handle = Meteor.subscribe('links.all');
$m: ready = handle.ready();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might also be good to add the server code for the publication.
// subIsReady = handle.ready(); | ||
// } | ||
|
||
// $m is available from zodern:melte package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to have a short explanation of what $m
is, or a link to the docs for it.
I've been wondering if we should configure the svelte skeleton so it supports typescript. It doesn't need to have any typescript code, but at least have the tsconfig and dependencies installed so you don't have to do anything to start using typescript. |
Great idea. I am thinking about a whole guide for Svelte, like the one for React https://guide.meteor.com/react.html to document TS, SSR, i18n, reactivity, blaze integration or routing |
Is there something missing? @tosinek ? can I merge this to 2.9.1? |
I also wanted to add Typescript. Thinking whether it is better to just prepare it for TS or convert the codebase to TS. |
IMO @tosinek, I would convert it to TypeScript, the same way we have with React-TS. |
Ok, few more minutes :) |
Ci wont work but I will take a look in the 2.9.1 branch. Just let me know when you are done :) |
I think I am done. The server/main.js could be still converted, but may leave it to another update |
You can copy from the other skeleton |
I think it is time to merge it as it is. Importing .svelte files in .ts files is making TS to complain, so I will have to figure it out, but not tonight. |
Got it! Thx for your work @tosinek! hope to see you again :) |
I wanna create a Svelte guide. Would it make sense to have routing in this skeleton? It is something I was missing a lot in the beginning. I can see that the new Vue skeleton includes routing. Maybe there could even be some kind of guideline on what to include in every skeleton? (eg. that the we are trying to enforce type safety) |
We want to maintain a standard for every skeleton, so I think this is a nice one. Most apps will need a router! I make issues so the community can help with other frameworks. Also, while talking with the team, we decided that for now, it could be nice to have the tsconfig.json already done so that to make your app a TypeScript, one would just need to add the ts files. I will make the change, for now, to revert the |
I think .ts works fine for this skeleton, except for the main client entrypoint that is still .js. It does not like the App.svelte import there. Links.ts work fine on my machine. And I created a minimalistic tsconfig.json with comments that seems to be working (included in the PR). Because it is difficult for me to use a long config with many options I don't even understand (eg the one from the Meteor guide) without knowing what is important there and what is just a preference. |
The Svelte integration seems to have issues when both
zodern:melte
andrdb:svelte-meteor-data
are used together. It is quite random, some stuff will just stop being reactive, while some other still works. I think it was even breaking HMR in a Blaze+Svelte project for me. When using just one package, all the problems suddenly disappear.I suggest updating the skeleton to only include zodern:melte, which is also aligned with the guide at https://svelte-tutorial.meteor.com/
Related issues:
zodern/melte#24
zodern/melte#25
I also updated the skeleton to utilize the collection. Not really necessary, but if it is not used, then it might be removed completely instead?