Skip to content

Commit 15f1669

Browse files
authored
docs: introduce documentation website (#2279)
* docs: introduce documentation website * chore: remove temporary fix for CVE-2023-45857 * docs: migrate translations * ci: add website lint rules and tests * ci: change website test name * docs: create a temporary favicon * docs: migrate examples * docs: migrate examples to `.mdx` * docs: enable highlights for json code blocks * docs: improve highlights * docs: introduce `History` component * docs: introduce `Stability` component * docs: simplify SCSS * docs: improve `Stability` component * docs: upgrade links to HTTPS * docs: fix `History` units * docs: create "Stability Badges" page * docs: introduce FAQ component and page * docs: improve styles * docs: create website Contributing page * docs: polish the documentation website
1 parent 489154f commit 15f1669

File tree

87 files changed

+23374
-0
lines changed

Some content is hidden

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

87 files changed

+23374
-0
lines changed

Diff for: .eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
website/build
2+
website/.docusaurus
3+
website/.cache-loader
4+
website/**/*.mdx

Diff for: .github/workflows/gh-pages.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'GitHub Pages'
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- 'website/**'
8+
workflow_dispatch:
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Actions - Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Actions - Setup NodeJS
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '18.x'
21+
22+
- name: Cache Dependencies
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.npm
26+
key: npm-${{ hashFiles('package-lock.json') }}
27+
restore-keys: npm-
28+
29+
- name: Installing Dependencies
30+
run: cd website && npm ci
31+
32+
- name: Checking Types
33+
run: cd website && npm run typecheck
34+
35+
- name: Building Site
36+
run: cd website && npm run build
37+
38+
- name: Deploy
39+
uses: peaceiris/actions-gh-pages@v3
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
publish_dir: ./website/build

Diff for: .github/workflows/website.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'CI - Website'
2+
on:
3+
pull_request:
4+
paths:
5+
- 'website/**'
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Actions - Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Actions - Setup NodeJS
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '18.x'
19+
20+
- name: Cache Dependencies
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.npm
24+
key: npm-${{ hashFiles('package-lock.json') }}
25+
restore-keys: npm-
26+
27+
- name: Installing Dependencies
28+
run: cd website && npm ci
29+
30+
- name: Lint Checking
31+
run: cd website && npm run lintcheck
32+
33+
- name: Checking Types
34+
run: cd website && npm run typecheck
35+
36+
- name: Checking Build
37+
run: cd website && npm run build

Diff for: .prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
website/build
2+
website/.docusaurus
3+
website/.cache-loader
4+
website/**/*.mdx

Diff for: website/.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/build
2+
/.docusaurus
3+
/.cache-loader
4+
/**/*.mdx

Diff for: website/.eslintrc.json

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "import", "react", "react-hooks"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:import/errors",
9+
"plugin:import/warnings",
10+
"plugin:react-hooks/recommended",
11+
"plugin:react/jsx-runtime"
12+
],
13+
"parserOptions": {
14+
"ecmaVersion": "latest",
15+
"sourceType": "module",
16+
"ecmaFeatures": {
17+
"jsx": true
18+
}
19+
},
20+
"rules": {
21+
"import/no-cycle": ["error", { "maxDepth": "" }],
22+
"import/no-unresolved": ["error", { "ignore": ["^@docusaurus/"] }],
23+
"no-restricted-syntax": [
24+
"error",
25+
{
26+
"selector": "ImportDeclaration[source.value=/^\\./][source.value!=/\\.(js(on(c)?)?|(s)?css|svg|ico)$/]",
27+
"message": "Local imports must have the explicit extension"
28+
}
29+
],
30+
"max-len": [
31+
"error",
32+
{
33+
"code": 120,
34+
"ignoreComments": true,
35+
"ignoreTrailingComments": true,
36+
"ignoreUrls": true,
37+
"ignoreStrings": true,
38+
"ignoreTemplateLiterals": true,
39+
"ignoreRegExpLiterals": true
40+
}
41+
],
42+
"eol-last": ["error", "always"],
43+
"eqeqeq": [2, "always"],
44+
"no-var": 2,
45+
"block-scoped-var": 2,
46+
"no-async-promise-executor": 2,
47+
"no-bitwise": [2, { "allow": ["~"] }],
48+
"no-duplicate-imports": [2, { "includeExports": true }],
49+
"no-eq-null": 2,
50+
"no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 0 }],
51+
"no-template-curly-in-string": 2,
52+
"no-unneeded-ternary": 2,
53+
"quote-props": [2, "as-needed"],
54+
"require-await": 2,
55+
"rest-spread-spacing": [2, "never"],
56+
"semi-spacing": 2,
57+
"space-before-function-paren": [
58+
2,
59+
{ "anonymous": "always", "named": "never", "asyncArrow": "always" }
60+
],
61+
"space-unary-ops": 2,
62+
"yoda": 2,
63+
"no-const-assign": 2,
64+
"no-extra-semi": 2,
65+
"for-direction": 2,
66+
"no-eval": 2,
67+
"indent": ["error", 2, { "offsetTernaryExpressions": true }],
68+
"no-empty": ["error", { "allowEmptyCatch": true }]
69+
},
70+
"env": {
71+
"browser": true,
72+
"node": true
73+
},
74+
"overrides": [
75+
{
76+
"files": ["*.ts", "*.tsx"],
77+
"rules": {
78+
"@typescript-eslint/semi": ["error", "always"],
79+
"@typescript-eslint/quotes": [
80+
"error",
81+
"single",
82+
{ "avoidEscape": true, "allowTemplateLiterals": true }
83+
],
84+
"@typescript-eslint/no-empty-function": [
85+
"error",
86+
{ "allow": ["arrowFunctions"] }
87+
],
88+
"@typescript-eslint/indent": [
89+
"error",
90+
2,
91+
{ "offsetTernaryExpressions": true }
92+
]
93+
}
94+
},
95+
{
96+
"files": ["*.js"],
97+
"parserOptions": {
98+
"project": null
99+
},
100+
"rules": {
101+
"semi": ["error", "always"],
102+
"quotes": [
103+
"error",
104+
"single",
105+
{ "avoidEscape": true, "allowTemplateLiterals": true }
106+
],
107+
"no-unused-vars": 2
108+
}
109+
},
110+
{
111+
"files": ["static/**/*"],
112+
"rules": {
113+
"import/no-unresolved": "off",
114+
"@typescript-eslint/no-var-requires": "off",
115+
"@typescript-eslint/no-unused-vars": "off",
116+
"no-unused-vars": "off",
117+
"no-bitwise": "off"
118+
}
119+
}
120+
],
121+
"settings": {
122+
"import/resolver": {
123+
"typescript": {
124+
"alwaysTryTypes": true,
125+
"extensions": [".js", ".ts", "*.jsx", ".tsx"]
126+
}
127+
}
128+
}
129+
}

