Skip to content

Commit f0e3d06

Browse files
authored
Add docs markdown linter and readme (#166)
## Summary Add docs markdown linter and readme ## How was it tested? CICD + preview
1 parent be18cb9 commit f0e3d06

File tree

10 files changed

+196
-133
lines changed

10 files changed

+196
-133
lines changed

.github/workflows/previews.yaml

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,53 @@ env:
1414
JETPACK_SECRET_KEY: ${{ secrets.JETPACK_SECRET_KEY }}
1515

1616
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
17+
markdown-lint:
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+
- name: markdownlint-cli
28+
uses: nosborn/[email protected]
29+
with:
30+
files: docs/app/docs
31+
config_file: docs/.markdownlint.yaml
32+
33+
deploy-to-preview:
34+
runs-on: ubuntu-latest
35+
needs: markdown-lint
36+
steps:
37+
- uses: actions/checkout@v3
38+
- uses: dorny/paths-filter@v2
39+
id: filter
40+
with:
41+
filters: |
42+
docs:
43+
- 'docs/**'
44+
- uses: bahmutov/npm-install@v1
45+
if: steps.filter.outputs.docs == 'true'
46+
with:
4247
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")
48+
- name: Mount docs node_modules
49+
if: steps.filter.outputs.docs == 'true'
50+
uses: actions/cache@v3
51+
with:
52+
path: docs/app/node_modules
53+
key: docs-node-modules
54+
- name: Docs build
55+
if: steps.filter.outputs.docs == 'true'
56+
run: |
57+
yarn install
58+
yarn run build
59+
working-directory: docs/app
60+
- name: Deploy docs preview
61+
if: steps.filter.outputs.docs == 'true'
62+
run: |
63+
curl https://get.jetpack.io -fsSL | bash -s -- -y
64+
jetpack up docs \
65+
--ttl 300 --debug \
66+
-n jetpack-io-preview-$(echo "${GITHUB_REF_NAME}" | sed "s/[^0-9a-zA-Z]/-/g")

docs/.markdownlint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Autoformatter friendly markdownlint config (all formatting rules disabled)
2+
default: true
3+
blank_lines: false
4+
bullet: false
5+
html: false
6+
indentation: false
7+
line_length: false
8+
spaces: false
9+
url: false
10+
whitespace: false

docs/app/README.md renamed to docs/README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta
55
### Installation
66

77
```
8-
$ yarn
8+
$ cd docs/app # from the devbox root directory
9+
$ devbox shell # optional, develop inside a devbox
10+
$ yarn install # run in devbox shell
911
```
1012

1113
### Local Development
@@ -26,16 +28,6 @@ This command generates static content into the `build` directory and can be serv
2628

2729
### Deployment
2830

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.
31+
When a pull request is opened, it will automatically deploy via CICD to a preview.
32+
When a pull request is merged, it will automatically deploy to production.
33+
Check https://www.jetpack.io/devbox/ after merge to see the latest changes.

docs/app/devbox.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"packages": [],
3+
"shell": {
4+
"init_hook": null
5+
}
6+
}

