FEATURE: Fix Discourse installation support in China (#793)
author耗子 <i@haozi.net>
Mon, 6 May 2024 05:47:35 +0000 (13:47 +0800)
committerGitHub <noreply@github.com>
Mon, 6 May 2024 05:47:35 +0000 (13:47 +0800)
commitc99f0c3e32d719863584e3570d61578e3724fe18
treef3944466a02eefa0bfb143f5e8e4e033ab7c6db5
parent6c42a465c9de2140e9269e909e8d8a1b8520ee3e
FEATURE: Fix Discourse installation support in China (#793)

This commit does 2 things:

1. Added a new yarn hook to replace the npm mirror before `yarn install`.
2. Modified `web.china.template.yml` to add more mirror sources.

Below is an explanation of these modifications:

- The GitHub proxy added in `web.china.template.yml` has existed in China for many years, and its repository https://github.com/hunshcn/gh-proxy has 6k+ stars, which can ensure its security and stability.
- The NPM mirror site added in `web.china.template.yml` is maintained by Alibaba Group, one of the largest Internet companies in China.
- Modified the Gem mirror in `web.china.template.yml` to the mirror provided by Tsinghua University, one of the top universities in China.
- The reason why sed is used to replace the `yarn.lock` file is because `yarn install --frozen-lockfile` is used for installation below. If the url is not replaced, the NPM mirror will not take effect.

After applying these modifications, I successfully installed Discourse on the Tencent Cloud China server. No more network problems.
templates/web.china.template.yml
templates/web.template.yml