@vendure-io/docs-provider 0.1.0
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 +245 -0
- package/dist/frontmatter.d.ts +89 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/loader.cjs +1 -0
- package/dist/loader.d.ts +99 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +90 -0
- package/dist/manifest-B1CxKK1i.js +207 -0
- package/dist/manifest-D2yANQB-.cjs +3 -0
- package/dist/manifest.d.ts +127 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/navigation-utils.d.ts +15 -0
- package/dist/navigation-utils.d.ts.map +1 -0
- package/dist/schema.d.ts +419 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/types.d.ts +116 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/creating-a-docs-package.md +394 -0
- package/docs/frontmatter-reference.md +364 -0
- package/docs/getting-started.md +156 -0
- package/docs/manifest-reference.md +520 -0
- package/docs/publishing.md +352 -0
- package/package.json +76 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# Publishing Your Docs Package
|
|
2
|
+
|
|
3
|
+
This guide covers how to publish your documentation package and integrate it with the Vendure documentation website.
|
|
4
|
+
|
|
5
|
+
## Package Naming Conventions
|
|
6
|
+
|
|
7
|
+
When publishing documentation packages for Vendure, we recommend following these naming conventions:
|
|
8
|
+
|
|
9
|
+
### npm Scope
|
|
10
|
+
|
|
11
|
+
Use the `@vendure/` scope for official Vendure documentation packages:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
@vendure/docs-core # Core Vendure documentation
|
|
15
|
+
@vendure/docs-plugins # Plugin documentation
|
|
16
|
+
@vendure/docs-enterprise # Enterprise features documentation
|
|
17
|
+
@vendure/docs-my-plugin # Your custom plugin documentation
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For third-party or community packages, you can use your own scope:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
@your-org/vendure-docs-my-plugin
|
|
24
|
+
@your-username/vendure-docs-something
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Package ID
|
|
28
|
+
|
|
29
|
+
The `id` field in your manifest should be:
|
|
30
|
+
|
|
31
|
+
- Lowercase
|
|
32
|
+
- Use hyphens for word separation
|
|
33
|
+
- Descriptive and unique
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// Good
|
|
37
|
+
id: 'my-plugin'
|
|
38
|
+
id: 'payment-stripe'
|
|
39
|
+
id: 'elasticsearch-integration'
|
|
40
|
+
|
|
41
|
+
// Avoid
|
|
42
|
+
id: 'MyPlugin'
|
|
43
|
+
id: 'my_plugin'
|
|
44
|
+
id: 'docs'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Preparing for Publication
|
|
48
|
+
|
|
49
|
+
### 1. Verify Package Structure
|
|
50
|
+
|
|
51
|
+
Ensure your package has the correct structure:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
your-docs-package/
|
|
55
|
+
├── src/
|
|
56
|
+
│ ├── index.ts # Must export manifest
|
|
57
|
+
│ └── manifest.ts # Manifest definition
|
|
58
|
+
├── docs/
|
|
59
|
+
│ └── ... # MDX documentation files
|
|
60
|
+
├── package.json
|
|
61
|
+
└── tsconfig.json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2. Configure package.json
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"name": "@vendure/docs-my-plugin",
|
|
69
|
+
"version": "1.0.0",
|
|
70
|
+
"description": "Documentation for My Plugin",
|
|
71
|
+
"type": "module",
|
|
72
|
+
"main": "./src/index.ts",
|
|
73
|
+
"types": "./src/index.ts",
|
|
74
|
+
"exports": {
|
|
75
|
+
".": {
|
|
76
|
+
"import": "./src/index.ts",
|
|
77
|
+
"require": "./src/index.ts"
|
|
78
|
+
},
|
|
79
|
+
"./manifest": {
|
|
80
|
+
"import": "./src/manifest.ts",
|
|
81
|
+
"require": "./src/manifest.ts"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"files": ["src", "docs"],
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@vendure-io/docs-provider": "^0.0.1"
|
|
87
|
+
},
|
|
88
|
+
"keywords": ["vendure", "documentation", "docs", "my-plugin"],
|
|
89
|
+
"license": "MIT",
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "https://github.com/your-org/your-repo.git",
|
|
93
|
+
"directory": "packages/docs-my-plugin"
|
|
94
|
+
},
|
|
95
|
+
"publishConfig": {
|
|
96
|
+
"access": "public"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Key requirements:
|
|
102
|
+
|
|
103
|
+
- **`files`**: Must include `src` and `docs` directories
|
|
104
|
+
- **`exports`**: Must export both the main entry and manifest
|
|
105
|
+
- **`publishConfig.access`**: Set to `"public"` for scoped packages
|
|
106
|
+
|
|
107
|
+
### 3. Validate Your Manifest
|
|
108
|
+
|
|
109
|
+
Run validation before publishing:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { validateManifest, ManifestValidationError } from '@vendure-io/docs-provider'
|
|
113
|
+
import { manifest } from './src/manifest'
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
validateManifest(manifest)
|
|
117
|
+
console.log('Manifest is valid!')
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (error instanceof ManifestValidationError) {
|
|
120
|
+
console.error('Validation failed:')
|
|
121
|
+
error.issues.forEach((issue) => console.error(` - ${issue}`))
|
|
122
|
+
process.exit(1)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 4. Verify All Files Exist
|
|
128
|
+
|
|
129
|
+
Check that all files referenced in the manifest exist:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { getAllFilePaths } from '@vendure-io/docs-provider'
|
|
133
|
+
import { manifest } from './src/manifest'
|
|
134
|
+
import { existsSync } from 'fs'
|
|
135
|
+
|
|
136
|
+
const files = getAllFilePaths(manifest)
|
|
137
|
+
const missing = files.filter((file) => !existsSync(file))
|
|
138
|
+
|
|
139
|
+
if (missing.length > 0) {
|
|
140
|
+
console.error('Missing files:')
|
|
141
|
+
missing.forEach((file) => console.error(` - ${file}`))
|
|
142
|
+
process.exit(1)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(`All ${files.length} documentation files exist!`)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Publishing to npm
|
|
149
|
+
|
|
150
|
+
### First-Time Setup
|
|
151
|
+
|
|
152
|
+
1. Create an npm account at [npmjs.com](https://www.npmjs.com/)
|
|
153
|
+
2. Login to npm:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm login
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
3. If using a scope (e.g., `@vendure/`), ensure you have access to publish under that scope
|
|
160
|
+
|
|
161
|
+
### Publishing
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Ensure you're in the package directory
|
|
165
|
+
cd packages/docs-my-plugin
|
|
166
|
+
|
|
167
|
+
# Run any build steps if needed
|
|
168
|
+
npm run build
|
|
169
|
+
|
|
170
|
+
# Publish the package
|
|
171
|
+
npm publish --access public
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Versioning
|
|
175
|
+
|
|
176
|
+
Follow semantic versioning:
|
|
177
|
+
|
|
178
|
+
- **Patch** (`1.0.1`): Typo fixes, minor content updates
|
|
179
|
+
- **Minor** (`1.1.0`): New pages, new sections
|
|
180
|
+
- **Major** (`2.0.0`): Breaking changes to navigation structure, major rewrites
|
|
181
|
+
|
|
182
|
+
Update both `package.json` version and `manifest.version`:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
export const manifest: DocsPackageManifest = {
|
|
186
|
+
// ...
|
|
187
|
+
version: '1.1.0', // Keep in sync with package.json
|
|
188
|
+
// ...
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Integration with vendure.io
|
|
193
|
+
|
|
194
|
+
Once your package is published, it needs to be registered in the docs application to appear on vendure.io.
|
|
195
|
+
|
|
196
|
+
### How Integration Works
|
|
197
|
+
|
|
198
|
+
The Vendure docs application:
|
|
199
|
+
|
|
200
|
+
1. Imports your package's manifest at build time
|
|
201
|
+
2. Registers it in a configuration file
|
|
202
|
+
3. Generates static pages for all navigation nodes
|
|
203
|
+
4. Renders MDX content using server-side rendering
|
|
204
|
+
|
|
205
|
+
### Package Registration
|
|
206
|
+
|
|
207
|
+
Documentation packages are registered in the docs application's configuration. The configuration maps package names to their display settings:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// Example configuration structure (in the docs app)
|
|
211
|
+
const docsConfig = [
|
|
212
|
+
{
|
|
213
|
+
version: 'v3',
|
|
214
|
+
label: 'v3.x (Latest)',
|
|
215
|
+
isLatest: true,
|
|
216
|
+
packages: [
|
|
217
|
+
{
|
|
218
|
+
packageName: '@vendure/docs-core',
|
|
219
|
+
id: 'core',
|
|
220
|
+
name: 'Vendure Core',
|
|
221
|
+
description: 'Core Vendure documentation',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
packageName: '@vendure/docs-my-plugin',
|
|
225
|
+
id: 'my-plugin',
|
|
226
|
+
name: 'My Plugin',
|
|
227
|
+
description: 'Documentation for My Plugin',
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### URL Structure
|
|
235
|
+
|
|
236
|
+
Once registered, your documentation will be available at:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
https://docs.vendure.io/v3/{package-id}/{slug-path}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
For example:
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
https://docs.vendure.io/v3/my-plugin/getting-started/installation
|
|
246
|
+
https://docs.vendure.io/v3/my-plugin/guides/advanced-features
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Requesting Integration
|
|
250
|
+
|
|
251
|
+
To have your docs package added to vendure.io:
|
|
252
|
+
|
|
253
|
+
1. Ensure your package is published and publicly accessible on npm
|
|
254
|
+
2. Verify the manifest is valid and all files are included
|
|
255
|
+
3. Contact the Vendure team or open an issue on the vendure-io repository
|
|
256
|
+
4. Provide:
|
|
257
|
+
- Package name (e.g., `@vendure/docs-my-plugin`)
|
|
258
|
+
- Desired `id` for URLs
|
|
259
|
+
- Display name
|
|
260
|
+
- Brief description
|
|
261
|
+
|
|
262
|
+
## Local Development
|
|
263
|
+
|
|
264
|
+
### Testing with the Docs App
|
|
265
|
+
|
|
266
|
+
If you have access to the vendure-io monorepo, you can test your package locally:
|
|
267
|
+
|
|
268
|
+
1. Add your package as a dependency:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
cd apps/docs
|
|
272
|
+
bun add @vendure/docs-my-plugin
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
2. Register it in the docs configuration
|
|
276
|
+
3. Run the docs app:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
bun run docs:dev
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Using Workspace Links
|
|
283
|
+
|
|
284
|
+
During development, you can link your package locally:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# In your docs package
|
|
288
|
+
npm link
|
|
289
|
+
|
|
290
|
+
# In the docs app
|
|
291
|
+
npm link @vendure/docs-my-plugin
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Updating Published Documentation
|
|
295
|
+
|
|
296
|
+
When you update your documentation:
|
|
297
|
+
|
|
298
|
+
1. Update the content in your MDX files
|
|
299
|
+
2. Update the manifest if navigation changed
|
|
300
|
+
3. Bump the version in `package.json` and `manifest.version`
|
|
301
|
+
4. Publish the new version:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
npm version patch # or minor/major
|
|
305
|
+
npm publish
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
5. The docs application will use the new version on next build/deploy
|
|
309
|
+
|
|
310
|
+
## Checklist
|
|
311
|
+
|
|
312
|
+
Before publishing, verify:
|
|
313
|
+
|
|
314
|
+
- [ ] Package name follows conventions
|
|
315
|
+
- [ ] `manifest.id` is unique and URL-friendly
|
|
316
|
+
- [ ] `manifest.version` matches `package.json` version
|
|
317
|
+
- [ ] `manifest.vendureVersion` is correct
|
|
318
|
+
- [ ] All navigation nodes have valid slugs
|
|
319
|
+
- [ ] All file paths resolve correctly
|
|
320
|
+
- [ ] All MDX files have valid frontmatter
|
|
321
|
+
- [ ] All MDX files have at least a `title` in frontmatter
|
|
322
|
+
- [ ] `package.json` includes `src` and `docs` in `files`
|
|
323
|
+
- [ ] `package.json` has correct exports configuration
|
|
324
|
+
- [ ] Manifest validation passes
|
|
325
|
+
- [ ] All referenced files exist in the package
|
|
326
|
+
|
|
327
|
+
## Troubleshooting
|
|
328
|
+
|
|
329
|
+
### Package Not Found After Publishing
|
|
330
|
+
|
|
331
|
+
- Verify the package is public (`npm view @your-scope/docs-package`)
|
|
332
|
+
- Check that `publishConfig.access` is set to `"public"`
|
|
333
|
+
- Wait a few minutes for npm registry propagation
|
|
334
|
+
|
|
335
|
+
### Files Missing from Published Package
|
|
336
|
+
|
|
337
|
+
- Check `files` array in `package.json`
|
|
338
|
+
- Ensure `docs/` directory is included
|
|
339
|
+
- Run `npm pack` to inspect what gets published
|
|
340
|
+
|
|
341
|
+
### Manifest Validation Errors
|
|
342
|
+
|
|
343
|
+
- Run the validation script before publishing
|
|
344
|
+
- Check that `id`, `name`, and `version` are non-empty
|
|
345
|
+
- Verify `vendureVersion` is `"v1"`, `"v2"`, or `"v3"`
|
|
346
|
+
- Ensure `version` follows semver format (e.g., `"1.0.0"`)
|
|
347
|
+
|
|
348
|
+
### File Path Resolution Issues
|
|
349
|
+
|
|
350
|
+
- Use absolute paths in the manifest via `path.join()`
|
|
351
|
+
- Ensure paths are resolved at module load time
|
|
352
|
+
- Test file access with `fs.existsSync()` before publishing
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vendure-io/docs-provider",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Contract types and utilities for Vendure documentation packages",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"./loader": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/loader.d.ts",
|
|
27
|
+
"default": "./dist/loader.js"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"docs",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "vite build",
|
|
38
|
+
"dev": "vite build --watch",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"check-types": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest",
|
|
43
|
+
"publish:local": "bun run build && npm publish --registry http://localhost:4873"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"gray-matter": "^4.0.3",
|
|
47
|
+
"zod": "^3.24.2"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"ajv": "^8.17.1",
|
|
51
|
+
"vite": "^6.0.0",
|
|
52
|
+
"vite-plugin-dts": "^4.5.4",
|
|
53
|
+
"vitest": "^3.0.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"typescript": ">=5.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"typescript": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"keywords": [
|
|
64
|
+
"vendure",
|
|
65
|
+
"documentation",
|
|
66
|
+
"docs",
|
|
67
|
+
"mdx",
|
|
68
|
+
"contract"
|
|
69
|
+
],
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "https://github.com/vendure-ecommerce/vendure-io.git",
|
|
74
|
+
"directory": "libs/docs-provider"
|
|
75
|
+
}
|
|
76
|
+
}
|