@svelte-plugins/svelte-component-template

A Svelte seed project for creating components.

TLDR;

> npm i

> npx husky install

> chmod +x .husky/post-merge && chmod +x .husky/pre-commit && cp .husky/post-merge .git/hooks

> npm start

Setting up development environment

  1. Install dependencies

    > npm i
    
  2. Install husky hooks

    > npx husky install
    
  3. Make sure husky scripts are executable and copied to .git/hooks

    > chmod +x .husky/post-merge && chmod +x .husky/pre-commit && cp .husky/post-merge .git/hooks
    
  4. Start the component dev server and the document server

    > npm start
    
  5. Happy coding! You're changes will be automatically rebuilt and reflected immediately on the docs.

Testing

Running either of these commands will execute all unit tests.

Command Notes
npm test Single run with no coverage report
npm test:watch Watches for changes
npm test:coverage Executes tests and launches a coverage report

Run all tests

> npm test

Run a specific test

> npm test [path-to-test-file]

Run all tests and generate a code coverage report

> npm test:coverage

Documentation

Building Run the build:docs command to generate a dist bundle for GitHub pages.

> npm run build:docs

Deploying Run the deploy:docs command to automaically build the docs source and push it to gh-pages.

> npm run deploy:docs

Publishing Package

You can publish your package via NPM:

  1. Adjust the major, minor or patch version in the version property of your package.json.
  2. Login or create an NPM account.
  3. Run npm run publish

If you are looking for a private publish or other types, follow the guide here.

Stack

Framework

  • Svelte - Blazing fast frontend framework that enhances HTML, CSS & JS

Testing

  • Vitest - Next Generation Testing Framework

CI/CD

  • GitHub Actions - Automate, customize, and execute workflows in your repository with GitHub Actions.

Development

  • Vite - Next Generation Frontend Tooling
  • Babel - JavaScript compiler that allows next generation JS, today
  • Prettier - An opinionated code formatter
  • Publint - Lint packaging errors. Ensure compatibility across environments.
  • ESLint - A static code analysis tool for finding issues in your code
  • Husky - Hooks for running linting, formatting, etc when you push or commit
  • Lint-staged - Run linters on git staged files

Publishing

  • NPM - Run linters on git staged files
  • Svelte Package - The fastest way to build Svelte packages

Changelog

Changelog

License

MIT

Top categories

Loading Svelte Themes