Skip to content

Commit

Permalink
all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
goodroot committed Oct 3, 2023
1 parent 4bd4040 commit 94c1f73
Show file tree
Hide file tree
Showing 163 changed files with 27,478 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/netlify-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Prod deploy"

on:
push:
branches:
- master

jobs:
deploy:
name: "Deploy"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: "src"
ref: "main"
persist-credentials: false

- name: Checkout2
uses: actions/checkout@v3
with:
path: "dst"
ref: "main"
repository: "questdb/questdb.io"
token: ${{ secrets.DEPLOY_TOKEN }}
fetch-depth: 0
persist-credentials: true

- name: Copy common files to new repo
shell: bash
run: |
cp -rvT src/docs/* dst/docs/.
cp -v src/sidebars.js dst/sidebars.js
- name: Check For New Files
id: newFiles
shell: bash
working-directory: dest
run: |
git add -A
if [ $(git status --porcelain | wc -l) -gt 0 ]; then
echo "::set-output name=hasNewFiles::true"
else
echo "::set-output name=hasNewFiles::false"
fi
- name: Push New Files
if: ${{ steps.newFiles.outputs.hasNewFiles == 'true' }}
shell: bash
working-directory: dst
run: |
git config --global user.name "questbot [bot]"
git config --global user.email "${{ secrets.DEPLOY_TOKEN }}"
git commit -m "deploy: Updated docs from ref: ${GITHUB_REF}"
git push
59 changes: 59 additions & 0 deletions .github/workflows/netlify-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Preview deploy"

on:
pull_request:
types: ["opened", "edited", "synchronize"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
deploy:
if: ${{ github.event.label.name == 'run-ci' }}
name: "build on Netlify"
runs-on: ubuntu-latest

env:
ALGOLIA_API_KEY: ${{ vars.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ vars.ALGOLIA_APP_ID }}
GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID }}

steps:
- name: Checkout main website repo
uses: actions/checkout@v4
with:
repository: questdb/questdb.io
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
fetch-depth: 0
persist-credentials: true

- name: Checkout local docs
uses: actions/checkout@v3
with:
path: docs/.

- name: Move sidebars.js
run: |
mv docs/sidebars.js .
- uses: jsmrcaga/[email protected]
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

# Comment PR if preview was successful and NETLIFY_PREVIEW_URL is set
- name: "Update PR"
if: ${{ env.NETLIFY_PREVIEW_URL }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:rocket: **Build success!**
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}
Commit SHA: ${{ github.event.pull_request.head.sha }}
> :package: Build generates a preview & updates link on each commit.
comment_tag: execution
53 changes: 53 additions & 0 deletions docs/__guidelines/content-hierarchy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Content hierarchy
---

Documentation should follow a hierarchy, this is true both for the content and
how titles are organized. In most cases, you can refer to a template and reuse
the hierarchy exposed there. When you write a page that does not derive from a
template, please follow the guidelines exposed here.

## Content

When you need to show a command, please show it at the top of your page as much
as possible. This will ensure that users can easily copy/paste code without
having to scan the whole page.

It is okay to be very descriptive and thorough, however not every detail should
have the same weight. If you are documenting a function with many arguments,
please start with the most common ones first, gradually defining the ones that
people are less likely to use.

## Titles

Pages need to start with text, not a title. Titles should always follow the
following hierarchy:

```shell
h1 (title) > h2 (##) > h3 (###) > h4 (####)
```
This will improve readability and SEO. Example:
```markdown
## The first title should be H2

Then there should be some text

### Then further titles should be H3

Then ideally some text. Subsequent titles can then be used

#### For example H4

or even

##### For example H5

etc
```
## Bad practices
- Repetitive subtitles
- Too many Tip/Info/Warning. Please use maximum 1-2 per page.
14 changes: 14 additions & 0 deletions docs/__guidelines/influences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Influences
---

Writing documentation is hard, some projects tackle that problem in a very
elegant manner. You can find here the list of documentations that we find
greatly architectured, well written and pleasant to use:

- [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
(a.k.a. MDN)
- [Shopify](https://shopify.dev/concepts/about-apis/authentication)
- [Stripe](https://stripe.com/docs)

When looking for new ideas, it is recommended to look at those first.
23 changes: 23 additions & 0 deletions docs/__guidelines/lexicon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Lexicon
---

## Capitalization

Please refer to these terms using the **exact** same casing.

- InfluxDB line protocol
- Embedded Java API
- PostgreSQL wire protocol
- PGWire
- REST API (not HTTP API)
- Web Console

## Singular or plural?

- Data is treated as a singular noun.

## Spell checking

Please install and use a spell checker when editing markdown, this will prevent
common typos and make code reviews smoother.
116 changes: 116 additions & 0 deletions docs/__guidelines/markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: Markdown
---

This page describes elements and components from
[MDX](https://github.com/mdx-js/mdx) that we use and elements that we avoid.

## Supported elements / components

We use the following elements.

- No more than two blocks per page

### Note

:::note

This is something important the user should be aware of. But no danger. If the content of the note flows well with the main text, consider avoiding using the note block.

:::

### Tip

:::tip

Can be used to highlight nice tricks on a very occasional basis.

:::

### Caution

:::caution

Gives a warning about something dangerous.

:::

### Table

| table | table |
| ----- | ----- |
| value | value |
| value | value |

### "questdb-sql" code block

Title is optional.

```questdb-sql title="title"
SELECT * FROM users;
```

### Multi language code block

import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs defaultValue="sql" values={[
{ label: "SQL", value: "sql" },
{ label: "REST", value: "rest" },
{ label: "Java", value: "java" },
]}>

<TabItem value="sql">

```questdb-sql
SELECT * FROM users;
```

</TabItem>
<TabItem value="rest">

```shell
curl -G "http://localhost:13005/exec"
```

</TabItem>
<TabItem value="java">

```java
final CairoEngine engine = new CairoEngine();
```

</TabItem>

</Tabs>

### "Script" code block

Use the `script` language. The title is optional.

```shell
some shell command
```

## Elements / components to avoid

### Info

:::info

Not used because hard to differentiate from note

:::

### Warning

:::warning

Warning

:::

### Quote

> We don't use quotes
49 changes: 49 additions & 0 deletions docs/__guidelines/naming-convention.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Naming convention
---

Our conventions improve consistency and ensure that we have optimal SEO.

## New page

### File name

`file-name.md` (kebab-case, no uppercase here, the same rule applies to blog
posts)

### Title

`A descriptive title` (No Pascal Case)

### Markdown attributes

- `id`: please do NOT set the `id`, Docusaurus will automatically compute it
from the file path and name.
- `sidebar_label`: `Custom name`, do not set if it is the same as title,
Docusaurus will automatically fallback to it.

## Images

Images should always be inserted in markdown, not HTML:

```shell
[Image description](path/to/img.jpg)
```

The description is important, it will populate the `alt` attribute which
improves SEO.

## Links

Links should always be inserted in markdown, not HTML:

```shell
[link text](https://path/to/resource.html)
```

:::caution

Please use **meaningful** wording for the link text, content such as "here" or
"click here" is forbidden since it will negatively impact SEO.

:::
Loading

0 comments on commit 94c1f73

Please sign in to comment.