Diff for: website/.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
i18n/**/docusaurus-theme-classic/navbar.json
11+
i18n/**/code.json
12+
13+
# Misc
14+
.DS_Store
15+
.env.local
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
19+
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*

Diff for: website/.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/build
2+
/.docusaurus
3+
/.cache-loader
4+
# /**/*.mdx
5+
package-lock.json

Diff for: website/.prettierrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"quoteProps": "as-needed",
7+
"jsxSingleQuote": true,
8+
"trailingComma": "es5",
9+
"bracketSpacing": true,
10+
"bracketSameLine": false,
11+
"arrowParens": "always",
12+
"proseWrap": "preserve",
13+
"htmlWhitespaceSensitivity": "css",
14+
"endOfLine": "auto",
15+
"embeddedLanguageFormatting": "auto",
16+
"singleAttributePerLine": false
17+
}

Diff for: website/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```bash
8+
npm i
9+
```
10+
11+
### Local Development
12+
13+
```bash
14+
npm 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+
```bash
22+
npm run build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.

Diff for: website/babel.config.js

+3
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+
};

Diff for: website/docs/acknowledgements.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Acknowledgements
2+
3+
- Internal protocol is written by @sidorares [MySQL-Native](https://github.com/sidorares/nodejs-mysql-native)
4+
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [node-mysql](https://github.com/mysqljs/mysql)
5+
- SSL upgrade code based on @TooTallNate [code](https://gist.github.com/TooTallNate/848444)
6+
- Secure connection / compressed connection api flags compatible to [MariaSQL](https://github.com/mscdex/node-mariasql/) client.
7+
- [Contributors](https://github.com/sidorares/node-mysql2/graphs/contributors)

Diff for: website/docs/api-and-configurations.mdx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# API and Configuration
2+
3+
MySQL2 is mostly API compatible with [Node MySQL][node-mysql].
4+
5+
One known incompatibility is that `DECIMAL` values are returned as strings whereas in [Node MySQL][node-mysql] they are returned as numbers. This includes the result of `SUM()` and `AVG()` functions when applied to `INTEGER` arguments. This is done deliberately to avoid loss of precision - see https://github.com/sidorares/node-mysql2/issues/935.
6+
7+
:::info
8+
If you find any other incompatibility with [Node MySQL][node-mysql], Please report via Issue tracker. We will fix reported incompatibility on priority basis.
9+
:::
10+
11+
[node-mysql]: https://github.com/mysqljs/mysql

Diff for: website/docs/contributing/00-index.mdx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
slug: /contributing
3+
title: MySQL2
4+
---
5+
6+
import { PageTitle } from '@site/src/components/PageTitle';
7+
8+
<PageTitle title='Contributing' />
9+
10+
# Contributing
11+
12+
Want to improve something in **MySQL2**?
13+
Please check [Contributing.md](https://github.com/sidorares/node-mysql2/blob/master/Contributing.md) for detailed instruction on how to get started.

0 commit comments

Comments
 (0)