Skip to content

Commit 53d575c

Browse files
committed
align config export and replace sh with bash
1 parent 6c16d9f commit 53d575c

File tree

10 files changed

+51
-25
lines changed

10 files changed

+51
-25
lines changed

documentation/docs/25-build-and-deploy/40-adapter-node.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ Install with `npm i -D @sveltejs/adapter-node`, then add the adapter to your `sv
1414
import adapter from '@sveltejs/adapter-node';
1515

1616
/** @type {import('@sveltejs/kit').Config} */
17-
export default {
17+
const config = {
1818
kit: {
1919
adapter: adapter()
2020
}
2121
};
22+
23+
export default config;
2224
```
2325

2426
## Deploying
@@ -65,21 +67,21 @@ node +++--env-file=.env+++ build
6567

6668
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:
6769

68-
```sh
70+
```bash
6971
HOST=127.0.0.1 PORT=4000 node build
7072
```
7173

7274
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.
7375

74-
```sh
76+
```bash
7577
SOCKET_PATH=/tmp/socket node build
7678
```
7779

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

8082
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:
8183

82-
```sh
84+
```bash
8385
ORIGIN=https://my.site node build
8486

8587
# or e.g. for local previewing and testing
@@ -88,7 +90,7 @@ ORIGIN=http://localhost:3000 node build
8890

8991
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:
9092

91-
```sh
93+
```bash
9294
PROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host node build
9395
```
9496

@@ -104,7 +106,7 @@ If `adapter-node` can't correctly determine the URL of your deployment, you may
104106

105107
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:
106108

107-
```sh
109+
```bash
108110
ADDRESS_HEADER=True-Client-IP node build
109111
```
110112

@@ -148,7 +150,7 @@ The adapter can be configured with various options:
148150
import adapter from '@sveltejs/adapter-node';
149151

