Skip to content

docs: use sh instead of bash in source blocks #14059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

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
```

`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
git clone git@github.com:sveltejs/kit.git
cd kit
pnpm install
Expand Down Expand Up @@ -124,7 +124,7 @@ There are a few guidelines we follow:

To use the git hooks in the repo, which will save you from waiting for CI to tell you that you forgot to lint, run this:

```bash
```sh
git config core.hookspath .githooks
```

Expand All @@ -142,6 +142,6 @@ The [Changesets GitHub action](https://github.com/changesets/action#with-publish

New packages will need to be published manually the first time if they are scoped to the `@sveltejs` organisation, by running this from the package directory:

```bash
```sh
npm publish --access=public
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Creating a project

The easiest way to start building a SvelteKit app is to run `npx sv create`:

```bash
```sh
npx sv create my-app
cd my-app
npm install
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/20-core-concepts/40-page-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Since these routes cannot be dynamically server-rendered, this will cause errors

SvelteKit will discover pages to prerender automatically, by starting at _entry points_ and crawling them. By default, all your non-dynamic routes are considered entry points — for example, if you have these routes...

```bash
```sh
/ # non-dynamic
/blog # non-dynamic
/blog/[slug] # dynamic, because of `[slug]`
Expand Down
20 changes: 10 additions & 10 deletions documentation/docs/25-build-and-deploy/40-adapter-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ First, build your app with `npm run build`. This will create the production serv

You will need the output directory, the project's `package.json`, and the production dependencies in `node_modules` to run the application. Production dependencies can be generated by copying the `package.json` and `package-lock.json` and then running `npm ci --omit dev` (you can skip this step if your app doesn't have any dependencies). You can then start your app with this command:

```bash
```sh
node build
```

Expand All @@ -44,41 +44,41 @@ In `dev` and `preview`, SvelteKit will read environment variables from your `.en

In production, `.env` files are _not_ automatically loaded. To do so, install `dotenv` in your project...

```bash
```sh
npm install dotenv
```

...and invoke it before running the built app:

```bash
```sh
node +++-r dotenv/config+++ build
```

If you use Node.js v20.6+, you can use the [`--env-file`](https://nodejs.org/en/learn/command-line/how-to-read-environment-variables-from-nodejs) flag instead:

```bash
```sh
node +++--env-file=.env+++ build
```

### `PORT`, `HOST` and `SOCKET_PATH`

By default, the server will accept connections on `0.0.0.0` using port 3000. These can be customised with the `PORT` and `HOST` environment variables:

```bash
```sh
HOST=127.0.0.1 PORT=4000 node build
```

Alternatively, the server can be configured to accept connections on a specified socket path. When this is done using the `SOCKET_PATH` environment variable, the `HOST` and `PORT` environment variables will be disregarded.

```bash
```sh
SOCKET_PATH=/tmp/socket node build
```

### `ORIGIN`, `PROTOCOL_HEADER`, `HOST_HEADER`, and `PORT_HEADER`

HTTP doesn't give SvelteKit a reliable way to know the URL that is currently being requested. The simplest way to tell SvelteKit where the app is being served is to set the `ORIGIN` environment variable:

```bash
```sh
ORIGIN=https://my.site node build

# or e.g. for local previewing and testing
Expand All @@ -87,7 +87,7 @@ ORIGIN=http://localhost:3000 node build

With this, a request for the `/stuff` pathname will correctly resolve to `https://my.site/stuff`. Alternatively, you can specify headers that tell SvelteKit about the request protocol and host, from which it can construct the origin URL:

```bash
```sh
PROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host node build
```

Expand All @@ -103,7 +103,7 @@ If `adapter-node` can't correctly determine the URL of your deployment, you may

The [`RequestEvent`](@sveltejs-kit#RequestEvent) object passed to hooks and endpoints includes an `event.getClientAddress()` function that returns the client's IP address. By default this is the connecting `remoteAddress`. If your server is behind one or more proxies (such as a load balancer), this value will contain the innermost proxy's IP address rather than the client's, so we need to specify an `ADDRESS_HEADER` to read the address from:

```bash
```sh
ADDRESS_HEADER=True-Client-IP node build
```

