2022-09-21 17:43:49 +02:00
# OpenAIRE Graph Documentation
2022-09-01 09:26:04 +02:00
2022-09-20 18:25:30 +02:00
This website is built using [Docusaurus 2 ](https://docusaurus.io/ ); please check [here ](https://docusaurus.io/docs/installation#requirements ) the requirements to run the project.
2022-09-01 09:26:04 +02:00
2023-04-14 14:20:21 +02:00
## Local installation and development
2022-09-01 09:26:04 +02:00
2022-12-14 14:23:22 +01:00
From https://docusaurus.io/docs/installation#requirements
> Node.js version 16.14 or above (which can be checked by running node -v)
2023-04-14 14:20:21 +02:00
Clone the repository:
```
git clone https://code-repo.d4science.org/D-Net/openaire-graph-docs.git
```
NOTE: please use git branches for introducing new changes.
2022-12-14 14:23:22 +01:00
2023-04-14 14:20:21 +02:00
Install the required packages:
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:13:04 +02:00
npm install
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:20:21 +02:00
Start a local development server (opens in a new browser window).
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:13:04 +02:00
npm run start
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:20:21 +02:00
NOTE: most changes are reflected live without having to restart the server.
2022-09-01 09:26:04 +02:00
2023-04-19 14:39:27 +02:00
Before issuing a Pull Request, please ensure that the following command runs successfully:
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:13:04 +02:00
npm run build
2022-09-01 09:26:04 +02:00
```
2023-04-14 14:20:21 +02:00
NOTE: This command generates the static content into the `build` directory.
Then this output directory is issued to deploy the documentation website.
2022-09-01 09:26:04 +02:00
2022-09-29 18:00:42 +02:00
## Deployment using Docker
2022-10-13 19:52:52 +02:00
### Development
Build docker container for development and run on port 3000:
```
docker build --target development -t docs:dev .
sudo docker run -d -p 3000:3000 docs:dev
```
### Production
Build docker container for production and run on port 80:
```
docker build -t docs:latest .
docker run -d -p 80:80 docs:latest
```
2022-09-29 18:00:42 +02:00
## Documentation versioning
The versioning documentation of Docusaurus can be found [here ](https://docusaurus.io/docs/versioning ).
Specifically, a new version can be created with the following command:
```
npm run docusaurus docs:version < versionName >
```
When tagging a new version, the document versioning mechanism will:
2022-09-01 09:26:04 +02:00
2022-09-29 18:00:42 +02:00
* Copy the full `docs/` folder contents into a new `versioned_docs/version-<versionName>/` folder.
* Create a versioned sidebars file based from your current sidebar configuration, saved as `versioned_sidebars/version-<versionName>-sidebars.json` .
* Append the new version number to `versions.json` .
2023-03-09 15:00:45 +01:00
Therefore, when previewing the compiled site locally with `npm run start` , ensure to visualise the `Next` version on the browser as it shows the changes under `/docs` .
To change a version that was already versioned, the source files to be modified are in the `versioned_docs/version-<versionName>/` folder.