/template-solidjs-library

Template for single SolidJS package app configured with TypeScript, ESLint, Prettier and Vitest

Primary LanguageTypeScriptMIT LicenseMIT

solid-create-script

Template: SolidJS Library

Template for SolidJS library package. Bundling of the library is managed by tsup.

Other things configured include:

  • Bun (for dependency management and running scripts)
  • TypeScript
  • ESLint / Prettier
  • Solid Testing Library + Vitest (for testing)
  • Playground app using library
  • Simple Bun server scaffolding for playground app
  • Support for publishing to NPM and JSR
  • GitHub Actions (for all CI/CD)

Getting Started

Some pre-requisites before install dependencies:

  • Install Node Version Manager (NVM)
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  • Install Bun
    curl -fsSL https://bun.sh/install | bash

Installing Dependencies

nvm use
bun install

Local Development Build

bun start
bun start:server # entirely optional to use

Linting & Formatting

bun run lint    # checks source for lint violations
bun run format  # checks source for format violations

bun run lint:fix    # fixes lint violations
bun run format:fix  # fixes format violations

Building the Library

This template uses tsup-preset-solid to build and bundle the library

bun run build

Publishing the Library

This template also comes with Changeset pre-configured and three utility scripts. You must have Changeset installed to leverage them.

bun pkg:changeset # run Changeset CLI
bun pkg:version   # consume any changeset to produce package manifest updates
bun pkg:publish   # git tag and publish the package to NPM via Changeset

Another thing to note is the template includes a jsr.json config to support publishing to JSR alongside NPM if interested. To publish to JSR, you can run:

bunx jsr publish            # publishes to JSR
bunx jsr publish --dry-run  # checks if library is publishable

Note: For JSR publishing, Changeset does not update the jsr.json file after running bun pkg:publish so you have to manually update the version by hand after changeset has run.

Contributing

The only requirements when contributing are:

  • You keep a clean git history in your branch
    • rebasing main instead of making merge commits.
  • Using proper commit message formats that adhere to conventional commits
  • CI checks pass before merging into main