@stritti/vitepress-plugin-openspec 0.7.1 → 0.8.1
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/README.md +12 -2
- package/dist/index.cjs +535 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +535 -134
- package/dist/index.js.map +1 -1
- package/dist/lib/detect.d.ts +43 -0
- package/dist/lib/detect.d.ts.map +1 -0
- package/dist/lib/dev-server.d.ts +28 -0
- package/dist/lib/dev-server.d.ts.map +1 -0
- package/dist/lib/generator.d.ts +12 -0
- package/dist/lib/generator.d.ts.map +1 -0
- package/dist/lib/links.d.ts +10 -0
- package/dist/lib/links.d.ts.map +1 -0
- package/dist/lib/logger.d.ts +5 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/markdown.d.ts +6 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/navigation.d.ts +16 -0
- package/dist/lib/navigation.d.ts.map +1 -0
- package/dist/lib/options.d.ts +28 -0
- package/dist/lib/options.d.ts.map +1 -0
- package/dist/lib/pages.d.ts +22 -0
- package/dist/lib/pages.d.ts.map +1 -0
- package/dist/lib/reader.d.ts +10 -0
- package/dist/lib/reader.d.ts.map +1 -0
- package/dist/lib/watch.d.ts +36 -0
- package/dist/lib/watch.d.ts.map +1 -0
- package/dist/plugin.d.ts +21 -50
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +16 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +6 -57
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,13 @@ export default defineConfig(
|
|
|
40
40
|
|
|
41
41
|
`withOpenSpec` handles everything in one call: page generation, the Vite plugin for live reload, the nav entry, and the sidebar section. All fields are optional — it works with an empty config object and sensible defaults.
|
|
42
42
|
|
|
43
|
+
**Zero-config by default:** `specDir` and `srcDir` are auto-detected.
|
|
44
|
+
|
|
45
|
+
- `specDir`: the plugin walks up from the working directory until it finds an `openspec/` folder, so the standard project layout (`openspec/` at the repo root, docs in `docs/.vitepress/config.ts`) needs no path configuration at all.
|
|
46
|
+
- `srcDir`: the plugin detects the directory containing `.vitepress` — either the working directory itself, a first-level subdirectory such as `docs/`, or the parent when the config is evaluated from inside `docs/.vitepress/`.
|
|
47
|
+
|
|
48
|
+
An array-based `sidebar` (single sidebar) is automatically converted to the object form `{ '/': [...] }` so the openspec section can be injected without discarding your existing entries.
|
|
49
|
+
|
|
43
50
|
**Other Vite plugins** go into `vite.plugins` as usual — `withOpenSpec` appends to the array without replacing it:
|
|
44
51
|
|
|
45
52
|
```typescript
|
|
@@ -64,14 +71,17 @@ export default defineConfig(
|
|
|
64
71
|
|
|
65
72
|
| Option | Type | Default | Description |
|
|
66
73
|
| --- | --- | --- | --- |
|
|
67
|
-
| `specDir` | `string` | `'./openspec'` | Path to your project's `openspec/` directory. Can be an absolute path or relative to the working directory — use `path.resolve(__dirname, '../../openspec')` when `config.ts` lives in `docs/.vitepress/`. |
|
|
74
|
+
| `specDir` | `string` | auto-detected (`<nearest ancestor>/openspec`, fallback `'./openspec'`) | Path to your project's `openspec/` directory. Can be an absolute path or relative to the working directory — use `path.resolve(__dirname, '../../openspec')` when `config.ts` lives in `docs/.vitepress/`. |
|
|
68
75
|
| `outDir` | `string` | `'openspec'` | Output directory relative to VitePress `srcDir` |
|
|
69
|
-
| `srcDir` | `string` |
|
|
76
|
+
| `srcDir` | `string` | auto-detected (directory containing `.vitepress`, fallback working directory) | VitePress source directory (the `docs/` folder) |
|
|
70
77
|
| `nav` | `boolean` | `true` | Whether to prepend an openspec entry to `themeConfig.nav` |
|
|
71
78
|
| `sidebar` | `boolean` | `true` | Whether to inject the openspec sidebar section into `themeConfig.sidebar` |
|
|
79
|
+
| `navText` | `string` | `'Docs'` | Label for the nav entry injected into `themeConfig.nav` |
|
|
72
80
|
|
|
73
81
|
> **Missing directory** — if `specDir` does not exist the plugin emits a `console.warn` and skips page generation, nav, and sidebar. No error is thrown and your VitePress build continues normally. This is intentional for projects that haven't set up an `openspec/` folder yet.
|
|
74
82
|
|
|
83
|
+
> **Invalid `outDir`** — an `outDir` that is absolute, empty, or resolves outside the VitePress `srcDir` throws an error at config evaluation time. Unlike a missing `specDir`, a misconfigured output path is never silently ignored.
|
|
84
|
+
|
|
75
85
|
---
|
|
76
86
|
|
|
77
87
|
## Advanced / manual setup
|