Skip to content

Commit 20e2cd9

Browse files
authored
Merge branch 'main' into svelte-html-tutorial
2 parents ab524ff + b06b94f commit 20e2cd9

File tree

467 files changed

+10478
-5060
lines changed

Some content is hidden

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

467 files changed

+10478
-5060
lines changed
Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
11
name: Docs preview create
22

33
on:
4-
repository_dispatch:
5-
types: [docs-preview-create]
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
8+
required: true
9+
type: string
10+
pr:
11+
description: 'PR number'
12+
required: true
13+
type: string
14+
owner:
15+
description: 'Owner (eg. sveltejs)'
16+
required: true
17+
type: string
18+
branch:
19+
description: 'Branch (eg. my-feature-branch)'
20+
required: true
21+
type: string
22+
23+
permissions:
24+
contents: write
625

726
env:
8-
BRANCH: preview-${{ github.event.client_payload.package }}-${{ github.event.client_payload.pr }}
27+
BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }}
928

1029
jobs:
1130
Sync:
31+
name: Sync
1232
runs-on: ubuntu-latest
33+
34+
concurrency:
35+
group: preview-${{ inputs.repo }}-${{ inputs.pr }} # can't reference env here
36+
cancel-in-progress: true
37+
1338
steps:
1439
- uses: actions/checkout@v4
1540
with:
1641
token: ${{ secrets.GH_TOKEN }}
42+
ref: main # Explicitly checkout main branch first
1743
- uses: pnpm/action-setup@v4
1844
- uses: actions/setup-node@v4
1945
with:
2046
node-version: 22
2147
cache: pnpm
2248
- run: pnpm install --frozen-lockfile
2349

24-
- name: Checkout
25-
run: git fetch origin ${{ env.BRANCH }} && git checkout ${{ env.BRANCH }} || git checkout -b ${{ env.BRANCH }}
50+
- name: Create or reset branch from main
51+
run: |
52+
git fetch origin
53+
git checkout -B ${{ env.BRANCH }} # Force create/reset branch based on current main
2654
2755
- name: Sync
28-
run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ github.event.client_payload.owner }}" -p "${{ github.event.client_payload.package }}#${{ github.event.client_payload.branch }}"
56+
run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ inputs.owner }}" -p "${{ inputs.repo }}#${{ inputs.branch }}"
2957

3058
- name: Configure Git
3159
run: |
@@ -34,27 +62,14 @@ jobs:
3462
3563
- name: Push
3664
id: push
37-
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }}
65+
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }} --force
3866

39-
- name: Find comment
40-
id: fc
41-
uses: peter-evans/find-comment@v3
42-
with:
43-
token: ${{ secrets.COMMENTER_TOKEN }}
44-
repository: ${{ github.event.client_payload.repo }}
45-
issue-number: ${{ github.event.client_payload.pr }}
46-
comment-author: 'Rich-Harris' # it's using my personal access token, not sure if there's a way to comment as a bot instead
47-
body-includes: _this is an automated message_
48-
49-
- name: Create comment
50-
if: steps.fc.outputs.comment-id == ''
51-
uses: peter-evans/create-or-update-comment@v4
67+
- name: Request preview comment
68+
uses: peter-evans/repository-dispatch@v3
5269
with:
53-
token: ${{ secrets.COMMENTER_TOKEN }}
54-
repository: ${{ github.event.client_payload.repo }}
55-
issue-number: ${{ github.event.client_payload.pr }}
56-
body: |
57-
preview: https://svelte-dev-git-${{ env.BRANCH }}-svelte.vercel.app/
58-
59-
_this is an automated message_
60-
edit-mode: replace
70+
event-type: 'request-preview-comment'
71+
client-payload: |-
72+
{
73+
"repo": "${{ inputs.repo }}",
74+
"pr": "${{ inputs.pr }}"
75+
}

.github/workflows/docs-preview-delete.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
name: Docs preview delete
22

33
on:
4-
repository_dispatch:
5-
types: [docs-preview-delete]
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
8+
required: true
9+
type: string
10+
pr:
11+
description: 'PR number'
12+
required: true
13+
type: string
614

715
env:
8-
BRANCH: preview-${{ github.event.client_payload.package }}-${{ github.event.client_payload.pr }}
16+
BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }}
917

1018
jobs:
1119
Sync:

.github/workflows/sync-docs.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
name: Sync docs
22

