From b31539f0f4ceac2c4acf25271934ec5c23d9ab60 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Mon, 1 Jul 2024 10:29:31 +0800 Subject: [PATCH] Merge docs into static-php-cli repo (#492) * Move docs to here * Move docs to here * Modify old docs links --- .github/pull_request_template.md | 6 +- ...e-docs-config.yml => vitepress-deploy.yml} | 43 +- .gitignore | 8 + README-zh.md | 2 +- README.md | 2 +- docs/.vitepress/components/CliGenerator.vue | 556 ++++++++++++++++++ docs/.vitepress/components/DependencyUtil.js | 193 ++++++ docs/.vitepress/config.ts | 52 ++ docs/.vitepress/sidebar.en.ts | 52 ++ docs/.vitepress/sidebar.zh.ts | 52 ++ docs/.vitepress/theme/index.ts | 16 + docs/en/contributing/index.md | 63 ++ docs/en/develop/doctor-module.md | 70 +++ docs/en/develop/index.md | 35 ++ docs/en/develop/source-module.md | 316 ++++++++++ docs/en/develop/structure.md | 180 ++++++ docs/en/develop/system-build-tools.md | 242 ++++++++ docs/en/faq/index.md | 74 +++ docs/en/guide/action-build.md | 29 + docs/en/guide/build-on-windows.md | 221 +++++++ docs/en/guide/cli-generator.md | 12 + docs/en/guide/env-vars.md | 173 ++++++ docs/en/guide/extension-notes.md | 146 +++++ docs/en/guide/extensions.md | 27 + docs/en/guide/index.md | 43 ++ docs/en/guide/manual-build.md | 525 +++++++++++++++++ docs/en/guide/troubleshooting.md | 33 ++ docs/en/index.md | 21 + docs/extension-notes.md | 0 docs/extensions.md | 1 + docs/index.md | 23 + docs/public/CNAME | 1 + docs/zh/contributing/index.md | 48 ++ docs/zh/develop/doctor-module.md | 60 ++ docs/zh/develop/index.md | 27 + docs/zh/develop/source-module.md | 297 ++++++++++ docs/zh/develop/structure.md | 163 +++++ docs/zh/develop/system-build-tools.md | 204 +++++++ docs/zh/faq/index.md | 61 ++ docs/zh/guide/action-build.md | 25 + docs/zh/guide/build-on-windows.md | 203 +++++++ docs/zh/guide/cli-generator.md | 11 + docs/zh/guide/env-vars.md | 165 ++++++ docs/zh/guide/extension-notes.md | 133 +++++ docs/zh/guide/extensions.md | 24 + docs/zh/guide/index.md | 34 ++ docs/zh/guide/manual-build.md | 468 +++++++++++++++ docs/zh/guide/troubleshooting.md | 20 + docs/zh/index.md | 20 + package.json | 11 + src/SPC/builder/LibraryBase.php | 9 + 51 files changed, 5172 insertions(+), 28 deletions(-) rename .github/workflows/{update-docs-config.yml => vitepress-deploy.yml} (56%) create mode 100644 docs/.vitepress/components/CliGenerator.vue create mode 100644 docs/.vitepress/components/DependencyUtil.js create mode 100644 docs/.vitepress/config.ts create mode 100644 docs/.vitepress/sidebar.en.ts create mode 100644 docs/.vitepress/sidebar.zh.ts create mode 100644 docs/.vitepress/theme/index.ts create mode 100644 docs/en/contributing/index.md create mode 100644 docs/en/develop/doctor-module.md create mode 100644 docs/en/develop/index.md create mode 100644 docs/en/develop/source-module.md create mode 100644 docs/en/develop/structure.md create mode 100644 docs/en/develop/system-build-tools.md create mode 100644 docs/en/faq/index.md create mode 100644 docs/en/guide/action-build.md create mode 100644 docs/en/guide/build-on-windows.md create mode 100644 docs/en/guide/cli-generator.md create mode 100644 docs/en/guide/env-vars.md create mode 100644 docs/en/guide/extension-notes.md create mode 100644 docs/en/guide/extensions.md create mode 100644 docs/en/guide/index.md create mode 100644 docs/en/guide/manual-build.md create mode 100644 docs/en/guide/troubleshooting.md create mode 100644 docs/en/index.md create mode 100644 docs/extension-notes.md create mode 100644 docs/extensions.md create mode 100644 docs/index.md create mode 100644 docs/public/CNAME create mode 100644 docs/zh/contributing/index.md create mode 100644 docs/zh/develop/doctor-module.md create mode 100644 docs/zh/develop/index.md create mode 100644 docs/zh/develop/source-module.md create mode 100644 docs/zh/develop/structure.md create mode 100644 docs/zh/develop/system-build-tools.md create mode 100644 docs/zh/faq/index.md create mode 100644 docs/zh/guide/action-build.md create mode 100644 docs/zh/guide/build-on-windows.md create mode 100644 docs/zh/guide/cli-generator.md create mode 100644 docs/zh/guide/env-vars.md create mode 100644 docs/zh/guide/extension-notes.md create mode 100644 docs/zh/guide/extensions.md create mode 100644 docs/zh/guide/index.md create mode 100644 docs/zh/guide/manual-build.md create mode 100644 docs/zh/guide/troubleshooting.md create mode 100644 docs/zh/index.md create mode 100644 package.json diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6a441788..8cf1f448 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,6 +7,6 @@ > If your PR involves the changes mentioned below and completed the action, please tick the corresponding option. > If a modification is not involved, please skip it directly. -- [ ] If it's a extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`. -- [ ] If you changed the behavior of static-php-cli, add docs in [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) . -- [ ] If you updated `config/xxxx.json` content, run `bin/spc dev:sort-config xxx`. +- [ ] If it's an extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`. +- [ ] If you changed the behavior of static-php-cli, update docs in `./docs/`. +- [ ] If you updated `config/xxx.json` content, run `bin/spc dev:sort-config xxx`. diff --git a/.github/workflows/update-docs-config.yml b/.github/workflows/vitepress-deploy.yml similarity index 56% rename from .github/workflows/update-docs-config.yml rename to .github/workflows/vitepress-deploy.yml index d3687b42..8ad3baee 100644 --- a/.github/workflows/update-docs-config.yml +++ b/.github/workflows/vitepress-deploy.yml @@ -1,36 +1,31 @@ -name: Update Docs Config - +name: Docs Auto Deploy on: push: branches: - main paths: - 'config/**.json' + - 'docs/**' + - 'package.json' jobs: - update-docs-config: - name: "Update Docs Config" + build: + name: Deploy docs runs-on: ubuntu-latest if: github.repository == 'crazywhalecc/static-php-cli' steps: - - name: "Checkout static-php-cli" + - name: Checkout master uses: actions/checkout@v4 - - name: "Checkout static-php-cli-docs" - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 with: - repository: static-php/static-php-cli-docs - ref: master - token: ${{ secrets.DOCS_REPO_TOKEN }} - path: static-php-cli-docs + node-version: 18 + cache: yarn - - name: "Set up Git" - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" + - run: yarn install --frozen-lockfile - name: "Copy Config Files" - run: cp -r config/* static-php-cli-docs/docs/.vitepress/config/ + run: cp -r config/* docs/.vitepress/config/ - name: "Install PHP for official runners" uses: "shivammathur/setup-php@v2" @@ -58,11 +53,13 @@ jobs: - name: "Generate Extension Support List" run: | - bin/spc dev:gen-ext-docs > static-php-cli-docs/docs/extensions.md + bin/spc dev:gen-ext-docs > docs/extensions.md - - name: "Commit and Push Changes" - run: | - cd static-php-cli-docs - git add -A - git commit -m "Sync config files from main" - git push origin master + - name: Build + run: yarn docs:build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/.vitepress/dist diff --git a/.gitignore b/.gitignore index 269a267e..ab857ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,11 @@ docker/source/ # default test directory /tests/var/ + +# VitePress +/node_modules/ +/docs/.vitepress/dist/ +/docs/.vitepress/cache/ +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/README-zh.md b/README-zh.md index 8b64a65c..c68d52f8 100755 --- a/README-zh.md +++ b/README-zh.md @@ -274,7 +274,7 @@ bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=sys 另外,添加新扩展的贡献方式,可以参考下方 `进阶`。 -如果你想贡献文档内容,请到项目仓库 [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) 贡献。 +如果你想贡献文档内容,请直接修改 `docs/` 目录。 ## 赞助本项目 diff --git a/README.md b/README.md index c61cb7d7..4b000aa8 100755 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ For an advanced example of how to use this feature, take a look at [how to use i If the extension you need is missing, you can create an issue. If you are familiar with this project, you are also welcome to initiate a pull request. -If you want to contribute documentation, please go to [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs). +If you want to contribute documentation, please just edit in `docs/`. Now there is a [static-php](https://github.com/static-php) organization, which is used to store the repo related to the project. diff --git a/docs/.vitepress/components/CliGenerator.vue b/docs/.vitepress/components/CliGenerator.vue new file mode 100644 index 00000000..5ef34495 --- /dev/null +++ b/docs/.vitepress/components/CliGenerator.vue @@ -0,0 +1,556 @@ +