Skip to content

Commit a65debf

Browse files
committed
Merge branch 'main' into pr/13767
2 parents bbfcece + 80d9f99 commit a65debf

File tree

1,631 files changed

+23373
-34256
lines changed

Some content is hidden

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

1,631 files changed

+23373
-34256
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [ ] Prefix your PR title with `feat:`, `fix:`, `chore:`, or `docs:`.
55
- [ ] This message body should clearly illustrate what problems it solves.
66
- [ ] Ideally, include a test that fails without this PR but passes with it.
7+
- [ ] If this PR changes code within `packages/svelte/src`, add a changeset (`npx changeset`).
78

89
### Tests and linting
910

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: pnpm lint
6060
- name: build and check generated types
6161
if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail
62-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
62+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
6363
Benchmarks:
6464
runs-on: ubuntu-latest
6565
timeout-minutes: 15
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# https://github.com/sveltejs/svelte.dev/blob/main/apps/svelte.dev/scripts/sync-docs/README.md
2+
name: Docs preview create request
3+
4+
on:
5+
pull_request_target:
6+
branches:
7+
- main
8+
9+
jobs:
10+
dispatch:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Repository Dispatch
14+
uses: peter-evans/repository-dispatch@v3
15+
with:
16+
token: ${{ secrets.SYNC_REQUEST_TOKEN }}
17+
repository: sveltejs/svelte.dev
18+
event-type: docs-preview-create
19+
client-payload: |-
20+
{
21+
"package": "svelte",
22+
"repo": "${{ github.repository }}",
23+
"owner": "${{ github.event.pull_request.head.repo.owner.login }}",
24+
"branch": "${{ github.event.pull_request.head.ref }}",
25+
"pr": ${{ github.event.pull_request.number }}
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# https://github.com/sveltejs/svelte.dev/blob/main/apps/svelte.dev/scripts/sync-docs/README.md
2+
name: Docs preview delete request
3+
4+
on:
5+
pull_request_target:
6+
branches:
7+
- main
8+
types: [closed]
9+
10+
jobs:
11+
dispatch:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Repository Dispatch
15+
uses: peter-evans/repository-dispatch@v3
16+
with:
17+
token: ${{ secrets.SYNC_REQUEST_TOKEN }}
18+
repository: sveltejs/svelte.dev
19+
event-type: docs-preview-delete
20+
client-payload: |-
21+
{
22+
"package": "svelte",
23+
"repo": "${{ github.repository }}",
24+
"owner": "${{ github.event.pull_request.head.repo.owner.login }}",
25+
"branch": "${{ github.event.pull_request.head.ref }}",
26+
"pr": ${{ github.event.pull_request.number }}
27+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Update pkg.pr.new comment
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Publish Any Commit']
6+
types:
7+
- completed
8+
9+
jobs:
10+
build:
11+
name: 'Update comment'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Download artifact
15+
uses: actions/download-artifact@v4
16+
with:
17+
name: output
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
run-id: ${{ github.event.workflow_run.id }}
20+
21+
- run: ls -R .
22+
- name: 'Post or update comment'
23+
uses: actions/github-script@v6
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
script: |
27+
const fs = require('fs');
28+
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
29+
30+
const bot_comment_identifier = `<!-- pkg.pr.new comment -->`;
31+
32+
const body = (number) => `${bot_comment_identifier}
33+
34+
[Playground](https://svelte.dev/playground?version=pr-${number})
35+
36+
\`\`\`
37+
${output.packages.map((p) => `pnpm add https://pkg.pr.new/${p.name}@${number}`).join('\n')}
38+
\`\`\`
39+
`;
40+
41+
async function find_bot_comment(issue_number) {
42+
if (!issue_number) return null;
43+
const comments = await github.rest.issues.listComments({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
issue_number: issue_number,
47+
});
48+
return comments.data.find((comment) =>
49+
comment.body.includes(bot_comment_identifier)
50+
);
51+
}
52+
53+
async function create_or_update_comment(issue_number) {
54+
if (!issue_number) {
55+
console.log('No issue number provided. Cannot post or update comment.');
56+
return;
57+
}
58+
59+
const existing_comment = await find_bot_comment(issue_number);
60+
if (existing_comment) {
61+
await github.rest.issues.updateComment({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
comment_id: existing_comment.id,
65+
body: body(issue_number),
66+
});
67+
} else {
68+
await github.rest.issues.createComment({
69+
issue_number: issue_number,
70+
owner: context.repo.owner,
71+
repo: context.repo.repo,
72+
body: body(issue_number),
73+
});
74+
}
75+
}
76+
77+
async function log_publish_info() {
78+
const svelte_package = output.packages.find(p => p.name === 'svelte');
79+
const svelte_sha = svelte_package.url.replace(/^.+@([^@]+)$/, '$1');
80+
console.log('\n' + '='.repeat(50));
81+
console.log('Publish Information');
82+
console.log('='.repeat(50));
83+
console.log('\nPublished Packages:');
84+
console.log(output.packages.map((p) => `${p.name} - pnpm add https://pkg.pr.new/${p.name}@${p.url.replace(/^.+@([^@]+)$/, '$1')}`).join('\n'));
85+
if(svelte_sha){
86+
console.log('\nPlayground URL:');
87+
console.log(`\nhttps://svelte.dev/playground?version=commit-${svelte_sha}`)
88+
}
89+
console.log('\n' + '='.repeat(50));
90+
}
91+
92+
if (output.event_name === 'pull_request') {
93+
if (output.number) {
94+
await create_or_update_comment(output.number);
95+
}
96+
} else if (output.event_name === 'push') {
97+
const pull_requests = await github.rest.pulls.list({
98+
owner: context.repo.owner,
99+
repo: context.repo.repo,
100+
state: 'open',
101+
head: `${context.repo.owner}:${output.ref.replace('refs/heads/', '')}`,
102+
});
103+
104+
if (pull_requests.data.length > 0) {
105+
await create_or_update_comment(pull_requests.data[0].number);
106+
} else {
107+
console.log(
108+
'No open pull request found for this push. Logging publish information to console:'
109+
);
110+
await log_publish_info();
111+
}
112+
}

.github/workflows/pkg.pr.new.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Any Commit
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- run: corepack enable
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 18.x
16+
cache: pnpm
17+
18+
- name: Install dependencies
19+
run: pnpm install --frozen-lockfile
20+
21+
- name: Build
22+
run: pnpm build
23+
24+
- run: pnpx pkg-pr-new publish --comment=off --json output.json --compact --no-template './packages/svelte'
25+
- name: Add metadata to output
26+
uses: actions/github-script@v6
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
script: |
30+
const fs = require('fs');
31+
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
32+
output.number = context.issue.number;
33+
output.event_name = context.eventName;
34+
output.ref = context.ref;
35+
fs.writeFileSync('output.json', JSON.stringify(output), 'utf8');
36+
- name: Upload output
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: output
40+
path: ./output.json
41+
42+
- run: ls -R .

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: pnpm install --frozen-lockfile
3434

3535
- name: Build
36-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
36+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
3737

3838
- name: Create Release Pull Request or Publish to npm
3939
id: changesets

.github/workflows/sync-request.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# https://github.com/sveltejs/svelte.dev/blob/main/apps/svelte.dev/scripts/sync-docs/README.md
2+
name: Sync request
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
dispatch:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Repository Dispatch
14+
uses: peter-evans/repository-dispatch@v3
15+
with:
16+
token: ${{ secrets.SYNC_REQUEST_TOKEN }}
17+
repository: sveltejs/svelte.dev
18+
event-type: sync-request
19+
client-payload: |-
20+
{
21+
"package": "svelte"
22+
}

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-24 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
1+
Copyright (c) 2016-2025 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ You may view [our roadmap](https://svelte.dev/roadmap) if you'd like to see what
2424

2525
Please see the [Contributing Guide](CONTRIBUTING.md) and the [`svelte`](packages/svelte) package for information on contributing to Svelte.
2626

27-
### svelte.dev
28-
29-
The source code for https://svelte.dev lives in the [sites](https://github.com/sveltejs/svelte/tree/master/sites/svelte.dev) folder, with all the documentation right [here](https://github.com/sveltejs/svelte/tree/master/documentation). The site is built with [SvelteKit](https://svelte.dev/docs/kit).
30-
3127
## Is svelte.dev down?
3228

3329
Probably not, but it's possible. If you can't seem to access any `.dev` sites, check out [this SuperUser question and answer](https://superuser.com/q/1413402).

0 commit comments

Comments
 (0)