|
1 | | -# Website |
| 1 | +# RavenDB Documentation |
2 | 2 |
|
3 | | -This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. |
| 3 | +This documentation is built using [Docusaurus](https://docusaurus.io/), an open-source modern static website generator. |
| 4 | + |
| 5 | +## Cloning the repository |
| 6 | + |
| 7 | +To clone the repository and checkout the `main` branch: |
| 8 | + |
| 9 | +```bash |
| 10 | +git clone https://github.com/ravendb/docs.git |
| 11 | +cd docs |
| 12 | +git checkout main |
| 13 | +``` |
| 14 | + |
| 15 | +## Contributing |
| 16 | +1. Open the markdown file you want to change, commit the changes, and create a pull request. |
| 17 | +2. Describe the changes made in the commits and pull request description. |
4 | 18 |
|
5 | 19 | ## Installation |
6 | 20 |
|
7 | 21 | ```bash |
8 | | -yarn |
| 22 | +npm install |
9 | 23 | ``` |
10 | 24 |
|
11 | | -## Local Development |
| 25 | +## Local development |
12 | 26 |
|
13 | 27 | ```bash |
14 | | -yarn start |
| 28 | +npm run start |
15 | 29 | ``` |
16 | 30 |
|
17 | | -This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. |
| 31 | +This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server (hot reload). |
18 | 32 |
|
19 | 33 | ## Build |
20 | 34 |
|
21 | 35 | ```bash |
22 | | -yarn build |
| 36 | +docusaurus build |
23 | 37 | ``` |
24 | 38 |
|
25 | 39 | This command generates static content into the `build` directory and can be served using any static contents hosting service. |
26 | 40 |
|
27 | | -## Deployment |
| 41 | +Note it may be necessary to increase Node.js max memory usage, e.g. to 8 GB |
| 42 | +```bash |
| 43 | +$env:NODE_OPTIONS="--max-old-space-size=8192" |
| 44 | +``` |
28 | 45 |
|
29 | | -Using SSH: |
| 46 | +## Serving static content |
| 47 | + |
| 48 | +Static content can be served using a static file server, such as [serve](https://www.npmjs.com/package/serve): |
30 | 49 |
|
31 | 50 | ```bash |
32 | | -USE_SSH=true yarn deploy |
| 51 | +npm run serve |
33 | 52 | ``` |
34 | 53 |
|
35 | | -Not using SSH: |
| 54 | +## Documentation structure |
| 55 | + |
| 56 | +The documentation is organized into two main directories |
| 57 | +- `docs`: Contains the documentation files for latest RavenDB version. |
| 58 | +- `versioned_docs`: Contains the documentation files for all other RavenDB versions. |
| 59 | + |
| 60 | +## Adding new version |
36 | 61 |
|
37 | 62 | ```bash |
38 | | -GIT_USER=<Your GitHub username> yarn deploy |
| 63 | +npm run docusaurus docs:version version_label |
39 | 64 | ``` |
40 | 65 |
|
41 | | -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
| 66 | +This command creates a new version of the documentation by adding `version-version_label` subdirectory to `versioned_docs` directory, which contains a snapshot of `docs` directory. |
| 67 | + |
| 68 | +## Modifying latest version |
| 69 | + |
| 70 | +To modify the latest version of the documentation, you can edit the files in the `docs` directory. |
| 71 | + |
| 72 | +Any changes made here will be reflected in the latest version of the documentation. |
| 73 | + |
| 74 | +## Modifying previous versions |
| 75 | + |
| 76 | +To modify a previous version of the documentation, you can edit the files in the `versioned_docs/version-version_label` directory. |
| 77 | + |
| 78 | +Versions are entirely separate, so changes made for one version will not affect other versions. |
| 79 | + |
| 80 | +## Docusaurus components |
| 81 | + |
| 82 | +- `Tabs` and `TabItem`: Create tabbed content for organizing related information. |
| 83 | + ```javascript |
| 84 | + <Tabs> |
| 85 | + <TabItem value="rql" label="RQL"> |
| 86 | + // RQL Query |
| 87 | + from Orders |
| 88 | + where Total > 100 |
| 89 | + </TabItem> |
| 90 | + <TabItem value="linq" label="LINQ"> |
| 91 | + // LINQ C# code |
| 92 | + var orders = session |
| 93 | + .Query<Order>() |
| 94 | + .Where(x => x.Total > 100) |
| 95 | + .ToList(); |
| 96 | + </TabItem> |
| 97 | + </Tabs> |
| 98 | + ``` |
| 99 | +- `CodeBlock`: Displays formatted code snippets with syntax highlighting. |
| 100 | + ```javascript |
| 101 | + <CodeBlock language="csharp"> |
| 102 | + {` |
| 103 | + // Call 'Execute' directly on the index instance |
| 104 | + new Orders_ByTotal().Execute(store); |
| 105 | + `} |
| 106 | + </CodeBlock> |
| 107 | + ``` |
| 108 | +- `Admonition`: Shows callout boxes for notes, warnings, tips, etc. |
| 109 | + ```javascript |
| 110 | + <Admonition type="note" title="Important"> |
| 111 | + Remember to back up your data before making major changes. |
| 112 | + </Admonition> |
| 113 | + ``` |
| 114 | +## Custom components |
| 115 | + |
| 116 | +Apart from the standard Docusaurus components, this documentation uses the following custom components |
| 117 | +- `LanguageSwitcher`: A component responsible for handling switching between different language versions of the documentation. Languages supported by particular document are stored in `supportedLanguages` array. |
| 118 | + ```javascript |
| 119 | + export const supportedLanguages = ["csharp", "java", "nodejs"]; |
| 120 | + |
| 121 | + <LanguageSwitcher supportedLanguages={supportedLanguages} /> |
| 122 | + ``` |
| 123 | +- `LanguageContent`: A component that displays documentation content based on the selected language. |
| 124 | + ```html |
| 125 | + <LanguageContent language="csharp"> |
| 126 | + <!-- Content specific to C# language --> |
| 127 | + </LanguageContent> |
| 128 | + ``` |
0 commit comments