docs/app/docs/configuration.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Your devbox configuration is stored in a `devbox.json` file, located in your pro
1414
"install_stage": {
1515
"command": "..."
1616
},
17-
"build_stage":{
18-
"command":"..."
17+
"build_stage": {
18+
"command": "..."
1919
},
2020
"start_stage": {
2121
"command": "..."
@@ -45,7 +45,7 @@ This is an example `devbox.json` that customizes the prompt and prints a welcome
4545

4646
When run, you'll see:
4747

48-
```
48+
```text
4949
> devbox shell
5050
Installing nix packages. This may take a while...
5151
Starting a devbox shell...
@@ -57,9 +57,9 @@ Welcome! See CONTRIBUTING.md for tips on contributing to devbox.
5757

5858
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
5959

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.
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.
6363

6464
Each stage takes a single command that will be run when the stage is reached in your container build.
6565

docs/app/docs/installing_devbox.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ In addition to installing Devbox itself, you will need to install nix and docker
1111

1212
2. Install [Docker Engine](https://docs.docker.com/engine/install/) or [Docker Desktop](https://www.docker.com/get-started/). Note that docker is only needed if you want to create containers – the shell functionality works without it.
1313

14-
## Install Devbox:
14+
## Install Devbox
1515

1616
Use the following install script to get the latest version of Devbox:
1717

18-
```
18+
```bash
1919
curl -fsSL https://get.jetpack.io/devbox | bash
20-
```
20+
```

docs/app/docs/language_support/nginx.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ Devbox will use the nginx provided by the Nix Package manager. It is currently n
2121

2222
### Included Nix Packages
2323

24-
- `nginx`
24+
- `nginx`
2525

2626
### Default Stages
2727

2828
These stages can be customized by adding them to your `devbox.json`. See the [Configuration Guide](../configuration.md) for more details
2929

3030
### Install Stage
3131

32-
*No install stage for nginx planner*
32+
Skipped: _No install stage for nginx planner_
3333

3434
### Build Stage
3535

36-
*No build stage for nginx planner*
36+
Skipped: _No build stage for nginx planner_
3737

3838
### Start Stage
3939

4040
```bash
4141
nginx -c <your_config> -g 'daemon off;'
42-
```
42+
```

docs/app/docs/language_support/nodejs.md

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,89 @@ Devbox will automatically create a NodeJs Build plan whenever a `package.json` f
99
### Supported Versions
1010

1111
Devbox will attempt to detect the Node version set in your `package.json` file. The following major versions are supported (Devbox will always use the latest minor version for each major version):
12-
* 10
13-
* 12
14-
* 16
15-
* 18
12+
13+
- 10
14+
- 12
15+
- 16
16+
- 18
1617

1718
If no version is set, Devbox will use 16 as the default version
1819

1920
### Included Nix Packages
2021

21-
* Depending on the detected Node Version:
22-
* `nodejs`
23-
* `nodejs10_x`
24-
* `nodejs12_x`
25-
* `nodejs16_x`
26-
* `nodejs18_x`
27-
* If a `package-lock.json` is detected, or if no lockfile is detected:
28-
* `npm`
29-
* If a `yarn.lock` file is detected:
30-
* `yarn`
31-
22+
- Depending on the detected Node Version:
23+
- `nodejs`
24+
- `nodejs10_x`
25+
- `nodejs12_x`
26+
- `nodejs16_x`
27+
- `nodejs18_x`
28+
- If a `package-lock.json` is detected, or if no lockfile is detected:
29+
- `npm`
30+
- If a `yarn.lock` file is detected:
31+
- `yarn`
3232

3333
### Default Stages
3434

3535
These stages can be customized by adding them to your `devbox.json`. See the [Configuration Guide](../configuration.md) for more details
36-
#### Install Stage
36+
37+
### Install Stage
3738

3839
If a `package-lock.json` is detected:
40+
3941
```bash
4042
npm install
4143
```
4244

43-
If a `yarn.lock` is detected:
45+
If a `yarn.lock` is detected:
46+
4447
```bash
4548
yarn install
4649
```
4750

48-
Otherwise:
51+
Otherwise:
4952

5053
```bash
5154
npm install
5255
```
5356

54-
#### Build Stage
57+
### Build Stage
58+
59+
This stage will copy over the rest of your project files.
60+
61+
If a `package-lock.json` is detected and a `build` script is found in `package.json`:
62+
63+
```bash
64+
npm run build && npm prune --production
65+
```
66+
67+
If a `yarn.lock` is detected and a `build` script is found in `package.json`:
5568

56-
This stage will copy over the rest of your project files, but will not run a command.
69+
```bash
70+
yarn build && yarn install --production --ignore-scripts --prefer-offline
71+
```
5772

58-
#### Start Stage
73+
Otherwise, we simply remove the dev packages:
74+
75+
```bash
76+
npm prune --production
77+
```
78+
79+
### Start Stage
80+
81+
If a `package-lock.json` is detected and a `start` script is found in `package.json`:
82+
83+
```bash
84+
npm start
85+
```
86+
87+
If a `yarn.lock` is detected and a `start` script is found in `package.json`:
88+
89+
```bash
90+
yarn start
91+
```
92+
93+
Otherwise:
5994

6095
```bash
6196
node index.js
62-
```
97+
```

docs/app/docs/language_support/php.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ title: PHP
44

55
### Detection
66

7-
Devbox will automatically create a PHP Build plan whenever a `composer.json` or `composer.lock` file is detected in the project's root directory.
7+
Devbox will automatically create a PHP Build plan whenever a `composer.json` or `composer.lock` file is detected in the project's root directory.
88

9-
Building a container with Devbox also requires a `public/index.php` file in your project directory. Running `devbox build` will return an error if one is not found.
9+
Building a container with Devbox also requires a `public/index.php` file in your project directory. Running `devbox build` will return an error if one is not found.
1010

1111
### Supported Versions
1212

1313
Devbox will attempt to detect the PHP version set in your `composer.json` file. The following major versions are supported (Devbox will always use the latest minor version for each major version):
14-
* 7.4
15-
* 8.0
16-
* 8.1
14+
15+
- 7.4
16+
- 8.0
17+
- 8.1
1718

1819
If no version is set, Devbox will use 8.1 as the default version
1920

2021
### Included Nix Packages
2122

22-
* Depending on the detected PHP Version:
23-
* `php81`
24-
* `php80`
25-
* `php74`
26-
* `phpPackages.composer`
27-
23+
- Depending on the detected PHP Version:
24+
- `php81`
25+
- `php80`
26+
- `php74`
27+
- `phpPackages.composer`
2828

2929
### Default Stages
3030

@@ -36,10 +36,9 @@ These stages can be customized by adding them to your `devbox.json`. See the [Co
3636
composer install --no-dev --no-ansi
3737
```
3838

39-
4039
#### Build Stage
4140

42-
*This stage is skipped for PHP projects*
41+
Skipped: _This stage is skipped for PHP projects_
4342

4443
#### Start Stage
4544

0 commit comments

Comments
 (0)