Files
gitea-docs/Makefile
HesterG 1ba3ac7c99 Add outdated component to outdated documents (#25)
- `git log` needs all commit history to compare latest commit of files, so changed `git clone --depth=1` to `git clone`. This will make the step take longer, so might be improved if there is a better way.

- `src/theme/MDXContent/index.js` is from [ejecting of the component](https://docusaurus.io/docs/swizzling#ejecting) inside `@docusaurus/theme-classic` plugin, and this one is safe to eject according to docusaurus

    ![Screen Shot 2023-06-06 at 12.12.28](/attachments/17a3a84b-cec0-4849-8bd6-9e0471d9536f)

    ![Screen Shot 2023-06-06 at 12.12.15](/attachments/58bba321-3cfb-4a8b-8aeb-84422a06c472)

- [Outdated component style reference](https://mui.com/material-ui/react-alert/)

- Added [`Translate` component](https://docusaurus.io/docs/next/docusaurus-core#translate) to `Outdated` so it can be localized. [reference](https://docusaurus.io/docs/next/i18n/tutorial#translate-your-react-code)

- One way to check for the specific outdated documents:

    search for `lastest commit timestamp` in [prepare nightly docs and prepare 1.19 docs steps](https://gitea.com/gitea/gitea-docusaurus/actions/runs/74)

# After

The Chinese documents that are outdated (latest commit is ealier than laster commit of English version):

![Screen Shot 2023-06-06 at 13.04.24](/attachments/e5d16267-d8d8-434e-89b1-138d04ec92a3)

![Screen Shot 2023-06-06 at 13.05.07](/attachments/af8f996a-5318-4f89-841f-b27a4903a27d)

![Screen Shot 2023-06-06 at 13.05.14](/attachments/e6aba31b-46ba-4a32-ad81-81007e0f711e)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/25
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-08 03:34:23 +00:00

86 lines
3.1 KiB
Makefile

ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
SED_INPLACE := sed -i
else
SED_INPLACE := sed -i ''
endif
.PHONY: all
all: build
.PHONY: create_dir
create_dir:
mkdir -p .tmp docs versioned_docs
.PHONY: clone_main
clone_main: create_dir
git clone --branch=main https://github.com/go-gitea/gitea.git .tmp/upstream-docs-latest
cur_path=`pwd`
cd .tmp/upstream-docs-latest/docs && make trans-copy
cd $(cur_path)
bash check_outdated.sh latest zh-cn
.PHONY: prepare-latest
prepare-latest: clone_main
cp -r .tmp/upstream-docs-latest/docs/static/* static/
rsync -avz --prune-empty-dirs --include '*/' --include='*.en-us.md' --exclude '*' .tmp/upstream-docs-latest/docs/content/doc/ docs/
cp .tmp/upstream-docs-latest/docs/content/page/index.en-us.md docs/intro.md
cp .tmp/upstream-docs-latest/templates/swagger/v1_json.tmpl static/latest-swagger.json
bash loop_docs.sh
.PHONY: prepare-latest-zh-cn
prepare-latest-zh-cn:
# clone_main
# cp -r .tmp/upstream-docs-latest/docs/static/* static/
mkdir -p i18n/zh-cn/docusaurus-plugin-content-docs/current
rsync -avz --prune-empty-dirs --include '*/' --include='*.zh-cn.md' --exclude '*' .tmp/upstream-docs-latest/docs/content/doc/ i18n/zh-cn/docusaurus-plugin-content-docs/current/
cp .tmp/upstream-docs-latest/docs/content/page/index.zh-cn.md i18n/zh-cn/docusaurus-plugin-content-docs/current/intro.md
bash loop_docs-zh-cn.sh
.PHONY: clone_\#%
clone_\#%: create_dir
git clone --branch=release/v1.$* https://github.com/go-gitea/gitea.git .tmp/upstream-docs-$*
cur_path=`pwd`
cd .tmp/upstream-docs-$*/docs && make trans-copy
cd $(cur_path)
bash check_outdated.sh $* zh-cn
.PHONY: prepare\#%
prepare\#%: clone_\#%
cp -r .tmp/upstream-docs-$*/docs/static/* static/
rsync -a --prune-empty-dirs --include '*/' --include='*.en-us.md' --exclude '*' .tmp/upstream-docs-$*/docs/content/doc/ versioned_docs/version-1.$*/
cp .tmp/upstream-docs-$*/docs/content/page/index.en-us.md versioned_docs/version-1.$*/intro.md
cp .tmp/upstream-docs-$*/templates/swagger/v1_json.tmpl static/$*-swagger.json
bash loop_docs-$*.sh
rm versioned_docs/version-1.$*/help/search.md || true
.PHONY: prepare-zh-cn\#%
prepare-zh-cn\#%:
# clone_\#%
# cp -r .tmp/upstream-docs-$*/docs/static/* static/
mkdir -p i18n/zh-cn/docusaurus-plugin-content-docs/version-1.$*
rsync -avz --prune-empty-dirs --include '*/' --include='*.zh-cn.md' --exclude '*' .tmp/upstream-docs-$*/docs/content/doc/ i18n/zh-cn/docusaurus-plugin-content-docs/version-1.$*/
cp .tmp/upstream-docs-19/docs/content/page/index.zh-cn.md i18n/zh-cn/docusaurus-plugin-content-docs/version-1.$*/intro.md
bash loop_docs-$*-zh-cn.sh
rm i18n/zh-cn/docusaurus-plugin-content-docs/version-1.$*/help/search.md || true
.PHONY: install
install:
npm install
.PHONY: build
build: install prepare-latest prepare\#19 prepare-latest-zh-cn prepare-zh-cn\#19
npm ci
npm run build
.PHONY: serve
serve: install prepare-latest prepare\#19 prepare-latest-zh-cn prepare-zh-cn\#19
npm run start
.PHONY: clean
clean:
rm -rf .tmp
rm -rf docs
rm -rf versioned_docs/
rm -rf static/_*
rm -rf static/latest-swagger.json
rm -rf static/19-swagger.json