150152
/** @type {import('@sveltejs/kit').Config} */
151-
export default {
153+
const config = {
152154
kit: {
153155
adapter: adapter({
154156
// default options are shown
@@ -158,6 +160,8 @@ export default {
158160
})
159161
}
160162
};
163+
164+
export default config;
161165
```
162166

163167
### out
@@ -176,7 +180,7 @@ If you need to change the name of the environment variables used to configure th
176180
envPrefix: 'MY_CUSTOM_';
177181
```
178182

179-
```sh
183+
```bash
180184
MY_CUSTOM_HOST=127.0.0.1 \
181185
MY_CUSTOM_PORT=4000 \
182186
MY_CUSTOM_ORIGIN=https://my.site \

documentation/docs/25-build-and-deploy/50-adapter-static.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Install with `npm i -D @sveltejs/adapter-static`, then add the adapter to your `
1616
import adapter from '@sveltejs/adapter-static';
1717

1818
/** @type {import('@sveltejs/kit').Config} */
19-
export default {
19+
const config = {
2020
kit: {
2121
adapter: adapter({
2222
// default options are shown. On some platforms
@@ -29,6 +29,8 @@ export default {
2929
})
3030
}
3131
};
32+
33+
export default config;
3234
```
3335

3436
...and add the [`prerender`](page-options#prerender) option to your root layout:
@@ -52,11 +54,13 @@ On these platforms, you should omit the adapter options so that `adapter-static`
5254
```js
5355
// @errors: 2304
5456
/// file: svelte.config.js
55-
export default {
57+
const config = {
5658
kit: {
5759
adapter: adapter(---{...}---)
5860
}
5961
};
62+
63+
export default config;
6064
```
6165

6266
## Options

documentation/docs/25-build-and-deploy/55-single-page-apps.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ Install with `npm i -D @sveltejs/adapter-static`, then add the adapter to your `
2323
import adapter from '@sveltejs/adapter-static';
2424

2525
/** @type {import('@sveltejs/kit').Config} */
26-
export default {
26+
const config = {
2727
kit: {
2828
adapter: adapter({
2929
fallback: '200.html' // may differ from host to host
3030
})
3131
}
3232
};
33+
34+
export default config;
3335
```
3436

3537
The `fallback` page is an HTML page created by SvelteKit from your page template (e.g. `app.html`) that loads your app and navigates to the correct route. For example [Surge](https://surge.sh/help/adding-a-200-page-for-client-side-routing), a static web host, lets you add a `200.html` file that will handle any requests that don't correspond to static assets or prerendered pages.

documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Install with `npm i -D @sveltejs/adapter-cloudflare`, then add the adapter to yo
2121
import adapter from '@sveltejs/adapter-cloudflare';
2222

2323
/** @type {import('@sveltejs/kit').Config} */
24-
export default {
24+
const config = {
2525
kit: {
2626
adapter: adapter({
2727
// See below for an explanation of these options
@@ -39,6 +39,8 @@ export default {
3939
})
4040
}
4141
};
42+
43+
export default config;
4244
```
4345

4446
## Options
@@ -201,11 +203,13 @@ Cloudflare no longer recommends using [Workers Sites](https://developers.cloudfl
201203
+++import adapter from '@sveltejs/adapter-cloudflare';+++
202204

203205
/** @type {import('@sveltejs/kit').Config} */
204-
export default {
206+
const config = {
205207
kit: {
206208
adapter: adapter()
207209
}
208210
};
211+
212+
export default config;
209213
```
210214

211215
### wrangler.toml

documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ Install with `npm i -D @sveltejs/adapter-cloudflare-workers`, then add the adapt
1616
import adapter from '@sveltejs/adapter-cloudflare-workers';
1717

1818
/** @type {import('@sveltejs/kit').Config} */
19-
export default {
19+
const config = {
2020
kit: {
2121
adapter: adapter({
2222
// see below for options that can be set here
2323
})
2424
}
2525
};
26+
27+
export default config;
2628
```
2729

2830
## Options
@@ -65,14 +67,14 @@ https://dash.cloudflare.com/<your-account-id>/home
6567
6668
You will need to install [Wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and log in, if you haven't already:
6769

68-
```sh
70+
```bash
6971
npm i -D wrangler
7072
wrangler login
7173
```
7274

7375
Then, you can build your app and deploy it:
7476

75-
```sh
77+
```bash
7678
wrangler deploy
7779
```
7880

documentation/docs/25-build-and-deploy/80-adapter-netlify.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Install with `npm i -D @sveltejs/adapter-netlify`, then add the adapter to your
1616
import adapter from '@sveltejs/adapter-netlify';
1717

1818
/** @type {import('@sveltejs/kit').Config} */
19-
export default {
19+
const config = {
2020
kit: {
2121
// default options are shown
2222
adapter: adapter({
@@ -31,6 +31,8 @@ export default {
3131
})
3232
}
3333
};
34+
35+
export default config;
3436
```
3537

3638
Then, make sure you have a [netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration) file in the project root. This will determine where to write static assets based on the `build.publish` settings, as per this sample configuration:
@@ -57,7 +59,7 @@ SvelteKit supports [Netlify Edge Functions](https://docs.netlify.com/netlify-lab
5759
import adapter from '@sveltejs/adapter-netlify';
5860

5961
/** @type {import('@sveltejs/kit').Config} */
60-
export default {
62+
const config = {
6163
kit: {
6264
adapter: adapter({
6365
// will create a Netlify Edge Function using Deno-based
@@ -66,6 +68,8 @@ export default {
6668
})
6769
}
6870
};
71+
72+
export default config;
6973
```
7074

7175
## Netlify alternatives to SvelteKit functionality

documentation/docs/25-build-and-deploy/90-adapter-vercel.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ Install with `npm i -D @sveltejs/adapter-vercel`, then add the adapter to your `
1616
import adapter from '@sveltejs/adapter-vercel';
1717

1818
/** @type {import('@sveltejs/kit').Config} */
19-
export default {
19+
const config = {
2020
kit: {
2121
adapter: adapter({
2222
// see below for options that can be set here
2323
})
2424
}
2525
};
26+
27+
export default config;
2628
```
2729

2830
## Deployment configuration
@@ -74,7 +76,7 @@ You may set the `images` config to control how Vercel builds your images. See th
7476
import adapter from '@sveltejs/adapter-vercel';
7577

7678
/** @type {import('@sveltejs/kit').Config} */
77-
export default {
79+
const config = {
7880
kit: {
7981
adapter: adapter({
8082
images: {
@@ -86,6 +88,8 @@ export default {
8688
})
8789
}
8890
};
91+
92+
export default config;
8993
```
9094

9195
## Incremental Static Regeneration
@@ -134,7 +138,7 @@ Set this string as an environment variable on Vercel by logging in and going to
134138

135139
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:
136140

137-
```sh
141+
```bash
138142
vercel env pull .env.development.local
139143
```
140144

documentation/docs/30-advanced/70-packaging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ You can create so-called declaration maps (`d.ts.map` files) by setting `"declar
249249

250250
To publish the generated package:
251251

252-
```sh
252+
```bash
253253
npm publish
254254
```
255255

documentation/docs/60-appendix/10-faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ Currently ESM Support within the latest Yarn (version 3) is considered [experime
195195

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

198-
```sh
198+
```bash
199199
yarn create svelte myapp
200200
cd myapp
201201
```
202202

203203
And enable Yarn Berry:
204204

205-
```sh
205+
```bash
206206
yarn set version berry
207207
yarn install
208208
```

documentation/docs/60-appendix/20-integrations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ Including [`vitePreprocess`](https://github.com/sveltejs/vite-plugin-svelte/blob
1111
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
1212

1313
/** @type {import('@sveltejs/kit').Config} */
14-
export default {
14+
const config = {
1515
preprocess: [vitePreprocess()]
1616
};
17+
18+
export default config;
1719
```
1820

1921
You will also need to use a preprocessor if you're using TypeScript with Svelte 4. TypeScript is supported natively in Svelte 5 if you're using only the type syntax. To use more complex TypeScript syntax in Svelte 5, you will need still need a preprocessor and can use `vitePreprocess({ script: true })`.

0 commit comments

Comments
 (0)