Skip to content

Commit 0f4dabe

Browse files
authored
Update SvelteKit (#197)
- Updates the project with SvelteKit's new router. - Enable the use of Vercel Edge Functions. - Make use of the new page endpoints, which split off `load` functions to a separate file. - Enabled prerendering by default on all pages. - Refactored the blog posts system to be much more concise and clear (using said page endpoints) - Fixed some typescript errors. - Update deps.
1 parent d640fdd commit 0f4dabe

File tree

47 files changed

+1549
-1000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1549
-1000
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DS_Store
22
node_modules
3-
/.svelte-kit
3+
.svelte-kit
44
/package
5-
/.idea
6-
/build
7-
/.netlify
5+
.idea
6+
build
7+
/.vercel

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ Our documentation system uses [mdsvex](https://mdsvex.pngwn.io/), a superset of
112112

113113
### Editing Existing Pages
114114

115-
Documentation files are located at [`src/routes/docs`](https://github.com/files-community/Website/tree/main/src/routes/docs). SvelteKit uses a filesystem-based router, meaning that the layout of pages in the filesystem will reflect the URL path they are compiled to. To edit an existing page, find the corresponding `*.md` file in the [`docs`](<(https://github.com/files-community/Website/tree/main/src/routes/docs)>) directory.
115+
Documentation files are located
116+
at [`src/routes/docs`](https://github.com/files-community/Website/tree/main/src/routes/docs). SvelteKit uses a
117+
filesystem-based router, meaning that the layout of page folders in the filesystem will reflect the URL path they are
118+
compiled to. To edit an existing page, find the corresponding `*.md` file in
119+
the [`docs`](<(https://github.com/files-community/Website/tree/main/src/routes/docs)>) directory.
116120

117121
### Adding or Deleting a Page
118122

@@ -124,11 +128,15 @@ This is an example docs mapping:
124128

125129
```
126130
.
127-
├──page-1.md
128-
├──page-2.md
131+
├──page-1
132+
│ └──+page.md
133+
├──page-2
134+
│ └──+page.md
129135
└──category
130-
├──category-page-1.md
131-
└──category-page-2.md
136+
├──category-page-1
137+
│ └──+page.md
138+
└──category-page-2
139+
└──+page.md
132140
```
133141

134142
#### src/data/docs.ts
@@ -144,7 +152,6 @@ This is an example docs mapping:
144152
path: "/page-2"
145153
},
146154
{
147-
type: "category",
148155
name: "Nested Category",
149156
pages: [
150157
{
@@ -162,11 +169,17 @@ This is an example docs mapping:
162169

163170
## Using the Blog
164171

165-
Similarly to docs pages, the blog also uses [mdsvex](https://mdsvex.pngwn.io/) for it's markdown. Blog posts are located at [`src/routes/blog/posts`](https://github.com/files-community/Website/tree/main/src/blog/posts) in `*.md` files. Unlike the docs, a mapping of blog posts doesn't need to be kept.
172+
Similarly to docs pages, the blog also uses [mdsvex](https://mdsvex.pngwn.io/) for it's markdown. Blog posts are located
173+
at [`src/routes/blog/posts`](https://github.com/files-community/Website/tree/main/src/blog/posts) in `*.md` files.
174+
Unlike the docs, a mapping of blog posts doesn't need to be kept.
166175

167176
### Publishing a Post
168177

169-
To publish a post, create a new `.md` file in the [`posts`](https://github.com/files-community/Website/tree/main/src/blog/posts) folder. At the top of a the file, you'll need to include a few required things before typing the post.
178+
To publish a post, create a new folder in
179+
the [`posts`](https://github.com/files-community/Website/tree/main/src/blog/posts) folder, and in it place a file
180+
named `+page.md`. It will contain your post's content.
181+
182+
At the top of the file, you'll need to include a few required things before typing the post.
170183

171184
```md
172185
---

package.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.0.1",
44
"repository": "https://github.com/files-community/files",
55
"scripts": {
6-
"dev": "svelte-kit dev",
7-
"build": "svelte-kit build",
6+
"dev": "vite dev",
7+
"build": "vite build",
88
"preview": "svelte-kit preview",
99
"check": "svelte-check --tsconfig ./tsconfig.json",
1010
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
@@ -13,32 +13,33 @@
1313
},
1414
"devDependencies": {
1515
"@fec/remark-a11y-emoji": "^3.1.0",
16-
"@fluentui/svg-icons": "^1.1.160",
17-
"@neodrag/svelte": "^1.1.3",
18-
"@sveltejs/adapter-vercel": "^1.0.0-next.40",
19-
"@sveltejs/kit": "^1.0.0-next.260",
20-
"@typescript-eslint/eslint-plugin": "^5.11.0",
21-
"@typescript-eslint/parser": "^5.11.0",
22-
"autoprefixer": "^10.4.2",
23-
"cssnano": "^5.0.17",
24-
"eslint": "^8.8.0",
25-
"eslint-config-prettier": "^8.3.0",
26-
"eslint-plugin-svelte3": "^3.4.0",
27-
"fluent-svelte": "^1.3.3",
28-
"mdsvex": "^0.10.5",
29-
"postcss": "^8.4.6",
16+
"@fluentui/svg-icons": "^1.1.179",
17+
"@neodrag/svelte": "^1.2.3",
18+
"@sveltejs/adapter-vercel": "next",
19+
"@sveltejs/kit": "next",
20+
"@typescript-eslint/eslint-plugin": "^5.35.1",
21+
"@typescript-eslint/parser": "^5.35.1",
22+
"autoprefixer": "^10.4.8",
23+
"cssnano": "^5.1.13",
24+
"eslint": "^8.22.0",
25+
"eslint-config-prettier": "^8.5.0",
26+
"eslint-plugin-svelte3": "^3.4.1",
27+
"fluent-svelte": "^1.6.0",
28+
"mdsvex": "^0.10.6",
29+
"postcss": "^8.4.16",
3030
"postcss-media-minmax": "^5.0.0",
31-
"prettier": "^2.5.1",
32-
"prettier-plugin-svelte": "^2.6.0",
31+
"prettier": "^2.7.1",
32+
"prettier-plugin-svelte": "^2.7.0",
3333
"remark-gfm": "^3.0.1",
34-
"remark-github": "^11.2.2",
34+
"remark-github": "^11.2.4",
3535
"remark-slug": "^7.0.1",
36-
"sass": "^1.49.7",
37-
"svelte": "^3.46.4",
38-
"svelte-check": "^2.4.3",
39-
"svelte-preprocess": "^4.10.2",
40-
"tslib": "^2.3.1",
41-
"typescript": "^4.5.5"
36+
"sass": "^1.54.5",
37+
"svelte": "^3.49.0",
38+
"svelte-check": "^2.8.1",
39+
"svelte-preprocess": "^4.10.7",
40+
"tslib": "^2.4.0",
41+
"typescript": "^4.8.2",
42+
"vite": "^3.0.9"
4243
},
4344
"type": "module"
4445
}

0 commit comments

Comments
 (0)