Skip to content

Commit f19a476

Browse files
authored
Merge pull request #2641 from input-output-hk/djo/2622/future-proof-website
make website more future-proof
2 parents b56cdc8 + 2998a1d commit f19a476

24 files changed

+1565
-838
lines changed

docs/website/Makefile

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.PHONY: clean install build serve dev upgrade
1+
.PHONY: clean install build serve dev lint format upgrade update-current \
2+
swizzled-components-upgrade swizzled-components-clean reswizzle-components swizzled-components-apply-patches
23

34
package-lock.json:
45
npm install
@@ -27,6 +28,12 @@ clean:
2728
rm -rf build
2829
rm package-lock.json || true
2930

31+
lint:
32+
npm run pretty:check
33+
34+
format:
35+
npm run pretty:write
36+
3037
upgrade: clean install
3138
# Update to the latest version of react and react-dom when it is supported and does not create dependency conflicts
3239
npm install \
@@ -50,8 +57,34 @@ update-current:
5057
# Remove the entry for the temporary version in the versions.json file
5158
sed -i '/updated/d' versions.json
5259

53-
lint:
54-
npm run pretty:check
60+
swizzled-components-upgrade: swizzled-components-clean reswizzle-components swizzled-components-apply-patches
5561

56-
format:
57-
npm run pretty:write
62+
swizzled-components-clean:
63+
@echo "\033[1mRemoving swizzled components\033[0m"
64+
rm -rf ./src/theme/Footer ./src/theme/Navbar
65+
@echo
66+
67+
reswizzle-components:
68+
@echo "\033[1mRe-swizzling Docusaurus components\033[0m"
69+
npm run swizzle @docusaurus/theme-classic Footer/Layout -- --eject --typescript
70+
npm run swizzle @docusaurus/theme-classic Footer/LinkItem -- --eject --typescript
71+
npm run swizzle @docusaurus/theme-classic Footer/Links/MultiColumn -- --eject --typescript
72+
npm run swizzle @docusaurus/theme-classic Footer/Logo -- --eject --typescript
73+
74+
npm run swizzle @docusaurus/theme-classic Navbar/Content -- --eject --typescript --danger
75+
npm run swizzle @docusaurus/theme-classic Navbar/Layout -- --eject --typescript --danger
76+
npm run swizzle @docusaurus/theme-classic Navbar/MobileSidebar/Layout -- --eject --typescript --danger
77+
npm run swizzle @docusaurus/theme-classic Navbar/MobileSidebar/PrimaryMenu -- --eject --typescript --danger
78+
79+
@echo "\033[1mApplying prettier\033[0m"
80+
prettier --write ./src/theme/Footer ./src/theme/Navbar
81+
@echo
82+
83+
swizzled-components-apply-patches:
84+
@echo "\033[1mTrying to apply custom changes ...\033[33m conflicts must be handled manually\033[0m"
85+
$(MAKE) $(wildcard ./upgrade/*.patch)
86+
87+
upgrade/%.patch: src/theme
88+
@echo "git apply --verbose --reject ${@}"
89+
@git apply --verbose --reject $@ || echo "\033[31mPatch '${@}' failed, check '.rej' files\033[0m"
90+
@echo

docs/website/README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,69 @@
11
# Website
22

3-
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
3+
This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.
44

55
### Installation
66

7-
```
7+
```shell
88
$ make install
99
```
1010

11-
### Local Development
11+
### Build
1212

13+
```shell
14+
$ make build
1315
```
14-
$ yarn start
16+
17+
This command generates static content into the `build` directory and can be served using any static contents hosting
18+
service.
19+
20+
### Local Development
21+
22+
```shell
23+
$ make dev
1524
```
1625

1726
This command starts a local development server and opens up a browser window. Most changes are reflected live without
1827
having to restart the server.
1928

20-
### Build
29+
Alternatively, if you need to simulate GitHub pages hosting environment, you can run
2130

22-
```
23-
$ make build
31+
```shell
32+
$ make serve-static
2433
```
2534

26-
This command generates static content into the `build` directory and can be served using any static contents hosting
27-
service.
35+
This will create a production build and run it on a Python server as a static content.
2836

29-
### Deployment
37+
### Content versioning
3038

31-
Using SSH:
39+
This website gives access to two versions of the documentation:
3240

33-
```
34-
$ USE_SSH=true npx docusaurus deploy
35-
```
41+
- `current`:
42+
- Hosts the documentation of the latest Mithril distribution
43+
- Shown by default
44+
- Source code can be found in `./root`
45+
- `next`:
46+
- Hosts the documentation of the upcoming Mithril distribution under development
47+
- Accessible by selecting `Next` in the version dropdown in the navbar
48+
- Source code can be found in `./versioned_docs/version-maintained`
3649

37-
Not using SSH:
50+
#### Versions rotation
3851

52+
When releasing a new distribution, the `current` documentation content can be rotated by using the `next` version with the command:
53+
54+
```shell
55+
make update-current
3956
```
40-
$ GIT_USER=<Your GitHub username> npx docusaurus deploy
41-
```
4257

43-
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to
44-
the `gh-pages` branch.
58+
### Upgrading swizzled components
59+
60+
To apply a custom theme to the website, some components from the `docusaurus-theme-classic` have been swizzled.
61+
If there are changes from the docusaurus side, a makefile command is available to automatically swizzle them again and
62+
try to apply our custom changes:
63+
64+
> [!WARNING]
65+
> Conflicts have to be handled manually by the developer.
66+
67+
```shell
68+
$ make swizzled-components-upgrade
69+
```

0 commit comments

Comments
 (0)