diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 24274dd820..d95ee25c33 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -1,8 +1,14 @@ name: "Build Sphinx Documentation" -on: - release: - types: [published] +on: + push: + branches: + - update-doc + pull_request: + branches: + - update-doc + # release: + # types: [published] jobs: docs: @@ -24,20 +30,36 @@ jobs: --health-timeout 5s --health-retries 5 steps: - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - uses: actions/checkout@master - with: - fetch-depth: 0 - - name: Build and Commit - uses: sphinx-notes/pages@v2 - with: - requirements_path: docs/requirements.txt - env: - GEONATURE_CONFIG_FILE: config/test_config.toml - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - uses: actions/checkout@master + with: + fetch-depth: 0 + ref: update-doc + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: lts/gallium + + - name: Install JS librairies + working-directory: ./frontend + run: npm install + + - name: Build JS documentation + working-directory: ./frontend + run: npm run docBuild + + - name: Build and Commit + uses: sphinx-notes/pages@v2 + with: + requirements_path: docs/requirements.txt + env: + GEONATURE_CONFIG_FILE: config/test_config.toml + + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: gh-pages diff --git a/.gitignore b/.gitignore index 0e74f5cb0d..fd94ee2450 100755 --- a/.gitignore +++ b/.gitignore @@ -97,6 +97,7 @@ instance/ # Sphinx documentation docs/_build/ +docs/external_doc/documentation_js # PyBuilder target/ diff --git a/backend/requirements-dev.in b/backend/requirements-dev.in index 6838f5df66..3e57bc0f07 100644 --- a/backend/requirements-dev.in +++ b/backend/requirements-dev.in @@ -1,2 +1,2 @@ -r requirements-common.in --r requirements-submodules.in +-r requirements-submodules.in \ No newline at end of file diff --git a/docs/api-references.rst b/docs/api-references.rst new file mode 100644 index 0000000000..19bcc97c7f --- /dev/null +++ b/docs/api-references.rst @@ -0,0 +1,6 @@ +API REFERENCES +============== + +.. toctree:: + ../../autoapi/geonature/index + frontend diff --git a/docs/conf.py b/docs/conf.py index 611a82b633..c1ea84a088 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,6 +17,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import sys, os + +sys.path.insert(0, os.path.abspath("../backend")) # -- General configuration ------------------------------------------------ @@ -38,6 +41,13 @@ "myst_parser", ] +## AUTOAPI +extensions.append("autoapi.extension") +autoapi_dirs = ["../backend/geonature"] +autoapi_ignore = ["*migrations*", "*tests*"] +autoapi_add_toctree_entry = False + + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -126,9 +136,7 @@ # ] # } -html_extra_path = [ - "CNAME", -] +html_extra_path = ["CNAME", "sources/"] # -- Options for HTMLHelp output ------------------------------------------ @@ -186,4 +194,4 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"https://docs.python.org/": None} +intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} diff --git a/docs/external_doc/.gitkeep b/docs/external_doc/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/frontend.rst b/docs/frontend.rst new file mode 100644 index 0000000000..00e68f93d4 --- /dev/null +++ b/docs/frontend.rst @@ -0,0 +1,5 @@ +Frontend +-------- +La documentation pour le frontend de Geonature se trouve ici_. + +.. _ici: documentation_js/index.html \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index f322de4664..48b41937db 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,3 +11,5 @@ Bienvenue dans la documentation de GeoNature FAQ authors CHANGELOG + api-references + diff --git a/docs/requirements.in b/docs/requirements.in index 28c8172f4a..4768510911 100644 --- a/docs/requirements.in +++ b/docs/requirements.in @@ -1,3 +1,4 @@ sphinx sphinx_rtd_theme myst-parser +sphinx-autoapi \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index bbf450c23a..7d989e3ec7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,18 +1,22 @@ # -# This file is autogenerated by pip-compile with python 3.7 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: # # pip-compile requirements.in # -alabaster==0.7.12 +alabaster==0.7.13 # via sphinx -babel==2.10.3 +anyascii==0.3.2 + # via sphinx-autoapi +astroid==3.0.1 + # via sphinx-autoapi +babel==2.13.1 # via sphinx -certifi==2022.9.14 +certifi==2023.7.22 # via requests -charset-normalizer==2.1.1 +charset-normalizer==3.3.1 # via requests -docutils==0.17.1 +docutils==0.18.1 # via # myst-parser # sphinx @@ -21,63 +25,64 @@ idna==3.4 # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==4.12.0 - # via sphinx jinja2==3.1.2 # via # myst-parser # sphinx -markdown-it-py==2.1.0 + # sphinx-autoapi +markdown-it-py==3.0.0 # via # mdit-py-plugins # myst-parser -markupsafe==2.1.1 +markupsafe==2.1.3 # via jinja2 -mdit-py-plugins==0.3.3 +mdit-py-plugins==0.4.0 # via myst-parser mdurl==0.1.2 # via markdown-it-py -myst-parser==0.18.1 +myst-parser==2.0.0 # via -r requirements.in -packaging==21.3 +packaging==23.2 # via sphinx -pygments==2.13.0 +pygments==2.16.1 # via sphinx -pyparsing==3.0.9 - # via packaging -pytz==2022.2.1 - # via babel -pyyaml==6.0 - # via myst-parser -requests==2.28.1 +pyyaml==6.0.1 + # via + # myst-parser + # sphinx-autoapi +requests==2.31.0 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==5.1.1 +sphinx==7.2.6 # via # -r requirements.in # myst-parser + # sphinx-autoapi # sphinx-rtd-theme -sphinx-rtd-theme==1.0.0 + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-jquery + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinx-autoapi==3.0.0 # via -r requirements.in -sphinxcontrib-applehelp==1.0.2 +sphinx-rtd-theme==1.3.0 + # via -r requirements.in +sphinxcontrib-applehelp==1.0.7 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via sphinx -sphinxcontrib-htmlhelp==2.0.0 +sphinxcontrib-htmlhelp==2.0.4 # via sphinx +sphinxcontrib-jquery==4.1 + # via sphinx-rtd-theme sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.9 # via sphinx -typing-extensions==4.3.0 - # via - # importlib-metadata - # markdown-it-py - # myst-parser -urllib3==1.26.12 +urllib3==2.0.7 # via requests -zipp==3.8.1 - # via importlib-metadata diff --git a/frontend/package.json b/frontend/package.json index e7d26dc69a..82f3debdf3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,8 @@ "format": "prettier --config .prettierrc --ignore-path .prettierignore --write '**/*.ts' '../contrib/*/frontend/**/*.ts'", "format:check": "prettier --config .prettierrc --ignore-path .prettierignore --check '**/*.ts' '../contrib/*/frontend/**/*.ts'", "cypress:open": "cypress open", - "cypress:run": "cypress run" + "cypress:run": "cypress run", + "docBuild" : "npx compodoc -p tsconfig.doc.json -d ../docs/external_doc/documentation_js" }, "private": true, "dependencies": { @@ -66,6 +67,7 @@ "cypress": "^9.2.1", "cypress-promise": "^1.1.0", "prettier": "^2.5.0", - "typescript": "4.9.4" + "typescript": "4.9.4", + "@compodoc/compodoc":"^1.1.22" } } diff --git a/frontend/tsconfig.doc.json b/frontend/tsconfig.doc.json new file mode 100644 index 0000000000..227b0c3c15 --- /dev/null +++ b/frontend/tsconfig.doc.json @@ -0,0 +1,4 @@ +{ + "include": ["src/**/*.ts"], + "exclude": ["src/test.ts", "src/**/*.spec.ts", "src/app/file-to-exclude.ts"] + } \ No newline at end of file