This is a project template for Svelte apps.
To create a new project based on this template using degit:
npx degit qhrtech/svelte-component-template component-name
Install the dependencies...
cd component-name
npm install
...then start Rollup:
npm run dev
Navigate to localhost:5000. You should see your component running. Edit a component file in src
, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv
commands in package.json to include the option --host 0.0.0.0
.
If you're using Visual Studio Code we recommend installing the official extension Svelte for VS Code. If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.
An opinionated code formatter for svelte, typescript, javascript and json.
To check manually:
npm run prettier --silent
To apply fixes manually:
npm run prettier-fix
Svelte support is provided by prettier-plugin-svelte and config is prettier.config.js.
ESLint statically analyzes your code to quickly find problems.
To run:
npm run lint
To apply fixes:
npm run lint-fix
To run:
npm run check
*.test.ts
To run:
npm run test
To run on change:
npm run test-watch
To run with coverage:
npm run coverage
# results can be viewed in coverage/lcov-report/index.html
Simple and complete testing utilities that encourage good testing practices
await
for events.fireEvent is an async method when imported from @testing-library/svelte. This is because it calls tick which tells Svelte to apply any new changes to the DOM.
Jest is a delightful JavaScript Testing Framework with a focus on simplicity.