vite-template-svelte-ts-lib-mode Svelte Themes

Vite Template Svelte Ts Lib Mode

A svelte typescript vite template using lib mode with support for multiple entries.

vite-template-svelte-ts-lib-mode

A svelte typescript vite template using lib mode with support for multiple entries.

Uses vanilla CSS.

Note: it's in no way a refined and robust setup, but it's enough to get most of my projects running.

Usage

  1. Install using:
npx degit murolem/vite-template-svelte-ts-lib-mode my-new-project

This will clone the repo, but without .git folder (=no repo history).

Or you can just clone the repo the regular way.

  1. Go to package.json, set the package name, change the version (if needed).

  2. Configure the .github actions however you like. By default, it uses release-please-action@v3 to increment the package version based on cz-conventional-changelog commits, creating pull requested on commits that increment the version. The latter must be enabled in your project repo settings → Actions → General → Workflow permissions → «Allow GitHub Actions to create and approve pull requests».

What's inside

Vite with a custom build script

Allows you to define however many entry points you would like (you can build e.g. 20 scripts at the same time):

  • build command runs all commands that start with build: in parallel (except the ones ending in watch).
  • You can add any amount of new build commands that should be run under the general build command. They can utilize either the build script (see build:index command for example), or whatever else you put there.

Run build to build everything once. Run build -- -w to build in watch mode, rebuilding on changes. You can also run any build "subcommand" (e.g. build:index) individually, including in the watch mode.

Dev mode

Go into dev mode by running npm run dev - this will run the vite dev command.

This will require configuring which lib script you want to test in index.html.

Commits following Conventional Commits

Running sendit stages all unstaged changes and promts you to pick the commit params (like type, message, etc.). After you done, it pushes your changes to the origin.

cz command (coming from cz-conventional-changelog) ensures that the commits will follow Conventional Commits, which allows them e.g. to be gathered into a nice changelog using release-please-action@v3 action (see the Usage section for directions).

Top categories

Loading Svelte Themes