Expand Down Expand Up @@ -174,7 +174,7 @@ If you need to change the name of the environment variables used to configure th
envPrefix: 'MY_CUSTOM_';
```

```bash
```sh
MY_CUSTOM_HOST=127.0.0.1 \
MY_CUSTOM_PORT=4000 \
MY_CUSTOM_ORIGIN=https://my.site \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ https://dash.cloudflare.com/<your-account-id>/home

You will need to install [Wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and log in, if you haven't already:

```bash
```sh
npm i -D wrangler
wrangler login
```

Then, you can build your app and deploy it:

```bash
```sh
wrangler deploy
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Set this string as an environment variable on Vercel by logging in and going to

To get this key known about for local development, you can use the [Vercel CLI](https://vercel.com/docs/cli/env) by running the `vercel env pull` command locally like so:

```bash
```sh
vercel env pull .env.development.local
```

Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/30-advanced/10-advanced-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Advanced routing

If the number of route segments is unknown, you can use rest syntax — for example you might implement GitHub's file viewer like so...

```bash
```sh
/[org]/[repo]/tree/[branch]/[...file]
```

Expand Down Expand Up @@ -101,7 +101,7 @@ Each module in the `params` directory corresponds to a matcher, with the excepti

It's possible for multiple routes to match a given path. For example each of these routes would match `/foo-abc`:

```bash
```sh
src/routes/[...catchall]/+page.svelte
src/routes/[[a=x]]/+page.svelte
src/routes/[b]/+page.svelte
Expand All @@ -118,7 +118,7 @@ SvelteKit needs to know which route is being requested. To do so, it sorts them

...resulting in this ordering, meaning that `/foo-abc` will invoke `src/routes/foo-abc/+page.svelte`, and `/foo-def` will invoke `src/routes/foo-[c]/+page.svelte` rather than less specific routes:

```bash
```sh
src/routes/foo-abc/+page.svelte
src/routes/foo-[c]/+page.svelte
src/routes/[[a=x]]/+page.svelte
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/30-advanced/70-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ You can create so-called declaration maps (`d.ts.map` files) by setting `"declar

To publish the generated package:

```bash
```sh
npm publish
```

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/40-best-practices/07-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Doing this manually is tedious. There are a variety of techniques you can use, d

Install:

```bash
```sh
npm install --save-dev @sveltejs/enhanced-img
```

Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/60-appendix/10-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ Currently ESM Support within the latest Yarn (version 3) is considered [experime

The below seems to work although your results may vary. First create a new application:

```bash
```sh
yarn create svelte myapp
cd myapp
```

And enable Yarn Berry:

```bash
```sh
yarn set version berry
yarn install
```
Expand Down
6 changes: 3 additions & 3 deletions packages/adapter-static/test/apps/spa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Everything you need to build a Svelte project, powered by [`create-svelte`](http

If you're seeing this, you've probably already done this step. Congrats!

```bash
```sh
# create a new project in the current directory
npm init svelte

Expand All @@ -18,7 +18,7 @@ npm init svelte 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
Expand All @@ -29,7 +29,7 @@ npm run dev -- --open

Before creating a production version of your app, install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. Then:

```bash
```sh
npm run build
```

Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This package has been deprecated. Please see [`sv`](https://npmjs.com/package/sv) instead:

```bash
```sh
npx sv create
```

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the [SvelteKit](https://svelte.dev/docs/kit) framework and CLI.

The quickest way to get started is via the [sv](https://npmjs.com/package/sv) package:

```bash
```sh
npx sv create my-app
cd my-app
npm install
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/types/synthetic/$env+static+private.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ MY_FEATURE_FLAG=""

You can override `.env` values from the command line like so:

```bash
```sh
MY_FEATURE_FLAG="enabled" npm run dev
```
2 changes: 1 addition & 1 deletion packages/package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The quickest way to get started is via the [sv](https://npmjs.com/package/sv) package:

```bash
```sh
npx sv create my-app
cd my-app
npm install
Expand Down
Loading