Skip to content

Commit 2d17402

Browse files
authored
[docs] Move docs pages to this repo (#165)
## Summary Move docs pages to this repo. - [x] yarn start locally - [x] CICD preview TODOs: in separate PRs - linters - devbox.json for quick local dev - quick start readme on how to contribute ## How was it tested? `yarn install` `yarn build` `yarn start`
1 parent 8d59aa6 commit 2d17402

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9569
-0
lines changed

.github/workflows/deployment.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: docs-deployment
2+
3+
concurrency: deployment
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
11+
env:
12+
JETPACK_SECRET_KEY: ${{ secrets.JETPACK_SECRET_KEY }}
13+
14+
jobs:
15+
deploy-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: dorny/paths-filter@v2
20+
id: filter
21+
with:
22+
filters: |
23+
docs:
24+
- 'docs/**'
25+
- uses: bahmutov/npm-install@v1
26+
if: steps.filter.outputs.docs == 'true' || github.event.workflow_dispatch
27+
with:
28+
working-directory: docs/app
29+
- name: Mount docs node_modules
30+
if: steps.filter.outputs.docs == 'true' || github.event.workflow_dispatch
31+
uses: actions/cache@v3
32+
with:
33+
path: docs/app/node_modules
34+
key: docs-node-modules
35+
- name: docs build
36+
if: steps.filter.outputs.docs == 'true' || github.event.workflow_dispatch
37+
run: |
38+
yarn install
39+
yarn run build
40+
working-directory: docs/app
41+
- name: Deploy docs to production
42+
if: steps.filter.outputs.docs == 'true' || github.event.workflow_dispatch
43+
run: |
44+
curl https://get.jetpack.io -fsSL | bash -s -- -y
45+
jetpack up docs --environment=prod --debug

.github/workflows/previews.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: docs-preview
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches-ignore:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
env:
14+
JETPACK_SECRET_KEY: ${{ secrets.JETPACK_SECRET_KEY }}
15+
16+
jobs:
17+
deploy-docs-preview:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: dorny/paths-filter@v2
22+
id: filter
23+
with:
24+
filters: |
25+
docs:
26+
- 'docs/**'
27+
- uses: bahmutov/npm-install@v1
28+
if: steps.filter.outputs.docs == 'true'
29+
with:
30+
working-directory: docs/app
31+
- name: Mount docs node_modules
32+
if: steps.filter.outputs.docs == 'true'
33+
uses: actions/cache@v3
34+
with:
35+
path: docs/app/node_modules
36+
key: docs-node-modules
37+
- name: Docs build
38+
if: steps.filter.outputs.docs == 'true'
39+
run: |
40+
yarn install
41+
yarn run build
42+
working-directory: docs/app
43+
- name: Deploy docs preview
44+
if: steps.filter.outputs.docs == 'true'
45+
run: |
46+
curl https://get.jetpack.io -fsSL | bash -s -- -y
47+
jetpack up docs \
48+
--ttl 300 --debug \
49+
-n jetpack-io-preview-$(echo "${GITHUB_REF_NAME}" | sed "s/[^0-9a-zA-Z]/-/g")

docs/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
app/build/Release
2+
app/.docusaurus
3+
app/node_modules

docs/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
app/node_modules/
3+
4+
# Production
5+
app/build/
6+
7+
# Generated files
8+
app/.docusaurus/
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
app/.yarn/*
23+
!app/.yarn/patches
24+
!app/.yarn/plugins
25+
!app/.yarn/releases
26+
!app/.yarn/sdks
27+
!app/.yarn/versions
28+
# If we want to start checking in the cache to enable 'zero install':
29+
# !app/.yarn/cache

docs/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# syntax=docker/dockerfile:1
2+
FROM nginx:stable-alpine as deploy
3+
WORKDIR /app
4+
EXPOSE 80
5+
COPY ./app/build ./static/devbox/
6+
COPY ./nginx.conf /etc/nginx/nginx.conf

docs/app/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/app/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
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.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
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.

docs/app/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

docs/app/docs/cli_reference.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: CLI Reference
3+
sidebar_position: 4
4+
---
5+
6+
## add
7+
8+
Add Nix packages to your devbox project. To see a list of available packages, you can use [Nix Package Search](https://search.nixos.org/packages). Added packages are stored in `devbox.json`
9+
10+
For example the following will add Python 3.10 to your `devbox.json`
11+
12+
```nix
13+
devbox add python310
14+
```
15+
16+
You can add multiple packages in a single command:
17+
18+
```nix
19+
devbox add python310 curl
20+
```
21+
22+
## build
23+
24+
Builds your current source directory and devbox configuration as a Docker container. Devbox will create a plan for your container based on your source code, and then apply the packages and stage overrides in your `devbox.json`.
25+
26+
## init
27+
28+
Initializes a devbox project by creating a blank `devbox.json` file in your directory.
29+
30+
## plan
31+
32+
Shows the current plan that devbox will use to create your shell and build your project.
33+
34+
This will include any install/build/run commands that devbox has automatically detected, or that you have included in your devbox.json (see [Configuration Guide](../configuration) for more details)
35+
36+
## rm
37+
38+
Removes packages from your devbox.json.
39+
40+
## shell
41+
42+
Starts an isolated nix shell with the packages and configuration in your local `devbox.json`.
43+
44+
Any packages in your devbox.json that have not been previously installed will be downloaded and installed in your machine, and made available while your shell is running.

docs/app/docs/configuration.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: Configuration Guide
3+
sidebar_position: 5
4+
---
5+
6+
Your devbox configuration is stored in a `devbox.json` file, located in your project's root directory. This file can be edited directly, or using the [devbox CLI](cli_reference.md).
7+
8+
```json
9+
{
10+
"packages": [],
11+
"shell": {
12+
"init_hook": "..."
13+
},
14+
"install_stage": {
15+
"command": "..."
16+
},
17+
"build_stage":{
18+
"command":"..."
19+
},
20+
"start_stage": {
21+
"command": "..."
22+
}
23+
}
24+
```
25+
26+
### Packages
27+
28+
This is a list of Nix packages that should be installed in your Devbox shell and containers. These packages will only be installed and available within your shell, and will have precedence over any packages installed in your local machine. You can search for Nix packages using [Nix Package Search](https://search.nixos.org/packages).
29+
30+
You can add packages to your devbox.json using `devbox add <package_name>`, and remove them using `devbox rm <package_name>`
31+
32+
### Shell
33+
34+
You can configure `devbox shell` to run a custom commands at startup by setting an `init_hook`. This hook runs after any other `~/.*rc` scripts, allowing you to override environment variables or further customize the shell.
35+
36+
This is an example `devbox.json` that customizes the prompt and prints a welcome message:
37+
38+
```json
39+
{
40+
"shell": {
41+
"init_hook": "export PS1='📦 devbox> '\necho 'Welcome! See CONTRIBUTING.md for tips on contributing to devbox.'"
42+
}
43+
}
44+
```
45+
46+
When run, you'll see:
47+
48+
```
49+
> devbox shell
50+
Installing nix packages. This may take a while...
51+
Starting a devbox shell...
52+
Welcome! See CONTRIBUTING.md for tips on contributing to devbox.
53+
📦 devbox>
54+
```
55+
56+
### Stages
57+
58+
Stages are used to configure and run commands at different points of container creation. For languages that support autodetction, Devbox will automatically detect and configure the correct stage commands for your project based on your source code. You can override any of these stages by configuring them in your devbox.json
59+
60+
* The **install stage** will run after your base container has been initialized and your Nix packages are installed. This stage should be used to download and build your application's dependencies
61+
* The **build stage** runs after the install stage, and should be used to build or bundle your application.
62+
* The **start stage** will run when your container is started. This stage should include any commands needed to start and run your application.
63+
64+
Each stage takes a single command that will be run when the stage is reached in your container build.
65+
66+
```json
67+
//Install stage command for a Node Project
68+
"install_stage": {
69+
"command": "yarn install"
70+
}
71+
```
72+
73+
### Example: A Rust Devbox
74+
75+
An example of a devbox configuration for a Rust project called `hello_world` might look like the following:
76+
77+
```json
78+
{
79+
"packages": [
80+
"rustc"
81+
"cargo",
82+
"libiconv",
83+
],
84+
"install_stage": {
85+
"command": "cargo install --path ."
86+
},
87+
"build_stage":{
88+
"command":"cargo build"
89+
},
90+
"start_stage": {
91+
"command": "./target/build/hello_world"
92+
}
93+
}
94+
```

0 commit comments

Comments
 (0)