Skip to content

Commit 62022dc

Browse files
committed
add sync-docs README
1 parent 090db44 commit 62022dc

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# sync-docs
2+
3+
Documentation lives in external repos (at the time of writing, [`sveltejs/svelte`](https://github.com/sveltejs/svelte), [`sveltejs/kit`](https://github.com/sveltejs/kit) and [`sveltejs/cli`](https://github.com/sveltejs/cli), though the plan is to add others) and synced into this repo.
4+
5+
The repos must be cloned (or linked — see [next section](#setup)) into the `apps/svelte.dev/repos` directory.
6+
7+
## Setup
8+
9+
For local development, it's recommended that you symlink the repos, so that you can see changes immediately then open a PR once you're happy with them:
10+
11+
```bash
12+
cd apps/svelte.dev
13+
ln -s /path/to/wherever/you/cloned/sveltejs/svelte repos/svelte
14+
ln -s /path/to/wherever/you/cloned/sveltejs/kit repos/kit
15+
ln -s /path/to/wherever/you/cloned/sveltejs/cli repos/cli
16+
```
17+
18+
I have no idea what the equivalent Windows command would be.
19+
20+
## Syncing
21+
22+
To run the `sync-docs` script locally:
23+
24+
```bash
25+
pnpm sync-docs
26+
```
27+
28+
If you've symlinked the repos and want to watch for changes, you can use the `-w` command:
29+
30+
```bash
31+
pnpm sync-docs -w # or --watch, if you're fancy
32+
```
33+
34+
To pull from the remote first (or clone it, if you don't have it symlinked/cloned locally already):
35+
36+
```bash
37+
pnpm sync-docs -p # or --pull
38+
```
39+
40+
You can combine flags, and specify individual packages:
41+
42+
```bash
43+
pnpm sync-docs -pw kit cli
44+
```
45+
46+
## Automation
47+
48+
Changes to documentation in the source repos will trigger the [`sync-docs.yml`](../../../../.github/workflows/sync-docs.yml) workflow. This is possible because the repos in question have their own `sync-request.yml` workflow that dispatches a request to this repo.
49+
50+
To set up a new repo, create a file in that repo called `.github/workflows/sync-request.yml` with the following contents:
51+
52+
```yml
53+
name: Dispatch sync request
54+
55+
on:
56+
push:
57+
branches:
58+
- main
59+
60+
jobs:
61+
dispatch:
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Repository Dispatch
65+
uses: peter-evans/repository-dispatch@v3
66+
with:
67+
token: ${{ secrets.SYNC_REQUEST_TOKEN }}
68+
repository: sveltejs/svelte.dev
69+
event-type: sync-request
70+
client-payload: |-
71+
{
72+
"package": "cli"
73+
}
74+
```
75+
76+
You will need to add a `SYNC_REQUEST_TOKEN` to the repo. First, create a personal access token by going to https://github.com/settings/personal-access-tokens/new:
77+
78+
- change the 'Resource owner' to `sveltejs`
79+
- provide access to the `sveltejs/svelte.dev` repository
80+
- under 'Repository permissions', change 'Contents' to 'Read and write'
81+
82+
Then, go to `https://github.com/<ORG>/<REPO>/settings/secrets/actions`, click 'New repository secret' and paste in your newly generated personal access token.

0 commit comments

Comments
 (0)