Skip to content
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

Move setup commands into package.json #808

Merged
merged 14 commits into from
Oct 5, 2023
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/hugo:1": {
"version": "0.102.3",
"version": "0.117.0",
"extended": true
},
"ghcr.io/devcontainers/features/node:1": {}
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ else
fi

## Download Bicep extension
curl https://get.radapp.dev/tools/vscode-extensibility/$RADIUS_VERSION/rad-vscode-bicep.vsix --output /tmp/rad-vscode-bicep.vsix
curl https://get.radapp.dev/tools/vscode-extensibility/$RADIUS_VERSION/rad-vscode-bicep.vsix --output /tmp/rad-vscode-bicep.vsix
22 changes: 2 additions & 20 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
#!/bin/bash

# Initialize submodules
git submodule update --init --recursive

# Clone radius repo
git clone https://github.com/radius-project/radius.git

# Install dependencies
pushd ./docs
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
cd themes/docsy
# Initialize docs package
pushd docs
npm install
popd

# Generate CLI docs
pushd ./radius
go run ./cmd/docgen/main.go ../docs/content/reference/cli
popd

# Generate Swagger docs
mkdir -p ./docs/static/swagger
cp -r ./radius/swagger ./docs/static/
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run docs server",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/docs",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"start"
],
"preLaunchTask": "npm install"
},
{
"name": "Build docs",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/docs",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"build"
],
"preLaunchTask": "npm ci"
}
]
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "npm install",
"type": "shell",
"command": "npm install",
"options": {
"cwd": "${workspaceFolder}/docs"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "npm ci",
"type": "shell",
"command": "npm install",
"options": {
"cwd": "${workspaceFolder}/docs"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
54 changes: 23 additions & 31 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,52 @@
# Radius documentation

This directory contains the files to generate the https://radapp.dev site. Please go there to consume Radius docs. This document will describe how to build Radius docs locally.
This directory contains the files to generate the https://docs.radapp.dev site. Please go there to consume Radius docs. This document will describe how to build Radius docs locally.

## Codespace

The easiest way to get up and runnning with a docs environment is a GitHub codespace. Visit [this link]() to get up and running in minutes.
The easiest way to get up and runnning with a docs environment is a GitHub codespace.

1. Open codespace
2. Ensure postCreate script has completed (takes ~2 minutes to build CLI docs)
3. `cd docs` to change into the docs directory
4. `hugo server` to run a docs server
2. Ensure postCreate script has completed (takes ~2 minutes)
3. Run `cd docs` to change into the docs directory
4. Run `npm run start` to run a docs server
5. Click the `localhost:1313` link in your terminal to open the Codespace tunnel to the page

## Pre-requisites
## Local machine

### Pre-requisites

- [Hugo extended version](https://gohugo.io/getting-started/installing)
- [Node.js](https://nodejs.org/en/)

## Environment setup
### Environment setup

1. Ensure pre-requisites are installed
2. Clone this repository and the radius repository
1. Clone this repository:
```sh
git clone https://github.com/radius-project/radius.git
git clone https://github.com/radius-project/docs.git
```
3. Generate CLI docs:
```sh
pushd radius
go run ./cmd/docgen/main.go ../docs/docs/content/reference/cli
popd
```
4. Change to docs directory:
1. Change to docs directory:
```sh
cd docs/docs
```
5. Update submodules:
```sh
git submodule update --init --recursive
```
6. Install npm packages:
1. Install npm packages:
```sh
npm install
```
7. Install Docsy dependencies

### Run local server

1. Make sure you're still in the `docs/docs` directory
1. Run:
```sh
pushd ./themes/docsy
sudo npm install
popd
npm run start
```
1. Navigate to `http://localhost:1313/`

## Run local server
### Build website

1. Make sure you're still in the `docs/docs` directory
2. Run
1. Run:
```sh
hugo server
npm run build
```
3. Navigate to `http://localhost:1313/`
1. Docs website will be generated under `docs/public`
Loading
Loading