You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@
4
4
5
5
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:
6
6
7
-
```bash
7
+
```sh
8
8
npm i -g pnpm
9
9
```
10
10
11
11
`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:
@@ -124,7 +124,7 @@ There are a few guidelines we follow:
124
124
125
125
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:
126
126
127
-
```bash
127
+
```sh
128
128
git config core.hookspath .githooks
129
129
```
130
130
@@ -142,6 +142,6 @@ The [Changesets GitHub action](https://github.com/changesets/action#with-publish
142
142
143
143
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:
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/40-page-options.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Since these routes cannot be dynamically server-rendered, this will cause errors
88
88
89
89
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...
Copy file name to clipboardExpand all lines: documentation/docs/25-build-and-deploy/40-adapter-node.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ First, build your app with `npm run build`. This will create the production serv
26
26
27
27
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:
28
28
29
-
```bash
29
+
```sh
30
30
node build
31
31
```
32
32
@@ -44,41 +44,41 @@ In `dev` and `preview`, SvelteKit will read environment variables from your `.en
44
44
45
45
In production, `.env` files are _not_ automatically loaded. To do so, install `dotenv` in your project...
46
46
47
-
```bash
47
+
```sh
48
48
npm install dotenv
49
49
```
50
50
51
51
...and invoke it before running the built app:
52
52
53
-
```bash
53
+
```sh
54
54
node +++-r dotenv/config+++ build
55
55
```
56
56
57
57
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:
58
58
59
-
```bash
59
+
```sh
60
60
node +++--env-file=.env+++ build
61
61
```
62
62
63
63
### `PORT`, `HOST` and `SOCKET_PATH`
64
64
65
65
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:
66
66
67
-
```bash
67
+
```sh
68
68
HOST=127.0.0.1 PORT=4000 node build
69
69
```
70
70
71
71
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.
72
72
73
-
```bash
73
+
```sh
74
74
SOCKET_PATH=/tmp/socket node build
75
75
```
76
76
77
77
### `ORIGIN`, `PROTOCOL_HEADER`, `HOST_HEADER`, and `PORT_HEADER`
78
78
79
79
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:
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:
@@ -103,7 +103,7 @@ If `adapter-node` can't correctly determine the URL of your deployment, you may
103
103
104
104
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:
105
105
106
-
```bash
106
+
```sh
107
107
ADDRESS_HEADER=True-Client-IP node build
108
108
```
109
109
@@ -174,7 +174,7 @@ If you need to change the name of the environment variables used to configure th
Copy file name to clipboardExpand all lines: documentation/docs/25-build-and-deploy/90-adapter-vercel.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,7 +131,7 @@ Set this string as an environment variable on Vercel by logging in and going to
131
131
132
132
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:
Copy file name to clipboardExpand all lines: documentation/docs/30-advanced/10-advanced-routing.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: Advanced routing
6
6
7
7
If the number of route segments is unknown, you can use rest syntax — for example you might implement GitHub's file viewer like so...
8
8
9
-
```bash
9
+
```sh
10
10
/[org]/[repo]/tree/[branch]/[...file]
11
11
```
12
12
@@ -101,7 +101,7 @@ Each module in the `params` directory corresponds to a matcher, with the excepti
101
101
102
102
It's possible for multiple routes to match a given path. For example each of these routes would match `/foo-abc`:
103
103
104
-
```bash
104
+
```sh
105
105
src/routes/[...catchall]/+page.svelte
106
106
src/routes/[[a=x]]/+page.svelte
107
107
src/routes/[b]/+page.svelte
@@ -118,7 +118,7 @@ SvelteKit needs to know which route is being requested. To do so, it sorts them
118
118
119
119
...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:
0 commit comments