@rawsql-ts/ddl-docs-vitepress 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -105
- package/dist/cli.js +29 -29
- package/dist/index.js +0 -0
- package/package.json +50 -46
- package/templates/.github/workflows/deploy-docs.yml +53 -53
- package/templates/docs/.vitepress/config.mts +12 -12
- package/templates/docs/.vitepress/theme/custom.css +13 -13
- package/templates/docs/.vitepress/theme/index.ts +4 -4
- package/templates/docs/index.md +31 -31
- package/templates/gitignore +4 -4
- package/templates/package.json +18 -18
- package/templates/scripts/run-generate.cjs +39 -39
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MSugiura
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
# @rawsql-ts/ddl-docs-vitepress
|
|
2
|
-
|
|
3
|
-
A scaffold generator for VitePress-based database schema documentation sites.
|
|
4
|
-
|
|
5
|
-
This package provides the `ddl-docs-vitepress init` command, which creates a ready-to-use project template that:
|
|
6
|
-
|
|
7
|
-
- reads SQL files from `ddl/`
|
|
8
|
-
- generates Markdown docs via `@rawsql-ts/ddl-docs-cli`
|
|
9
|
-
- serves/builds a VitePress site from `docs/`
|
|
10
|
-
|
|
11
|
-
## Generated project structure
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
my-db-docs/
|
|
15
|
-
├── .github/workflows/deploy-docs.yml # GitHub Pages deploy workflow
|
|
16
|
-
├── .gitignore
|
|
17
|
-
├── ddl/.gitkeep # Place your .sql files here
|
|
18
|
-
├── docs/
|
|
19
|
-
│ ├── index.md
|
|
20
|
-
│ └── .vitepress/
|
|
21
|
-
│ ├── config.mts
|
|
22
|
-
│ └── theme/
|
|
23
|
-
│ ├── custom.css
|
|
24
|
-
│ └── index.ts
|
|
25
|
-
├── package.json
|
|
26
|
-
└── scripts/run-generate.cjs # Calls ddl-docs-cli to generate Markdown
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Create a scaffold project
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npx @rawsql-ts/ddl-docs-vitepress init my-db-docs
|
|
33
|
-
cd my-db-docs
|
|
34
|
-
npm install
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Safe-by-default init behavior
|
|
38
|
-
|
|
39
|
-
- If target directory does not exist: scaffold is created.
|
|
40
|
-
- If target directory exists and is empty: scaffold is created.
|
|
41
|
-
- If target directory exists and is not empty: command fails by default.
|
|
42
|
-
- Use `--force` to overwrite template paths in a non-empty directory.
|
|
43
|
-
- `--force` is overwrite-only. It does not remove non-template files.
|
|
44
|
-
- Use `--force --clean` to remove non-template files before scaffolding.
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx @rawsql-ts/ddl-docs-vitepress init existing-dir --force
|
|
48
|
-
npx @rawsql-ts/ddl-docs-vitepress init existing-dir --force --clean
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Warning: `--clean` removes non-template files and directories in the target path.
|
|
52
|
-
|
|
53
|
-
### Help
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx @rawsql-ts/ddl-docs-vitepress --help
|
|
57
|
-
npx @rawsql-ts/ddl-docs-vitepress help
|
|
58
|
-
npx @rawsql-ts/ddl-docs-vitepress init --help
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Use the generated scaffold project
|
|
62
|
-
|
|
63
|
-
In the generated project:
|
|
64
|
-
|
|
65
|
-
1. Put your `.sql` files under `ddl/`.
|
|
66
|
-
The build script applies `--filter-pg-dump` automatically, so `pg_dump` output can be used directly — statements such as `SET`, `ALTER ... OWNER TO`, and `SELECT pg_catalog.*` are filtered out before parsing.
|
|
67
|
-
2. Start local development:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
npm run dev
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
3. Build static docs:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npm run build
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
4. Preview the built site:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm run preview
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### GitHub Pages deployment
|
|
86
|
-
|
|
87
|
-
The scaffold includes `.github/workflows/deploy-docs.yml` which automatically builds and deploys docs to GitHub Pages on pushes to `main` that touch `ddl/` or `docs/.vitepress/`. The workflow sets `VITEPRESS_BASE` from the repository name.
|
|
88
|
-
|
|
89
|
-
To enable it, go to your repository's **Settings > Pages** and set the source to **GitHub Actions**.
|
|
90
|
-
|
|
91
|
-
### `VITEPRESS_BASE` for subpath hosting
|
|
92
|
-
|
|
93
|
-
The scaffold template uses `process.env.VITEPRESS_BASE ?? '/'` in `docs/.vitepress/config.mts`.
|
|
94
|
-
Set `VITEPRESS_BASE` when deploying under a subpath (for example GitHub Pages):
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
VITEPRESS_BASE=/my-repo/ npm run build
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Scripts in this package (maintainer note)
|
|
101
|
-
|
|
102
|
-
In `packages/ddl-docs-vitepress` itself:
|
|
103
|
-
|
|
104
|
-
- `pnpm build` compiles this CLI package with `tsc`.
|
|
105
|
-
- It does **not** build the generated VitePress docs site.
|
|
1
|
+
# @rawsql-ts/ddl-docs-vitepress
|
|
2
|
+
|
|
3
|
+
A scaffold generator for VitePress-based database schema documentation sites.
|
|
4
|
+
|
|
5
|
+
This package provides the `ddl-docs-vitepress init` command, which creates a ready-to-use project template that:
|
|
6
|
+
|
|
7
|
+
- reads SQL files from `ddl/`
|
|
8
|
+
- generates Markdown docs via `@rawsql-ts/ddl-docs-cli`
|
|
9
|
+
- serves/builds a VitePress site from `docs/`
|
|
10
|
+
|
|
11
|
+
## Generated project structure
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
my-db-docs/
|
|
15
|
+
├── .github/workflows/deploy-docs.yml # GitHub Pages deploy workflow
|
|
16
|
+
├── .gitignore
|
|
17
|
+
├── ddl/.gitkeep # Place your .sql files here
|
|
18
|
+
├── docs/
|
|
19
|
+
│ ├── index.md
|
|
20
|
+
│ └── .vitepress/
|
|
21
|
+
│ ├── config.mts
|
|
22
|
+
│ └── theme/
|
|
23
|
+
│ ├── custom.css
|
|
24
|
+
│ └── index.ts
|
|
25
|
+
├── package.json
|
|
26
|
+
└── scripts/run-generate.cjs # Calls ddl-docs-cli to generate Markdown
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Create a scaffold project
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @rawsql-ts/ddl-docs-vitepress init my-db-docs
|
|
33
|
+
cd my-db-docs
|
|
34
|
+
npm install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Safe-by-default init behavior
|
|
38
|
+
|
|
39
|
+
- If target directory does not exist: scaffold is created.
|
|
40
|
+
- If target directory exists and is empty: scaffold is created.
|
|
41
|
+
- If target directory exists and is not empty: command fails by default.
|
|
42
|
+
- Use `--force` to overwrite template paths in a non-empty directory.
|
|
43
|
+
- `--force` is overwrite-only. It does not remove non-template files.
|
|
44
|
+
- Use `--force --clean` to remove non-template files before scaffolding.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx @rawsql-ts/ddl-docs-vitepress init existing-dir --force
|
|
48
|
+
npx @rawsql-ts/ddl-docs-vitepress init existing-dir --force --clean
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Warning: `--clean` removes non-template files and directories in the target path.
|
|
52
|
+
|
|
53
|
+
### Help
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx @rawsql-ts/ddl-docs-vitepress --help
|
|
57
|
+
npx @rawsql-ts/ddl-docs-vitepress help
|
|
58
|
+
npx @rawsql-ts/ddl-docs-vitepress init --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Use the generated scaffold project
|
|
62
|
+
|
|
63
|
+
In the generated project:
|
|
64
|
+
|
|
65
|
+
1. Put your `.sql` files under `ddl/`.
|
|
66
|
+
The build script applies `--filter-pg-dump` automatically, so `pg_dump` output can be used directly — statements such as `SET`, `ALTER ... OWNER TO`, and `SELECT pg_catalog.*` are filtered out before parsing.
|
|
67
|
+
2. Start local development:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. Build static docs:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm run build
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4. Preview the built site:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run preview
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### GitHub Pages deployment
|
|
86
|
+
|
|
87
|
+
The scaffold includes `.github/workflows/deploy-docs.yml` which automatically builds and deploys docs to GitHub Pages on pushes to `main` that touch `ddl/` or `docs/.vitepress/`. The workflow sets `VITEPRESS_BASE` from the repository name.
|
|
88
|
+
|
|
89
|
+
To enable it, go to your repository's **Settings > Pages** and set the source to **GitHub Actions**.
|
|
90
|
+
|
|
91
|
+
### `VITEPRESS_BASE` for subpath hosting
|
|
92
|
+
|
|
93
|
+
The scaffold template uses `process.env.VITEPRESS_BASE ?? '/'` in `docs/.vitepress/config.mts`.
|
|
94
|
+
Set `VITEPRESS_BASE` when deploying under a subpath (for example GitHub Pages):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
VITEPRESS_BASE=/my-repo/ npm run build
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Scripts in this package (maintainer note)
|
|
101
|
+
|
|
102
|
+
In `packages/ddl-docs-vitepress` itself:
|
|
103
|
+
|
|
104
|
+
- `pnpm build` compiles this CLI package with `tsc`.
|
|
105
|
+
- It does **not** build the generated VitePress docs site.
|
package/dist/cli.js
CHANGED
|
@@ -101,38 +101,38 @@ async function runInit(args) {
|
|
|
101
101
|
console.log(' npm run dev');
|
|
102
102
|
}
|
|
103
103
|
function printGlobalHelp() {
|
|
104
|
-
console.log(`ddl-docs-vitepress <command> [options]
|
|
105
|
-
|
|
106
|
-
Commands:
|
|
107
|
-
init [targetDir] Scaffold a new DDL docs VitePress project (default: current directory)
|
|
108
|
-
help [command] Show global help or command help
|
|
109
|
-
|
|
110
|
-
Options:
|
|
111
|
-
--help, -h Show this help message
|
|
112
|
-
|
|
113
|
-
Init options:
|
|
114
|
-
--force Overwrite template output paths in a non-empty directory (no deletion)
|
|
115
|
-
--clean Delete non-template files before scaffolding (requires --force)
|
|
116
|
-
|
|
117
|
-
Examples:
|
|
118
|
-
ddl-docs-vitepress init my-db-docs
|
|
119
|
-
ddl-docs-vitepress init existing-dir --force
|
|
120
|
-
ddl-docs-vitepress init existing-dir --force --clean
|
|
121
|
-
ddl-docs-vitepress help init
|
|
104
|
+
console.log(`ddl-docs-vitepress <command> [options]
|
|
105
|
+
|
|
106
|
+
Commands:
|
|
107
|
+
init [targetDir] Scaffold a new DDL docs VitePress project (default: current directory)
|
|
108
|
+
help [command] Show global help or command help
|
|
109
|
+
|
|
110
|
+
Options:
|
|
111
|
+
--help, -h Show this help message
|
|
112
|
+
|
|
113
|
+
Init options:
|
|
114
|
+
--force Overwrite template output paths in a non-empty directory (no deletion)
|
|
115
|
+
--clean Delete non-template files before scaffolding (requires --force)
|
|
116
|
+
|
|
117
|
+
Examples:
|
|
118
|
+
ddl-docs-vitepress init my-db-docs
|
|
119
|
+
ddl-docs-vitepress init existing-dir --force
|
|
120
|
+
ddl-docs-vitepress init existing-dir --force --clean
|
|
121
|
+
ddl-docs-vitepress help init
|
|
122
122
|
`);
|
|
123
123
|
}
|
|
124
124
|
function printInitHelp() {
|
|
125
|
-
console.log(`ddl-docs-vitepress init [targetDir] [options]
|
|
126
|
-
|
|
127
|
-
Options:
|
|
128
|
-
--force Overwrite template output paths in a non-empty directory (does not delete other files)
|
|
129
|
-
--clean Delete non-template files before scaffolding (requires --force)
|
|
130
|
-
--help, -h Show init help
|
|
131
|
-
|
|
132
|
-
Examples:
|
|
133
|
-
ddl-docs-vitepress init docs-site
|
|
134
|
-
ddl-docs-vitepress init docs-site --force
|
|
135
|
-
ddl-docs-vitepress init docs-site --force --clean
|
|
125
|
+
console.log(`ddl-docs-vitepress init [targetDir] [options]
|
|
126
|
+
|
|
127
|
+
Options:
|
|
128
|
+
--force Overwrite template output paths in a non-empty directory (does not delete other files)
|
|
129
|
+
--clean Delete non-template files before scaffolding (requires --force)
|
|
130
|
+
--help, -h Show init help
|
|
131
|
+
|
|
132
|
+
Examples:
|
|
133
|
+
ddl-docs-vitepress init docs-site
|
|
134
|
+
ddl-docs-vitepress init docs-site --force
|
|
135
|
+
ddl-docs-vitepress init docs-site --force --clean
|
|
136
136
|
`);
|
|
137
137
|
}
|
|
138
138
|
function collectTemplateLayout(templatesDir) {
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rawsql-ts/ddl-docs-vitepress",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Scaffold generator for VitePress-based DB schema docs powered by ddl-docs-cli",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"ddl-docs-vitepress": "dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"@
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@rawsql-ts/ddl-docs-vitepress",
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "Scaffold generator for VitePress-based DB schema docs powered by ddl-docs-cli",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ddl-docs-vitepress": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"rawsql-ts",
|
|
11
|
+
"ddl",
|
|
12
|
+
"vitepress",
|
|
13
|
+
"docs",
|
|
14
|
+
"scaffold",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"author": "msugiura",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/mk3008/rawsql-ts",
|
|
22
|
+
"directory": "packages/ddl-docs-vitepress"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"templates",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@rawsql-ts/ddl-docs-cli": "^0.2.4"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.13.10",
|
|
40
|
+
"typescript": "^5.8.2",
|
|
41
|
+
"vitest": "^4.0.7"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"test": "vitest run packages/ddl-docs-vitepress/tests",
|
|
46
|
+
"generate": "node ./scripts/run-generate.cjs",
|
|
47
|
+
"dev": "pnpm generate && vitepress dev docs",
|
|
48
|
+
"preview": "vitepress preview docs"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
name: Deploy Docs
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
paths:
|
|
7
|
-
- 'ddl/**'
|
|
8
|
-
- 'docs/**'
|
|
9
|
-
- 'docs/.vitepress/**'
|
|
10
|
-
workflow_dispatch:
|
|
11
|
-
|
|
12
|
-
permissions:
|
|
13
|
-
contents: read
|
|
14
|
-
|
|
15
|
-
concurrency:
|
|
16
|
-
group: pages
|
|
17
|
-
cancel-in-progress: true
|
|
18
|
-
|
|
19
|
-
jobs:
|
|
20
|
-
build:
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
|
|
24
|
-
|
|
25
|
-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
|
26
|
-
with:
|
|
27
|
-
node-version: 20
|
|
28
|
-
|
|
29
|
-
- name: Install dependencies
|
|
30
|
-
run: npm ci
|
|
31
|
-
|
|
32
|
-
- name: Generate and build docs
|
|
33
|
-
env:
|
|
34
|
-
VITEPRESS_BASE: /${{ github.event.repository.name }}/
|
|
35
|
-
run: npm run build
|
|
36
|
-
|
|
37
|
-
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
|
|
38
|
-
with:
|
|
39
|
-
path: docs/.vitepress/dist
|
|
40
|
-
|
|
41
|
-
deploy:
|
|
42
|
-
needs: build
|
|
43
|
-
runs-on: ubuntu-latest
|
|
44
|
-
permissions:
|
|
45
|
-
pages: write
|
|
46
|
-
id-token: write
|
|
47
|
-
environment:
|
|
48
|
-
name: github-pages
|
|
49
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
50
|
-
steps:
|
|
51
|
-
- name: Deploy to GitHub Pages
|
|
52
|
-
id: deployment
|
|
53
|
-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'ddl/**'
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- 'docs/.vitepress/**'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: pages
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: npm ci
|
|
31
|
+
|
|
32
|
+
- name: Generate and build docs
|
|
33
|
+
env:
|
|
34
|
+
VITEPRESS_BASE: /${{ github.event.repository.name }}/
|
|
35
|
+
run: npm run build
|
|
36
|
+
|
|
37
|
+
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
|
|
38
|
+
with:
|
|
39
|
+
path: docs/.vitepress/dist
|
|
40
|
+
|
|
41
|
+
deploy:
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
permissions:
|
|
45
|
+
pages: write
|
|
46
|
+
id-token: write
|
|
47
|
+
environment:
|
|
48
|
+
name: github-pages
|
|
49
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
50
|
+
steps:
|
|
51
|
+
- name: Deploy to GitHub Pages
|
|
52
|
+
id: deployment
|
|
53
|
+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineConfig } from 'vitepress'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
title: 'DB Schema Docs',
|
|
5
|
-
description: 'Database schema documentation generated from DDL',
|
|
6
|
-
base: process.env.VITEPRESS_BASE ?? '/',
|
|
7
|
-
srcDir: '.',
|
|
8
|
-
themeConfig: {
|
|
9
|
-
search: { provider: 'local' },
|
|
10
|
-
aside: false,
|
|
11
|
-
},
|
|
12
|
-
})
|
|
1
|
+
import { defineConfig } from 'vitepress'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
title: 'DB Schema Docs',
|
|
5
|
+
description: 'Database schema documentation generated from DDL',
|
|
6
|
+
base: process.env.VITEPRESS_BASE ?? '/',
|
|
7
|
+
srcDir: '.',
|
|
8
|
+
themeConfig: {
|
|
9
|
+
search: { provider: 'local' },
|
|
10
|
+
aside: false,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.VPDoc .container,
|
|
2
|
-
.VPDoc .content-container,
|
|
3
|
-
.VPDoc .content {
|
|
4
|
-
max-width: none !important;
|
|
5
|
-
width: 100% !important;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.VPNavBar .wrapper,
|
|
9
|
-
.VPNavBar .container {
|
|
10
|
-
max-width: none !important;
|
|
11
|
-
margin-left: 0 !important;
|
|
12
|
-
padding-left: 16px !important;
|
|
13
|
-
}
|
|
1
|
+
.VPDoc .container,
|
|
2
|
+
.VPDoc .content-container,
|
|
3
|
+
.VPDoc .content {
|
|
4
|
+
max-width: none !important;
|
|
5
|
+
width: 100% !important;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.VPNavBar .wrapper,
|
|
9
|
+
.VPNavBar .container {
|
|
10
|
+
max-width: none !important;
|
|
11
|
+
margin-left: 0 !important;
|
|
12
|
+
padding-left: 16px !important;
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import DefaultTheme from 'vitepress/theme'
|
|
2
|
-
import './custom.css'
|
|
3
|
-
|
|
4
|
-
export default DefaultTheme
|
|
1
|
+
import DefaultTheme from 'vitepress/theme'
|
|
2
|
+
import './custom.css'
|
|
3
|
+
|
|
4
|
+
export default DefaultTheme
|
package/templates/docs/index.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: home
|
|
3
|
-
|
|
4
|
-
hero:
|
|
5
|
-
name: DB Schema Docs
|
|
6
|
-
text: Database schema documentation
|
|
7
|
-
tagline: Generated automatically from DDL files
|
|
8
|
-
actions:
|
|
9
|
-
- theme: brand
|
|
10
|
-
text: Browse Tables
|
|
11
|
-
link: /tables/
|
|
12
|
-
|
|
13
|
-
features:
|
|
14
|
-
- title: DDL-driven
|
|
15
|
-
details: Place your .sql files in the ddl/ directory and documentation is generated automatically.
|
|
16
|
-
- title: Always up to date
|
|
17
|
-
details: Run npm run dev or npm run build to regenerate docs from the latest DDL.
|
|
18
|
-
- title: Searchable
|
|
19
|
-
details: Full-text search across all table and column documentation.
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Getting Started
|
|
23
|
-
|
|
24
|
-
1. Add your DDL files to the `ddl/` directory.
|
|
25
|
-
2. Run `npm run dev` to start the documentation site.
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm run dev
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The `generate` step runs automatically before the dev server or build starts.
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
|
|
4
|
+
hero:
|
|
5
|
+
name: DB Schema Docs
|
|
6
|
+
text: Database schema documentation
|
|
7
|
+
tagline: Generated automatically from DDL files
|
|
8
|
+
actions:
|
|
9
|
+
- theme: brand
|
|
10
|
+
text: Browse Tables
|
|
11
|
+
link: /tables/
|
|
12
|
+
|
|
13
|
+
features:
|
|
14
|
+
- title: DDL-driven
|
|
15
|
+
details: Place your .sql files in the ddl/ directory and documentation is generated automatically.
|
|
16
|
+
- title: Always up to date
|
|
17
|
+
details: Run npm run dev or npm run build to regenerate docs from the latest DDL.
|
|
18
|
+
- title: Searchable
|
|
19
|
+
details: Full-text search across all table and column documentation.
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Getting Started
|
|
23
|
+
|
|
24
|
+
1. Add your DDL files to the `ddl/` directory.
|
|
25
|
+
2. Run `npm run dev` to start the documentation site.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The `generate` step runs automatically before the dev server or build starts.
|
package/templates/gitignore
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
docs/tables/
|
|
2
|
-
docs/.vitepress/dist/
|
|
3
|
-
docs/.vitepress/cache/
|
|
4
|
-
node_modules/
|
|
1
|
+
docs/tables/
|
|
2
|
+
docs/.vitepress/dist/
|
|
3
|
+
docs/.vitepress/cache/
|
|
4
|
+
node_modules/
|
package/templates/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "db-docs",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"generate": "node ./scripts/run-generate.cjs",
|
|
7
|
-
"dev": "node ./scripts/run-generate.cjs && vitepress dev docs",
|
|
8
|
-
"build": "node ./scripts/run-generate.cjs && vitepress build docs",
|
|
9
|
-
"preview": "vitepress preview docs"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@rawsql-ts/ddl-docs-cli": "^0.1.0",
|
|
13
|
-
"vitepress": "^1.6.4"
|
|
14
|
-
},
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=20"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "db-docs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"generate": "node ./scripts/run-generate.cjs",
|
|
7
|
+
"dev": "node ./scripts/run-generate.cjs && vitepress dev docs",
|
|
8
|
+
"build": "node ./scripts/run-generate.cjs && vitepress build docs",
|
|
9
|
+
"preview": "vitepress preview docs"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@rawsql-ts/ddl-docs-cli": "^0.1.0",
|
|
13
|
+
"vitepress": "^1.6.4"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
const { readdirSync, existsSync } = require("node:fs");
|
|
2
|
-
const { spawnSync } = require("node:child_process");
|
|
3
|
-
|
|
4
|
-
const ddlDir = "ddl";
|
|
5
|
-
|
|
6
|
-
let cliEntry;
|
|
7
|
-
try {
|
|
8
|
-
cliEntry = require.resolve("@rawsql-ts/ddl-docs-cli");
|
|
9
|
-
} catch {
|
|
10
|
-
console.error("@rawsql-ts/ddl-docs-cli is not installed. Run: npm install");
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const hasSqlInputs =
|
|
15
|
-
existsSync(ddlDir) &&
|
|
16
|
-
readdirSync(ddlDir, { recursive: true }).some(
|
|
17
|
-
(entry) => typeof entry === "string" && entry.endsWith(".sql"),
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
if (!hasSqlInputs) {
|
|
21
|
-
console.log("No SQL files found in ddl/. Skipping ddl-docs generation.");
|
|
22
|
-
process.exit(0);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const args = [
|
|
26
|
-
cliEntry,
|
|
27
|
-
"generate",
|
|
28
|
-
"--ddl-dir",
|
|
29
|
-
"ddl",
|
|
30
|
-
"--out-dir",
|
|
31
|
-
"docs/tables",
|
|
32
|
-
"--label-separator",
|
|
33
|
-
" :",
|
|
34
|
-
// Accept pg_dump output directly by filtering admin-only statements first.
|
|
35
|
-
"--filter-pg-dump",
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const result = spawnSync(process.execPath, args, { stdio: "inherit" });
|
|
39
|
-
process.exit(result.status ?? 1);
|
|
1
|
+
const { readdirSync, existsSync } = require("node:fs");
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
|
|
4
|
+
const ddlDir = "ddl";
|
|
5
|
+
|
|
6
|
+
let cliEntry;
|
|
7
|
+
try {
|
|
8
|
+
cliEntry = require.resolve("@rawsql-ts/ddl-docs-cli");
|
|
9
|
+
} catch {
|
|
10
|
+
console.error("@rawsql-ts/ddl-docs-cli is not installed. Run: npm install");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const hasSqlInputs =
|
|
15
|
+
existsSync(ddlDir) &&
|
|
16
|
+
readdirSync(ddlDir, { recursive: true }).some(
|
|
17
|
+
(entry) => typeof entry === "string" && entry.endsWith(".sql"),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (!hasSqlInputs) {
|
|
21
|
+
console.log("No SQL files found in ddl/. Skipping ddl-docs generation.");
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const args = [
|
|
26
|
+
cliEntry,
|
|
27
|
+
"generate",
|
|
28
|
+
"--ddl-dir",
|
|
29
|
+
"ddl",
|
|
30
|
+
"--out-dir",
|
|
31
|
+
"docs/tables",
|
|
32
|
+
"--label-separator",
|
|
33
|
+
" :",
|
|
34
|
+
// Accept pg_dump output directly by filtering admin-only statements first.
|
|
35
|
+
"--filter-pg-dump",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const result = spawnSync(process.execPath, args, { stdio: "inherit" });
|
|
39
|
+
process.exit(result.status ?? 1);
|