From 5d280db733eb04f37a723b2c0e460b4116fc5e4c Mon Sep 17 00:00:00 2001 From: Filip Kobierski Date: Tue, 15 Jul 2025 22:48:08 +0200 Subject: [PATCH 1/3] packages/create/scripts/update-template-repo.sh: use env increases portability --- packages/create/scripts/update-template-repo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create/scripts/update-template-repo.sh b/packages/create/scripts/update-template-repo.sh index b3d1b38d..25553aaf 100755 --- a/packages/create/scripts/update-template-repo.sh +++ b/packages/create/scripts/update-template-repo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e From cf3a2f6d99d205fea329c03cb048ad00c0678a78 Mon Sep 17 00:00:00 2001 From: Filip Kobierski Date: Tue, 15 Jul 2025 22:57:14 +0200 Subject: [PATCH 2/3] packages/create/package.json: do not call bash excessively the script's shebang calls the shell already. Right now a bash is called within a shell only to execute the shebang, which in turn executes another shell. --- packages/create/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create/package.json b/packages/create/package.json index 6bbe0148..0cc1a2cd 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -17,7 +17,7 @@ "format": "pnpm lint --write", "lint": "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore", "test": "vitest run", - "update-template-repo": "pnpm build:dist && echo \"Updating template repo\" && bash ./scripts/update-template-repo.sh" + "update-template-repo": "pnpm build:dist && echo \"Updating template repo\" && ./scripts/update-template-repo.sh" }, "files": [ "dist" From f5ad79ed5cbb04d0cfe19f123208729cec414404 Mon Sep 17 00:00:00 2001 From: Filip Kobierski Date: Tue, 15 Jul 2025 23:00:31 +0200 Subject: [PATCH 3/3] *: use `sh` instead of `bash` for simple commands These commands are not bash specific and the docs should reflect that. Also some bytes are saved. --- CONTRIBUTING.md | 30 +++++++++---------- .../docs/10-introduction/10-overview.md | 2 +- .../docs/20-commands/10-sv-create.md | 2 +- documentation/docs/20-commands/20-sv-add.md | 4 +-- documentation/docs/20-commands/30-sv-check.md | 10 +++---- .../docs/20-commands/40-sv-migrate.md | 4 +-- .../docs/30-add-ons/03-devtools-json.md | 2 +- documentation/docs/30-add-ons/05-drizzle.md | 8 ++--- documentation/docs/30-add-ons/10-eslint.md | 2 +- documentation/docs/30-add-ons/15-lucia.md | 4 +-- documentation/docs/30-add-ons/20-mdsvex.md | 2 +- documentation/docs/30-add-ons/25-paraglide.md | 6 ++-- .../docs/30-add-ons/30-playwright.md | 2 +- documentation/docs/30-add-ons/35-prettier.md | 2 +- documentation/docs/30-add-ons/40-storybook.md | 2 +- .../docs/30-add-ons/45-sveltekit-adapter.md | 4 +-- documentation/docs/30-add-ons/50-tailwind.md | 4 +-- documentation/docs/30-add-ons/55-vitest.md | 2 +- packages/cli/README.md | 2 +- packages/create/shared/+library/README.md | 10 +++---- packages/create/shared/README.md | 6 ++-- packages/migrate/README.md | 4 +-- 22 files changed, 57 insertions(+), 57 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68f2687f..b33a3b37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ Please keep your pull requests focused to feature or issue. Focused smaller chan ## Preparing This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.io/). You can [install pnpm](https://pnpm.io/installation) with: -```bash +```sh npm i -g pnpm ``` @@ -25,7 +25,7 @@ Linux users, you will have to ensure 'sudo' is not required. See [docker post in `pnpm` commands run in the project's root directory will run on all sub-projects. You can checkout the code and install the dependencies with: -```bash +```sh cd cli pnpm install ``` @@ -33,19 +33,19 @@ pnpm install ## Build and run To build the project and all packages. Run the 'build' script: -```bash +```sh # from root of project pnpm build ``` This outputs into /packages/PACKAGE/dist/. Run the 'cli' package: -```bash +```sh pnpm sv ``` Run build with watch mode: -```bash +```sh pnpm dev ``` @@ -54,29 +54,29 @@ pnpm dev For each add-on we have integration tests setup. These install the deps, build the app, run the dev server and then run a few small snippets against the add-on to see if the changes introduced by the add-on are working as expected. Run all tests: -```bash +```sh # from root of project pnpm test ``` Run tests with vitest ui: -```bash +```sh # from root of project pnpm test:ui ``` Run package specific tests by specifying a project flag to the package and running the test command. Eg: -```bash +```sh pnpm test --project core # addons / create / migrate / etc. ``` To run a individual test. `cd` into the package. Run the local `test` script to that package, with a path arg to the individual piece you want tested. Eg: -```bash +```sh pnpm test [path-to-test] ``` To debug a failing test. A good starting point is to `cd` into the failing tests dir. Proceed to `build` it. Then `preview` it. From here you will have increased information to help in the debug process. Eg: -```bash +```sh # Each test is a standalone app cd .test-output/addons/[addon-test]/[test-id] pnpm build @@ -91,24 +91,24 @@ There are a few guidelines we follow: - Ensure `pnpm lint` and `pnpm check` pass. You can run `pnpm format` to format the code - linting -```bash +```sh # from root of project pnpm lint ``` - formatting -```bash +```sh # from root of project pnpm format ``` - type checking -```bash +```sh # from root of project pnpm check ``` ## svelte-migrate To run svelte-migrate locally: -```bash +```sh # from root of project node ./packages/migrate/bin.js ``` @@ -116,7 +116,7 @@ node ./packages/migrate/bin.js ## Generating changelogs Only publish a change set if it is in 'sv' or 'svelte-migrate' as all other packages are bundled. For changes to be reflected in package changelogs: -```bash +```sh # from root of project pnpm changeset:publish ``` diff --git a/documentation/docs/10-introduction/10-overview.md b/documentation/docs/10-introduction/10-overview.md index 9e4b2223..564bcf96 100644 --- a/documentation/docs/10-introduction/10-overview.md +++ b/documentation/docs/10-introduction/10-overview.md @@ -8,7 +8,7 @@ The command line interface (CLI), `sv`, is a toolkit for creating and maintainin The easiest way to run `sv` is with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) (or the equivalent command if you're using a different package manager — for example, `pnpx` if you're using [pnpm](https://pnpm.io/)): -```bash +```sh npx sv ``` diff --git a/documentation/docs/20-commands/10-sv-create.md b/documentation/docs/20-commands/10-sv-create.md index ae5d29be..fc4a4b93 100644 --- a/documentation/docs/20-commands/10-sv-create.md +++ b/documentation/docs/20-commands/10-sv-create.md @@ -6,7 +6,7 @@ title: sv create ## Usage -```bash +```sh npx sv create [options] [path] ``` diff --git a/documentation/docs/20-commands/20-sv-add.md b/documentation/docs/20-commands/20-sv-add.md index 07f9f314..d29d0b6c 100644 --- a/documentation/docs/20-commands/20-sv-add.md +++ b/documentation/docs/20-commands/20-sv-add.md @@ -6,11 +6,11 @@ title: sv add ## Usage -```bash +```sh npx sv add ``` -```bash +```sh npx sv add [add-ons] ``` diff --git a/documentation/docs/20-commands/30-sv-check.md b/documentation/docs/20-commands/30-sv-check.md index 52e1a37f..e929bc0e 100644 --- a/documentation/docs/20-commands/30-sv-check.md +++ b/documentation/docs/20-commands/30-sv-check.md @@ -14,13 +14,13 @@ Requires Node 16 or later. You will need to have the `svelte-check` package installed in your project: -```bash +```sh npm i -D svelte-check ``` ## Usage -```bash +```sh npx sv check ``` @@ -59,7 +59,7 @@ Use this if you only want to check the Svelte files found in the current directo Files/folders to ignore, relative to workspace root. Paths should be comma-separated and quoted. Example: -```bash +```sh npx sv check --ignore "dist,build" ``` @@ -75,7 +75,7 @@ If provided, warnings will cause `sv check` to exit with an error code. A quoted, comma-separated list of `code:behaviour` pairs where `code` is a [compiler warning code](../svelte/compiler-warnings) and `behaviour` is either `ignore` or `error`: -```bash +```sh npx sv check --compiler-warnings "css_unused_selector:ignore,a11y_missing_attribute:error" ``` @@ -90,7 +90,7 @@ A quoted, comma-separated list of sources that should run diagnostics on your co Example: -```bash +```sh npx sv check --diagnostic-sources "js,svelte" ``` diff --git a/documentation/docs/20-commands/40-sv-migrate.md b/documentation/docs/20-commands/40-sv-migrate.md index 87e69568..b7b2acf0 100644 --- a/documentation/docs/20-commands/40-sv-migrate.md +++ b/documentation/docs/20-commands/40-sv-migrate.md @@ -8,12 +8,12 @@ Some migrations may annotate your codebase with tasks for completion that you ca ## Usage -```bash +```sh npx sv migrate ``` You can also specify a migration directly via the CLI: -```bash +```sh npx sv migrate [migration] ``` diff --git a/documentation/docs/30-add-ons/03-devtools-json.md b/documentation/docs/30-add-ons/03-devtools-json.md index 49b01e01..f0a6d8d5 100644 --- a/documentation/docs/30-add-ons/03-devtools-json.md +++ b/documentation/docs/30-add-ons/03-devtools-json.md @@ -30,7 +30,7 @@ export function handle({ event, resolve }) { ## Usage -```bash +```sh npx sv add devtools-json ``` diff --git a/documentation/docs/30-add-ons/05-drizzle.md b/documentation/docs/30-add-ons/05-drizzle.md index 97766fde..018f8c8f 100644 --- a/documentation/docs/30-add-ons/05-drizzle.md +++ b/documentation/docs/30-add-ons/05-drizzle.md @@ -6,7 +6,7 @@ title: drizzle ## Usage -```bash +```sh npx sv add drizzle ``` @@ -27,7 +27,7 @@ Which database variant to use: - `mysql` — another popular open source database - `sqlite` — file-based database not requiring a database server -```bash +```sh npx sv add drizzle=database:postgresql ``` @@ -39,7 +39,7 @@ The SQL client to use, depends on `database`: - For `mysql`: `mysql2`, `planetscale` - For `sqlite`: `better-sqlite3`, `libsql`, `turso` -```bash +```sh npx sv add drizzle=database:postgresql+client:postgres.js ``` @@ -49,6 +49,6 @@ Drizzle is compatible with well over a dozen database drivers. We just offer a f Whether to add Docker Compose configuration. Only available for [`database`](#Options-database) `postgresql` or `mysql` -```bash +```sh npx sv add drizzle=database:postgresql+client:postgres.js+docker:yes ``` diff --git a/documentation/docs/30-add-ons/10-eslint.md b/documentation/docs/30-add-ons/10-eslint.md index 318bb504..d12aed33 100644 --- a/documentation/docs/30-add-ons/10-eslint.md +++ b/documentation/docs/30-add-ons/10-eslint.md @@ -6,7 +6,7 @@ title: eslint ## Usage -```bash +```sh npx sv add eslint ``` diff --git a/documentation/docs/30-add-ons/15-lucia.md b/documentation/docs/30-add-ons/15-lucia.md index eb7b68e1..2597f7fc 100644 --- a/documentation/docs/30-add-ons/15-lucia.md +++ b/documentation/docs/30-add-ons/15-lucia.md @@ -6,7 +6,7 @@ An auth setup following [the Lucia auth guide](https://lucia-auth.com/). ## Usage -```bash +```sh npx sv add lucia ``` @@ -21,6 +21,6 @@ npx sv add lucia Whether to include demo registration and login pages. -```bash +```sh npx sv add lucia=demo:yes ``` diff --git a/documentation/docs/30-add-ons/20-mdsvex.md b/documentation/docs/30-add-ons/20-mdsvex.md index 00b95c45..468f1efd 100644 --- a/documentation/docs/30-add-ons/20-mdsvex.md +++ b/documentation/docs/30-add-ons/20-mdsvex.md @@ -6,7 +6,7 @@ title: mdsvex ## Usage -```bash +```sh npx sv add mdsvex ``` diff --git a/documentation/docs/30-add-ons/25-paraglide.md b/documentation/docs/30-add-ons/25-paraglide.md index e4658e0f..f426c446 100644 --- a/documentation/docs/30-add-ons/25-paraglide.md +++ b/documentation/docs/30-add-ons/25-paraglide.md @@ -6,7 +6,7 @@ title: paraglide ## Usage -```bash +```sh npx sv add paraglide ``` @@ -25,7 +25,7 @@ npx sv add paraglide The languages you'd like to support specified as IETF BCP 47 language tags. -```bash +```sh npx sv add paraglide="languageTags:en,es" ``` @@ -33,6 +33,6 @@ npx sv add paraglide="languageTags:en,es" Whether to generate an optional demo page showing how to use paraglide. -```bash +```sh npx sv add paraglide="demo:yes" ``` diff --git a/documentation/docs/30-add-ons/30-playwright.md b/documentation/docs/30-add-ons/30-playwright.md index 0c16d86f..ca05f994 100644 --- a/documentation/docs/30-add-ons/30-playwright.md +++ b/documentation/docs/30-add-ons/30-playwright.md @@ -6,7 +6,7 @@ title: playwright ## Usage -```bash +```sh npx sv add playwright ``` diff --git a/documentation/docs/30-add-ons/35-prettier.md b/documentation/docs/30-add-ons/35-prettier.md index 68014ae4..6c1556ad 100644 --- a/documentation/docs/30-add-ons/35-prettier.md +++ b/documentation/docs/30-add-ons/35-prettier.md @@ -6,7 +6,7 @@ title: prettier ## Usage -```bash +```sh npx sv add prettier ``` diff --git a/documentation/docs/30-add-ons/40-storybook.md b/documentation/docs/30-add-ons/40-storybook.md index 9ba57adb..e4f24cd2 100644 --- a/documentation/docs/30-add-ons/40-storybook.md +++ b/documentation/docs/30-add-ons/40-storybook.md @@ -6,7 +6,7 @@ title: storybook ## Usage -```bash +```sh npx sv add storybook ``` diff --git a/documentation/docs/30-add-ons/45-sveltekit-adapter.md b/documentation/docs/30-add-ons/45-sveltekit-adapter.md index 1bc77cc6..3e3d599b 100644 --- a/documentation/docs/30-add-ons/45-sveltekit-adapter.md +++ b/documentation/docs/30-add-ons/45-sveltekit-adapter.md @@ -6,7 +6,7 @@ title: sveltekit-adapter ## Usage -```bash +```sh npx sv add sveltekit-adapter ``` @@ -27,6 +27,6 @@ Which SvelteKit adapter to use: - `cloudflare` — [`@sveltejs/adapter-cloudflare`](/docs/kit/adapter-cloudflare) allows you to deploy to Cloudflare - `netlify` — [`@sveltejs/adapter-netlify`](/docs/kit/adapter-netlify) allows you to deploy to Netlify -```bash +```sh npx sv add sveltekit-adapter=adapter:node ``` diff --git a/documentation/docs/30-add-ons/50-tailwind.md b/documentation/docs/30-add-ons/50-tailwind.md index a0926b51..7040a9b5 100644 --- a/documentation/docs/30-add-ons/50-tailwind.md +++ b/documentation/docs/30-add-ons/50-tailwind.md @@ -6,7 +6,7 @@ title: tailwindcss ## Usage -```bash +```sh npx sv add tailwindcss ``` @@ -26,6 +26,6 @@ Which plugin to use: - `typography` — [`@tailwindcss/typography`](https://github.com/tailwindlabs/tailwindcss-typography) - `forms` — [`@tailwindcss/forms`](https://github.com/tailwindlabs/tailwindcss-forms) -```bash +```sh npx sv add tailwindcss="plugins:typography" ``` diff --git a/documentation/docs/30-add-ons/55-vitest.md b/documentation/docs/30-add-ons/55-vitest.md index e2ee77c6..e923526f 100644 --- a/documentation/docs/30-add-ons/55-vitest.md +++ b/documentation/docs/30-add-ons/55-vitest.md @@ -6,7 +6,7 @@ title: vitest ## Usage -```bash +```sh npx sv add vitest ``` diff --git a/packages/cli/README.md b/packages/cli/README.md index c6cc4acc..69b981f3 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -2,7 +2,7 @@ A command line interface (CLI) for creating and maintaining [Svelte](https://svelte.dev) applications. Just run: -```bash +```sh npx sv ``` diff --git a/packages/create/shared/+library/README.md b/packages/create/shared/+library/README.md index 9410ac82..22a2a01d 100644 --- a/packages/create/shared/+library/README.md +++ b/packages/create/shared/+library/README.md @@ -8,7 +8,7 @@ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/pac If you're seeing this, you've probably already done this step. Congrats! -```bash +```sh # create a new project in the current directory npx sv create @@ -20,7 +20,7 @@ npx sv create my-app Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: -```bash +```sh npm run dev # or start the server and open the app in a new browser tab @@ -33,13 +33,13 @@ Everything inside `src/lib` is part of your library, everything inside `src/rout To build your library: -```bash +```sh npm run package ``` To create a production version of your showcase app: -```bash +```sh npm run build ``` @@ -53,6 +53,6 @@ Go into the `package.json` and give your package the desired name through the `" To publish your library to [npm](https://www.npmjs.com): -```bash +```sh npm publish ``` diff --git a/packages/create/shared/README.md b/packages/create/shared/README.md index b5b29507..75842c40 100644 --- a/packages/create/shared/README.md +++ b/packages/create/shared/README.md @@ -6,7 +6,7 @@ Everything you need to build a Svelte project, powered by [`sv`](https://github. If you're seeing this, you've probably already done this step. Congrats! -```bash +```sh # create a new project in the current directory npx sv create @@ -18,7 +18,7 @@ npx sv create my-app Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: -```bash +```sh npm run dev # or start the server and open the app in a new browser tab @@ -29,7 +29,7 @@ npm run dev -- --open To create a production version of your app: -```bash +```sh npm run build ``` diff --git a/packages/migrate/README.md b/packages/migrate/README.md index ed7413bd..4225190a 100644 --- a/packages/migrate/README.md +++ b/packages/migrate/README.md @@ -4,13 +4,13 @@ A CLI for migrating Svelte(Kit) codebases. Run it directly using: -```bash +```sh npx sv migrate ``` You can also specify a migration directly via the CLI: -```bash +```sh npx sv migrate [migration] ```