Graniron / internal-docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Didomi Internal Documentation

Tech Stack

This project is build with:

πŸš€ Project Structure

We have next project structure:

.
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/
|   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”œβ”€β”€ docs/
β”‚   β”‚   └── config.ts
|   β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ utils/
β”‚   └── env.d.ts
β”œβ”€β”€ astro.config.mjs
β”œβ”€β”€ package.json
└── tsconfig.json

We are looking for .md or .mdx files in the src/content/docs/ directory. Each file is exposed as a route based on its file name.

Images can be added to src/assets/ and embedded in Markdown with a relative link.

Static assets, like favicons, can be placed in the public/ directory.

🧞 Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:3000
npm run build Build your production site to ./dist/
npm run preview Preview your build locally, before deploying
npm run astro ... Run CLI commands like astro add, astro check
npm run astro -- --help Get help using the Astro CLI

Contribution(or how to add a new page)

Please follow next steps to add a new page:

  1. Create a new file in src/content/docs/ directory with .md or .mdx extension. Put it in the spa, utilities or resources folder, or create a new one if needed. Documents added to the spa, utilities or resources folder would automatically appear in the sidenav. If you want to add a new section to the sidenav, please update sidebar field config in the astro.config.mjs. Check docs for more details: https://starlight.astro.build/reference/configuration/#sidebar.
  2. Add a static markdown content to the file(for .md), or add dynamic content resolution(for .mdx). Please check section Fetching Gitlab Content section for more details

Fetching Gitlab Content

Please use next template inside your .mdx file to fetch content from the Gitlab:

---
title: History Logs SPA
description: Documentation for Versions&Proofs SPA
---
import ContentResolver from '../../../components/content-resolver.astro';

<ContentResolver projectId='PUT_PROJECT_ID' />

This code fetches Readme.md file from the Gitlab API by the project id and renders it as a markdown content. This is done during build time and it uses GITLAB_TOKEN env variable.

By default we are looking for the main branch. But you can specify another branch by adding branch prop to the ContentResolver component:

<ContentResolver projectId='PUT_PROJECT_ID' branch='master' />

Configuring Environment Variables

Please add GITLAB_TOKEN variable to the:

  • .env file for local development
  • CI environment variables for the production CI pipeline

About


Languages

Language:MDX 39.7%Language:TypeScript 27.2%Language:JavaScript 24.5%Language:Astro 6.6%Language:CSS 2.0%