setup-routify-ts
Use Typescript in Routify Starter Template.
Designed for Routify Starter Template. Not for Svelte Template.
Usage
We have 2 methods to add Typescript support to Routify Starter Template. You can choose whichever one suits your needs.
Support methods:
Create new Routify Starter Template from Scratch
With this method, setup-routify-ts
will create a Routify Starter Template and then add additional configurations for Typescript purposes.
Command
npx setup-routify-ts init <project-name> [routify-init-args]
Arguments
project-name
: Your project name (will be used as the folder name).routify-init-args
: Some arguments will be passed tonpx @sveltech/routify init
command. See Routify Get Started.
Example
npx setup-routify-ts init my-routify-app
Convert existing projects to Typescript
setup-routify-ts
will add additional configurations for Typescript needs to an existing project.
Try to do backups to prevent conflicts in case of conflicts with the configuration that you have made.
Command
npx setup-routify-ts convert [project-directory]
Arguments
project-directory
: Path to your project folder. Default:.
(Current folder).
Example
npx setup-routify-ts convert /home/me/my-routify-app
What we do
- Create new
tsconfig.json
file in root folder. - Add
svelte-check
script & somedevDependencies
topackage.json
. - Rename
src/main.js
tosrc/main.ts
. - Add
lang
property toscript
element insrc/App.svelte
. - Add some plugins & configurations to
scripts/base.config.js
. - Create new
extensions.json
file in.vscode
directory.
Note
Routify repository:
Routify is a work in progress. Since v1.5 we have a stable release. But this is a relatively young project. You can expect it to evolve.
Since Routify is in the progress, a lot of changes are likely to occur. If you find an error or something that is not updated, please inform us in the Issues section or fix it yourself by creating a new Pull Request.
Tested with @sveltech/routify@v1.9.9