-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add a typescript-template repo #5016
Comments
Got any link to an existing project or example that has the right stuff implemented already that can be extracted to a template? |
I've been using https://github.com/babichjacob/sapper-typescript-graphql-template. It does a bit more since it's for Sapper and GraphQL as well, but it does help show how to setup the TypeScript stuff |
I created https://github.com/dummdidumm/template which is the minimal starter enhanced with Typescript support. More discussion can be found in sveltejs/language-tools#161 . |
@dummdidumm is it possible to make a version of your template that just adds typescript? The one you have listed makes a bunch of formatting changes, and even some changes to the markdown in the README which hopefully, aren't necessary. The reason being that I am concerned that we won't want to maintain (dependency versions etc) another template, and it will go out of sync with the original template. What might be an ideal scenario is to have a way to "patch" typescript support in with an |
The changes in the markdown are mostly to highlight what was done to add typescript support. The formatting changes are due to prettier I guess. Both can easily be avoided. The npm command is a nice idea. It also triggers another idea - what about a CLI? That one could walk you through the setup process (webpack or rollup? javascript or typescript? css, less or scss?) and generate a template accordingly. |
I shared this someplace else, but seems relevant here too. The coolest project starter I've seen is https://micronaut.io/launch/, which does essentially that walkthrough (they have a CLI too, but I think the web interface is even neater and they share the same code). It's kind of a lot of tooling though, so not the easiest thing to implement |
I think the simplest answer which covers all cases is:
This leaves a simple & recommended CLI setup, which does not break the boundaries of degit ( Rich-Harris/degit#6 .) It's very explicit that it will run a script to set up TypeScript, and it's a separate step so someone can audit it ahead of time. |
Does it need to be a separate repository if it's basically the same? How about either:
--- or ---
|
I like option 1. |
This is what is needed to set up the repo for TS: https://github.com/orta/svelte-ts-template-example/blob/master/scripts/setupTypeScript.js I'm in favour of 1 also: the docs could be something like:
|
I'll give it a week and implement this into the base template /cc @Rich-Harris in case you have strong opinions on this |
@orta what is the tsconfig file that is referencing? https://github.com/orta/svelte-ts-template-example/blob/master/scripts/setupTypeScript.js#L72 |
Is It seems to be renaming files and updates the rollup config partially (seems to be leaving the reference to main.js), but it isn't updating the package.json file with the new dependencies or the script |
No, I've not finished it |
I'm not sure where to put it, but we also should add a step-by-step on how to setup TypeScript in an existing project. Not everyone might start fresh with the template, so it would be good to have that. |
Expand the FAQ entry with a link to a markdown page? |
OK, that should be good now: npx degit orta/template#ts
node scripts/setupTypeScript.js |
Just ran it on my computer. Works great! 🥳 |
Maybe it is a good idea to have this TypeScript template for the Svelte component template as well? |
TypeScript support for the https://github.com/sveltejs/component-template can be tracked here: sveltejs/component-template#29 |
Since the official template repo contains a script to convert to typescript, this is issue is no longer relevant. |
Is your feature request related to a problem? Please describe.
Many people want to use Svelte with Typescript. With
svelte-preprocess
, a fitting rollup-config and Svelta Beta from VSCode this is working pretty good already. But there is no template devs can degit to get a quick start.Describe the solution you'd like
Add a
sveltejs/typescript-template
similar to https://github.com/sveltejs/template with some instructions on how to get Typescript running. After some iterations and feedback one could even think about a blogpost on the official website.Describe alternatives you've considered
Explaining the same things in Discord and various Github issues over and over again.
How important is this feature to you?
Important to get the word out that Typescript support is in a good state now.
The text was updated successfully, but these errors were encountered: