-
Notifications
You must be signed in to change notification settings - Fork 31
WIP: chore(root): new docs docusaurus + swagger ui #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
alirezakazemeini
wants to merge
29
commits into
master
Choose a base branch
from
root/chore/docusaurus-implementation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5159b24
chore(root): new docs docusaurus + swagger ui init
alirezakazemeini 73ab5ca
chore(root): header and footer customization requirements
alirezakazemeini 6524084
chore(root): production design implementation
alirezakazemeini 941ae73
chore(root): multiple open api docs
alirezakazemeini e98f5ce
chore(root): custom search
alirezakazemeini 4368761
fix(root): sidebar generation
alirezakazemeini 9c72ca6
fix(root): changes to git ignore
alirezakazemeini 93ee99e
fix(root): changes to docs directory
alirezakazemeini 9bf1073
chore(root): removed unnecessary files
alirezakazemeini 5b6a175
chore(root): removed unnecessary files
alirezakazemeini 1d10b98
chore(root): custom search indexing improvement
alirezakazemeini d7ea663
chore(root): docs migration
alirezakazemeini 3c81682
chore(root): changelog
alirezakazemeini 1154ff6
fix(root): writings
alirezakazemeini b7a0292
fix(root): product requirements
alirezakazemeini e337885
chore(root): directory cleanup
alirezakazemeini b4756f6
fix(root): code cleanup
alirezakazemeini 69173e2
fix(root): build errors
alirezakazemeini 7847855
fix(root): build errors
alirezakazemeini a3d8ed0
chore(root): CONTRIBUTING.md file
alirezakazemeini ef0b47d
chore(root): design improvements
alirezakazemeini 6df4e0c
chore(ci): updated github actions workflow
alirezakazemeini 453039c
fix(ui): code-item hover
alirezakazemeini 4f2717b
fix(ui): code-item border
alirezakazemeini c422c94
fix(root): code review's raised issues
alirezakazemeini 182e602
fix(root): code cleanup
alirezakazemeini 8cdeeac
Delete node_modules/.yarn-integrity
alirezakazemeini 4c99eb4
fix(root): removal of DS_Store step1
alirezakazemeini 0eecbe0
fix(root): removal of DS_Store step-fin
alirezakazemeini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,33 @@ | ||
| name: Deploy | ||
| name: Deploy Docusaurus | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ 'master' ] | ||
| branches: [ 'main/open-api' ] | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| ruby-version: 3.3.8 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| ruby-version: ${{ env.ruby-version }} | ||
| node-version: 18 | ||
| cache: yarn | ||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Clean old docs | ||
| run: yarn clean:docs | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: vendor/bundle | ||
| key: gems-${{ runner.os }}-${{ env.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} | ||
| restore-keys: | | ||
| gems-${{ runner.os }}-${{ env.ruby-version }}- | ||
| gems-${{ runner.os }}- | ||
|
|
||
| - run: bundle config set deployment 'true' | ||
| - name: bundle install | ||
| run: | | ||
| bundle config path vendor/bundle | ||
| bundle install --jobs 4 --retry 3 | ||
| - name: Generate API docs | ||
| run: yarn genapi | ||
|
|
||
| - run: bundle exec middleman build | ||
| - name: Build site | ||
| run: yarn build | ||
|
|
||
| - name: Deploy | ||
| uses: peaceiris/actions-gh-pages@v3 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./build | ||
| keep_files: true | ||
| - name: Deploy to GitHub Pages | ||
| run: yarn deploy | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,26 @@ | ||
| *.gem | ||
| *.rbc | ||
| .bundle | ||
| .config | ||
| coverage | ||
| InstalledFiles | ||
| vendor/bundle | ||
| lib/bundler/man | ||
| pkg | ||
| rdoc | ||
| spec/reports | ||
| test/tmp | ||
| test/version_tmp | ||
| tmp | ||
| # Dependencies | ||
| node_modules | ||
|
|
||
| # Production | ||
| build | ||
|
|
||
| # Generated files | ||
| .docusaurus | ||
| .cache-loader | ||
|
|
||
| # Misc | ||
| *.DS_STORE | ||
| build/ | ||
| .cache | ||
| .vagrant | ||
| .sass-cache | ||
| *.DS_Store | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # YARD artifacts | ||
| .yardoc | ||
| _yardoc | ||
| doc/ | ||
| .idea/ | ||
| .vscode | ||
| docs/* | ||
| yarn.lock | ||
|
|
||
| # Vagrant artifacts | ||
| ubuntu-*-console.log | ||
| .idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,100 @@ | ||
| # Contributing | ||
| <div dir="rtl"> | ||
|
|
||
| ## Development | ||
| To install dependencies, after installing `ruby`, install bundle with `gem install bundler` and then | ||
| use `bundle install` to install dependencies. | ||
| ### راهنمای اضافه کردن سکشن جدید به OpenAPI و مستندات Docusaurus | ||
|
|
||
| Now you can start editing files in `source` directory. Launch a server with `make serve` to view the | ||
| resulting HTML in your browser. | ||
| #### I. افزودن اندپوینت جدید به فایل OpenAPI | ||
|
|
||
| To build the site run `make build`. This will generate site's static files in `build` folder. | ||
| 1. در فایل OpenAPI مربوطه، اندپوینت جدید را در بخش `paths` و بر اساس متد مورد نظر (`post`, `get`, `delete`, …) اضافه کنید. | ||
| 2. برای قابلمشاهده بودن اندپوینت در سایدبار، مقدار `tag` آن را مطابق با تگ تعریفشده برای همان فایل OpenAPI تنظیم کنید. | ||
| 3. در صورت نیاز: | ||
| - `summary` و `description` اندپوینت را کامل بنویسید. | ||
| - اگر اندپوینت خصوصی است، در بخش `security` برای آن `TokenAuth` اضافه کنید. | ||
| - اگر به هدرها یا بدنهٔ درخواست نیاز است، `requestBody` را تعریف کنید. | ||
| - در نهایت، پارامترها (`parameters`) و انواع ریسپانسهای (`responses`) مربوط به اندپوینت را اضافه کنید. | ||
|
|
||
| # References | ||
| * https://github.com/lord/slate/wiki/ | ||
| * https://developer.tradegecko.com/docs.html | ||
| * https://github.com/rouge-ruby/rouge/wiki/List-of-supported-languages-and-lexers | ||
| > اگر فایل جدیدی اضافه نمیکنید و فقط روی فایلهای موجود ویرایش انجام میدهید، میتوانید مرحلهٔ II و III را نادیده بگیرید و مستقیم به مرحله IV بروید. | ||
|
|
||
| #### II. افزودن فایل OpenAPI جدید به تنظیمات `docusaurus-plugin-openapi-docs` | ||
|
|
||
| اگر فایل OpenAPI جدیدی اضافه میکنید: | ||
|
|
||
| 1. فایل جدید را در تنظیمات پلاگین `docusaurus-plugin-openapi-docs` در فایل `docusaurus.config.ts` ثبت کنید. | ||
| 2. برای هر ورودی جدید، مقادیر زیر را تنظیم کنید: | ||
| - `specPath`: مسیر فایل OpenAPI در پوشهٔ `openapi` | ||
| - `outputDir`: مسیر پوشهٔ خروجی که طبق کنوانسیون باید به صورت `docs/<key>` باشد | ||
| - `sidebarOptions`: تنظیمات نحوهٔ نمایش در سایدبار. با توجه به اینکه در مرحلهٔ قبل تگ اندپوینتها را مشخص کردهایم، این بخش معمولاً به صورت زیر تنظیم میشود: | ||
|
|
||
| </div> | ||
|
|
||
| ```ts | ||
| sidebarOptions: { | ||
| groupPathsBy: "tag", | ||
| categoryLinkSource: "tag", | ||
| } | ||
| ``` | ||
|
|
||
| <div dir="rtl"> | ||
|
|
||
|
|
||
| خروجی این بخش باید بصورت زیر باشد: | ||
| </div> | ||
|
|
||
| ```ts | ||
| <file_name>: { | ||
| specPath: "openapi/<file_name>.yaml", | ||
| outputDir: "docs/<file_name>", | ||
| sidebarOptions: { | ||
| groupPathsBy: "tag", | ||
| categoryLinkSource: "tag", | ||
| }, | ||
| } satisfies OpenApiPlugin.Options, | ||
| ``` | ||
|
|
||
| <div dir="rtl"> | ||
|
|
||
| 3. با توجه به ساختار TypeScript، بهتر است نوع تنظیمات پلاگین را نیز با `OpenApiPlugin.Options` مشخص کنید. | ||
|
|
||
| در این مرحله امکان جنریت کردن مستندات مربوط به فایل جدید توسط Docusaurus فراهم میشود. برای این کار میتوانید دستور زیر را اجرا کنید: | ||
|
|
||
| </div> | ||
|
|
||
| ```bash | ||
| yarn genapi | ||
| ``` | ||
|
|
||
| <div dir="rtl"> | ||
|
|
||
| #### III. بررسی خروجی جنریتشده | ||
|
|
||
| 1. اگر فایلها بدون خطا جنریت شدند، بسته به مقداری که برای `outputDir` تنظیم کردهاید، میتوانید دایرکتوری متناظر را در مسیر `./docs` مشاهده کنید. | ||
| 2. پلاگین `docusaurus-plugin-openapi-docs` برای هر پوشهٔ خروجی، یک فایل `sidebar` نیز تولید میکند: | ||
| - این فایل سایدبار را ابتدا در روت پروژه به تنظیمات سایدبارها اضافه کنید. | ||
| - سپس مانند سایر سایدبارها، آیتمهای آن را (از ایندکس دوم به بعد) به لیست `items` اضافه کنید. | ||
| - با تغییر ترتیب آیتمها در لیست `items`، ترتیب نمایش در سایدبار نیز تغییر خواهد کرد. | ||
|
|
||
| #### IV. بهروزرسانی تغییرات و اجرای پروژه | ||
|
|
||
| 1. تغییرات مربوط به این کار را در فایل زیر ثبت کنید: | ||
|
|
||
| [`src/pages/changelog.md`](src/pages/changelog.md) | ||
|
|
||
| 2. برای مشاهدهٔ بیلد لوکال، دستور زیر را اجرا کنید: | ||
|
|
||
| </div> | ||
|
|
||
| ```bash | ||
| yarn dev | ||
| ``` | ||
|
|
||
| <div dir="rtl"> | ||
|
|
||
| 3. پس از تأیید نهایی تغییرات، آنها را با برنچ زیر مرج کنید. | ||
| </div> | ||
|
|
||
| ```text | ||
| main/open-api | ||
| ``` | ||
|
|
||
| <div dir="rtl"> | ||
|
|
||
| </div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest having someone from the SRE team review this workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alikafy