33
on:
4-
repository_dispatch:
5-
types: [sync-request]
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
614

715
jobs:
816
Sync:
@@ -17,13 +25,13 @@ jobs:
1725
- run: pnpm install --frozen-lockfile
1826

1927
- name: Sync
20-
run: cd apps/svelte.dev && pnpm sync-docs -p ${{ github.event.client_payload.package }}
28+
run: cd apps/svelte.dev && pnpm sync-docs -p ${{ inputs.repo }}
2129

2230
- name: Create or update pull request
2331
uses: peter-evans/create-pull-request@v7
2432
with:
25-
commit-message: sync ${{ github.event.client_payload.package }} docs
26-
title: Sync `${{ github.event.client_payload.package }}` docs
33+
commit-message: sync ${{ inputs.repo }} docs
34+
title: Sync `${{ inputs.repo }}` docs
2735
body: This is an automated pull request. See the [README](../tree/main/apps/svelte.dev/scripts/sync-docs/README.md) for more information
28-
branch: sync-${{ github.event.client_payload.package }}
36+
branch: sync-${{ inputs.repo }}
2937
base: main

apps/svelte.dev/.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ SUPABASE_KEY=
33

44
GITHUB_CLIENT_ID=
55
GITHUB_CLIENT_SECRET=
6+
7+
# disable prerendering with `PRERENDER=false pnpm build` — this is useful for speeding up builds when previewing locally
8+
PRERENDER=true

apps/svelte.dev/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
/src/routes/_home/Supporters/contributors.js
77
/src/routes/_home/Supporters/donors.jpg
88
/src/routes/_home/Supporters/donors.js
9+
/scripts/svelte-template
10+
/static/svelte-template.json
911

1012
# git-repositories of synced docs go here
1113
/repos/
1214

1315
# TODO remove this after https://github.com/sveltejs/kit/pull/12718 is merged
1416
/content/docs/kit/50-reference
17+
.vercel
18+
.env*.local

apps/svelte.dev/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ When writing content for the tutorial, you need to be aware of the differences o
3535
### Dependencies
3636

3737
If you look in the site's package.json you'll notice several dependencies that don't appear to be used, such as `@testing-library/svelte`. These are present because they're referenced in the docs, and Twoslash needs to be able to find type definitions in order to typecheck snippets. Installing the dependencies was deemed preferable to faking it with `declare module`, since we're liable to end up with fictional types that way.
38+
39+
### Prerendering
40+
41+
Most of the site is prerendered. Since that involves some fairly expensive work, it can take a while. To build the site _without_ prerendering — for example, because you need to debug an issue that's affecting production builds — set the `PRERENDER` environment variable to `false`:
42+
43+
```bash
44+
PRERENDER=false pnpm build
45+
```

apps/svelte.dev/content/blog/2016-11-26-frameworks-without-the-framework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Frameworks without the framework: why didn't we think of this sooner?"
33
description: You can't write serious applications in vanilla JavaScript without hitting a complexity wall. But a compiler can do it for you.
44
author: Rich Harris
5-
authorURL: https://twitter.com/Rich_Harris
5+
authorURL: https://bsky.app/profile/rich-harris.dev
66
---
77

88
> Wait, this new framework has a _runtime_? Ugh. Thanks, I'll pass.
@@ -12,7 +12,7 @@ We're shipping too much code to our users. Like a lot of front end developers, I
1212

1313
But I was wrong. 100kb of .js isn't equivalent to 100kb of .jpg. It's not just the network time that'll kill your app's startup performance, but the time spent parsing and evaluating your script, during which time the browser becomes completely unresponsive. On mobile, those milliseconds rack up very quickly.
1414

15-
If you're not convinced that this is a problem, follow [Alex Russell](https://twitter.com/slightlylate) on Twitter. Alex [hasn't been making many friends in the framework community lately](https://twitter.com/slightlylate/status/728355959022587905), but he's not wrong. But the proposed alternative to using frameworks like Angular, React and Ember – [Polymer](https://www.polymer-project.org/1.0/) – hasn't yet gained traction in the front end world, and it's certainly not for a lack of marketing.
15+
If you're not convinced that this is a problem, follow [Alex Russell](https://bsky.app/profile/infrequently.org) on BlueSky. Alex [hasn't been making many friends in the framework community lately](https://twitter.com/slightlylate/status/728355959022587905), but he's not wrong. But the proposed alternative to using frameworks like Angular, React and Ember – [Polymer](https://www.polymer-project.org/1.0/) – hasn't yet gained traction in the front end world, and it's certainly not for a lack of marketing.
1616

1717
Perhaps we need to rethink the whole thing.
1818

@@ -30,7 +30,7 @@ Svelte is a new framework that does exactly that. You write your components usin
3030

3131
The [Svelte implementation of TodoMVC](https://svelte-todomvc.surge.sh/) weighs 3.6kb zipped. For comparison, React plus ReactDOM _without any app code_ weighs about 45kb zipped. It takes about 10x as long for the browser just to evaluate React as it does for Svelte to be up and running with an interactive TodoMVC.
3232

33-
And once your app _is_ up and running, according to [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark) **Svelte is fast as heck**. It's faster than React. It's faster than Vue. It's faster than Angular, or Ember, or Ractive, or Preact, or Riot, or Mithril. It's competitive with Inferno, which is probably the fastest UI framework in the world, for now, because [Dominic Gannaway](https://twitter.com/trueadm) is a wizard. (Svelte is slower at removing elements. We're [working on it](https://github.com/sveltejs/svelte/issues/26).)
33+
And once your app _is_ up and running, according to [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark) **Svelte is fast as heck**. It's faster than React. It's faster than Vue. It's faster than Angular, or Ember, or Ractive, or Preact, or Riot, or Mithril. It's competitive with Inferno, which is probably the fastest UI framework in the world, for now, because [Dominic Gannaway](https://bsky.app/profile/trueadm.dev) is a wizard. (Svelte is slower at removing elements. We're [working on it](https://github.com/sveltejs/svelte/issues/26).)
3434

3535
It's basically as fast as vanilla JS, which makes sense because it _is_ vanilla JS – just vanilla JS that you didn't have to write.
3636

apps/svelte.dev/content/blog/2017-09-06-the-zen-of-just-writing-css.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: The zen of Just Writing CSS
33
description: I would say this is the future, but we're already doing it.
44
author: Rich Harris
5-
authorURL: https://twitter.com/Rich_Harris
5+
authorURL: https://bsky.app/profile/rich-harris.dev
66
---
77

88
It's fashionable to dislike CSS. There are lots of reasons why that's the case, but it boils down to this: CSS is _unpredictable_. If you've never had the experience of tweaking a style rule and accidentally breaking some layout that you thought was completely unrelated — usually when you're trying to ship — then you're either new at this or you're a much better programmer than the rest of us.
@@ -17,7 +17,7 @@ This article isn't in any way intended as criticism of the hard work the CSS-in-
1717

1818
Everything in CSS is global. Because of that, styles intended for one bit of markup often end up affecting another. Because of _that_, developers often resort to wild namespacing conventions (not 'rules', since they're very difficult to enforce) that mostly just increase your risk of RSI.
1919

20-
It gets worse when you're working on a team. No-one dares touch styles authored by someone else, because it's often unclear what they're doing, what markup they apply to, and what disasters will unfold if you remove them.
20+
It gets worse when you're working on a team. No one dares touch styles authored by someone else, because it's often unclear what they're doing, what markup they apply to, and what disasters will unfold if you remove them.
2121

2222
The consequence of all this is the **append-only stylesheet**. There's no way of knowing which code can safely be removed, so it's common to undo some existing style with another, more specific style — even on relatively small projects.
2323

apps/svelte.dev/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Sapper: Towards the ideal web app framework'
33
description: Taking the next-plus-one step
44
author: Rich Harris
5-
authorURL: https://twitter.com/Rich_Harris
5+
authorURL: https://bsky.app/profile/rich-harris.dev
66
---
77

88
> Quickstart for the impatient: [the Sapper docs](https://sapper.svelte.dev), and the [starter template](https://github.com/sveltejs/sapper-template)

apps/svelte.dev/content/blog/2018-04-18-version-2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Svelte v2 is out!
33
description: Here's what you need to know
44
author: Rich Harris
5-
authorURL: https://twitter.com/Rich_Harris
5+
authorURL: https://bsky.app/profile/rich-harris.dev
66
---
77

88
<aside>Our motto is 'move slowly and break things'. No, wait, that came out wrong...</aside>

0 commit comments

Comments
 (0)