@alliance-droid/svelte-docs-system 0.0.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/COMPONENTS.md +365 -0
- package/COVERAGE_REPORT.md +663 -0
- package/README.md +42 -0
- package/SEARCH_VERIFICATION.md +229 -0
- package/TEST_SUMMARY.md +344 -0
- package/bin/init.js +821 -0
- package/docs/E2E_TESTS.md +354 -0
- package/docs/TESTING.md +754 -0
- package/docs/de/index.md +41 -0
- package/docs/en/COMPONENTS.md +443 -0
- package/docs/en/api/examples.md +100 -0
- package/docs/en/api/overview.md +69 -0
- package/docs/en/components/index.md +622 -0
- package/docs/en/config/navigation.md +505 -0
- package/docs/en/config/theme-and-colors.md +395 -0
- package/docs/en/getting-started/integration.md +406 -0
- package/docs/en/guides/common-setups.md +651 -0
- package/docs/en/index.md +243 -0
- package/docs/en/markdown.md +102 -0
- package/docs/en/routing.md +64 -0
- package/docs/en/setup.md +52 -0
- package/docs/en/troubleshooting.md +704 -0
- package/docs/es/index.md +41 -0
- package/docs/fr/index.md +41 -0
- package/docs/ja/index.md +41 -0
- package/package.json +40 -0
- package/pagefind.toml +8 -0
- package/postcss.config.js +5 -0
- package/src/app.css +119 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +1 -0
- package/src/lib/components/APITable.svelte +120 -0
- package/src/lib/components/APITable.test.ts +153 -0
- package/src/lib/components/Breadcrumbs.svelte +85 -0
- package/src/lib/components/Breadcrumbs.test.ts +148 -0
- package/src/lib/components/Callout.svelte +60 -0
- package/src/lib/components/Callout.test.ts +100 -0
- package/src/lib/components/CodeBlock.svelte +68 -0
- package/src/lib/components/CodeBlock.test.ts +133 -0
- package/src/lib/components/DocLayout.svelte +84 -0
- package/src/lib/components/Footer.svelte +78 -0
- package/src/lib/components/Image.svelte +100 -0
- package/src/lib/components/Image.test.ts +163 -0
- package/src/lib/components/Navbar.svelte +141 -0
- package/src/lib/components/Search.svelte +248 -0
- package/src/lib/components/Sidebar.svelte +110 -0
- package/src/lib/components/Tabs.svelte +48 -0
- package/src/lib/components/Tabs.test.ts +102 -0
- package/src/lib/config.test.ts +140 -0
- package/src/lib/config.ts +179 -0
- package/src/lib/configIntegration.test.ts +272 -0
- package/src/lib/configLoader.ts +231 -0
- package/src/lib/configParser.test.ts +217 -0
- package/src/lib/configParser.ts +234 -0
- package/src/lib/index.ts +34 -0
- package/src/lib/integration.test.ts +426 -0
- package/src/lib/navigationBuilder.test.ts +338 -0
- package/src/lib/navigationBuilder.ts +268 -0
- package/src/lib/performance.test.ts +369 -0
- package/src/lib/routing.test.ts +202 -0
- package/src/lib/routing.ts +127 -0
- package/src/lib/search-functionality.test.ts +493 -0
- package/src/lib/stores/i18n.test.ts +180 -0
- package/src/lib/stores/i18n.ts +143 -0
- package/src/lib/stores/nav.ts +36 -0
- package/src/lib/stores/search.test.ts +140 -0
- package/src/lib/stores/search.ts +162 -0
- package/src/lib/stores/theme.ts +59 -0
- package/src/lib/stores/version.test.ts +139 -0
- package/src/lib/stores/version.ts +111 -0
- package/src/lib/themeCustomization.test.ts +223 -0
- package/src/lib/themeCustomization.ts +212 -0
- package/src/lib/utils/highlight.test.ts +136 -0
- package/src/lib/utils/highlight.ts +100 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/markdown.test.ts +357 -0
- package/src/lib/utils/markdown.ts +77 -0
- package/src/routes/+layout.server.ts +1 -0
- package/src/routes/+layout.svelte +28 -0
- package/src/routes/+page.svelte +165 -0
- package/static/robots.txt +3 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.ts +55 -0
- package/template-starter/.github/workflows/build.yml +40 -0
- package/template-starter/.github/workflows/deploy-github-pages.yml +47 -0
- package/template-starter/.github/workflows/deploy-netlify.yml +41 -0
- package/template-starter/.github/workflows/deploy-vercel.yml +64 -0
- package/template-starter/NPM-PACKAGE-SETUP.md +233 -0
- package/template-starter/README.md +320 -0
- package/template-starter/docs/_config.json +39 -0
- package/template-starter/docs/api/components.md +257 -0
- package/template-starter/docs/api/overview.md +169 -0
- package/template-starter/docs/guides/configuration.md +145 -0
- package/template-starter/docs/guides/github-pages-deployment.md +254 -0
- package/template-starter/docs/guides/netlify-deployment.md +159 -0
- package/template-starter/docs/guides/vercel-deployment.md +131 -0
- package/template-starter/docs/index.md +49 -0
- package/template-starter/docs/setup.md +149 -0
- package/template-starter/package.json +31 -0
- package/template-starter/pagefind.toml +3 -0
- package/template-starter/postcss.config.js +5 -0
- package/template-starter/src/app.css +34 -0
- package/template-starter/src/app.d.ts +13 -0
- package/template-starter/src/app.html +11 -0
- package/template-starter/src/lib/components/APITable.svelte +120 -0
- package/template-starter/src/lib/components/APITable.test.ts +19 -0
- package/template-starter/src/lib/components/Breadcrumbs.svelte +85 -0
- package/template-starter/src/lib/components/Breadcrumbs.test.ts +19 -0
- package/template-starter/src/lib/components/Callout.svelte +60 -0
- package/template-starter/src/lib/components/Callout.test.ts +16 -0
- package/template-starter/src/lib/components/CodeBlock.svelte +68 -0
- package/template-starter/src/lib/components/CodeBlock.test.ts +12 -0
- package/template-starter/src/lib/components/DocLayout.svelte +84 -0
- package/template-starter/src/lib/components/Footer.svelte +78 -0
- package/template-starter/src/lib/components/Image.svelte +100 -0
- package/template-starter/src/lib/components/Image.test.ts +15 -0
- package/template-starter/src/lib/components/Navbar.svelte +141 -0
- package/template-starter/src/lib/components/Search.svelte +248 -0
- package/template-starter/src/lib/components/Sidebar.svelte +110 -0
- package/template-starter/src/lib/components/Tabs.svelte +48 -0
- package/template-starter/src/lib/components/Tabs.test.ts +17 -0
- package/template-starter/src/lib/index.ts +15 -0
- package/template-starter/src/routes/+layout.svelte +28 -0
- package/template-starter/src/routes/+page.svelte +92 -0
- package/template-starter/svelte.config.js +17 -0
- package/template-starter/tailwind.config.ts +17 -0
- package/template-starter/tsconfig.json +13 -0
- package/template-starter/vite.config.ts +6 -0
- package/tests/e2e/example.spec.ts +345 -0
- package/tsconfig.json +20 -0
- package/vite.config.ts +6 -0
- package/vitest.config.ts +34 -0
- package/vitest.setup.ts +21 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Overview
|
|
3
|
+
description: Documentation site API and available endpoints
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Overview
|
|
7
|
+
|
|
8
|
+
This documentation site provides a clean interface for viewing API documentation.
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
The documentation site is built with Svelte and SvelteKit, providing:
|
|
13
|
+
|
|
14
|
+
- **Fast page loads** - Static pre-rendered pages
|
|
15
|
+
- **Full-text search** - Search across all documentation
|
|
16
|
+
- **Dark mode** - Automatic light/dark theme switching
|
|
17
|
+
- **Mobile responsive** - Works great on all devices
|
|
18
|
+
- **Accessible** - WCAG compliant
|
|
19
|
+
|
|
20
|
+
## Available Documentation Sections
|
|
21
|
+
|
|
22
|
+
### Guides
|
|
23
|
+
|
|
24
|
+
Step-by-step guides for common tasks:
|
|
25
|
+
|
|
26
|
+
- [Setup Guide](../setup.md) - Get started in minutes
|
|
27
|
+
- [Configuration](../guides/configuration.md) - Customize your docs
|
|
28
|
+
- [Vercel Deployment](../guides/vercel-deployment.md) - Deploy to Vercel
|
|
29
|
+
- [Netlify Deployment](../guides/netlify-deployment.md) - Deploy to Netlify
|
|
30
|
+
- [GitHub Pages](../guides/github-pages-deployment.md) - Deploy to GitHub Pages
|
|
31
|
+
|
|
32
|
+
### Components
|
|
33
|
+
|
|
34
|
+
Interactive Svelte components for documentation:
|
|
35
|
+
|
|
36
|
+
- Callout - Information, warning, success, and error callouts
|
|
37
|
+
- CodeBlock - Syntax-highlighted code with copy button
|
|
38
|
+
- Tabs - Tabbed content display
|
|
39
|
+
- APITable - API reference tables
|
|
40
|
+
- Image - Optimized image display with captions
|
|
41
|
+
- Breadcrumbs - Navigation breadcrumbs
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
### Search
|
|
46
|
+
|
|
47
|
+
Use the search feature to quickly find documentation:
|
|
48
|
+
- Full-text search across all pages
|
|
49
|
+
- Keyboard shortcut: Press `Cmd+K` (Mac) or `Ctrl+K` (Windows/Linux)
|
|
50
|
+
- Fast and responsive search results
|
|
51
|
+
|
|
52
|
+
### Dark Mode
|
|
53
|
+
|
|
54
|
+
Toggle between light and dark themes:
|
|
55
|
+
- Click the theme toggle in the header
|
|
56
|
+
- Automatically respects your system preference
|
|
57
|
+
- Smooth transitions between themes
|
|
58
|
+
|
|
59
|
+
### Navigation
|
|
60
|
+
|
|
61
|
+
- **Sidebar** - Browse documentation structure
|
|
62
|
+
- **Breadcrumbs** - See current location in docs
|
|
63
|
+
- **Previous/Next** - Navigate between pages
|
|
64
|
+
- **Table of Contents** - Jump to sections within a page
|
|
65
|
+
|
|
66
|
+
## Documentation Format
|
|
67
|
+
|
|
68
|
+
All documentation is written in **Markdown** with optional YAML frontmatter:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
---
|
|
72
|
+
title: Page Title
|
|
73
|
+
description: Brief description for SEO
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
# Page Title
|
|
77
|
+
|
|
78
|
+
Your content here...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Markdown Features
|
|
82
|
+
|
|
83
|
+
### Headings
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# Heading 1
|
|
87
|
+
## Heading 2
|
|
88
|
+
### Heading 3
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Code Blocks
|
|
92
|
+
|
|
93
|
+
````markdown
|
|
94
|
+
```javascript
|
|
95
|
+
const greeting = 'Hello, World!';
|
|
96
|
+
```
|
|
97
|
+
````
|
|
98
|
+
|
|
99
|
+
### Lists
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
- Item 1
|
|
103
|
+
- Item 2
|
|
104
|
+
- Item 3
|
|
105
|
+
|
|
106
|
+
1. First
|
|
107
|
+
2. Second
|
|
108
|
+
3. Third
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Links
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
[Link text](https://example.com)
|
|
115
|
+
[Relative link](../other-page.md)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Images
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+

|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Tables
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
| Column 1 | Column 2 |
|
|
128
|
+
|----------|----------|
|
|
129
|
+
| Cell 1 | Cell 2 |
|
|
130
|
+
| Cell 3 | Cell 4 |
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Blockquotes
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
> This is a blockquote
|
|
137
|
+
> It can span multiple lines
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Custom Components
|
|
141
|
+
|
|
142
|
+
Use Svelte components in your markdown documentation:
|
|
143
|
+
|
|
144
|
+
```svelte
|
|
145
|
+
<Callout variant="info" title="Tip">
|
|
146
|
+
This is an informational callout.
|
|
147
|
+
</Callout>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Contributing
|
|
151
|
+
|
|
152
|
+
To add new documentation:
|
|
153
|
+
|
|
154
|
+
1. Create a new `.md` file in the appropriate folder
|
|
155
|
+
2. Add YAML frontmatter with title and description
|
|
156
|
+
3. Write content in Markdown
|
|
157
|
+
4. Build and test: `npm run build`
|
|
158
|
+
5. Deploy using your preferred hosting platform
|
|
159
|
+
|
|
160
|
+
## Support
|
|
161
|
+
|
|
162
|
+
For issues or questions:
|
|
163
|
+
- Check existing documentation and guides
|
|
164
|
+
- Search the documentation using the search feature
|
|
165
|
+
- Review component examples in the docs
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
This documentation template is provided as-is for your use.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration Guide
|
|
3
|
+
description: Learn how to configure your documentation site
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration Guide
|
|
7
|
+
|
|
8
|
+
Customize your documentation site to match your needs.
|
|
9
|
+
|
|
10
|
+
## Navigation Configuration
|
|
11
|
+
|
|
12
|
+
Edit `docs/_config.json` to control the sidebar structure:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"name": "Your Project Docs",
|
|
17
|
+
"baseUrl": "/docs",
|
|
18
|
+
"sections": [
|
|
19
|
+
{
|
|
20
|
+
"title": "Getting Started",
|
|
21
|
+
"pages": [
|
|
22
|
+
{ "label": "Introduction", "path": "/docs/index" },
|
|
23
|
+
{ "label": "Setup", "path": "/docs/setup" }
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"title": "Guides",
|
|
28
|
+
"pages": [
|
|
29
|
+
{ "label": "Configuration", "path": "/docs/guides/configuration" },
|
|
30
|
+
{ "label": "Deployment", "path": "/docs/guides/deployment" }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Tailwind Configuration
|
|
38
|
+
|
|
39
|
+
Customize colors and styling in `tailwind.config.ts`:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
export default {
|
|
43
|
+
content: ['./src/**/*.{html,js,svelte,ts}'],
|
|
44
|
+
theme: {
|
|
45
|
+
extend: {
|
|
46
|
+
colors: {
|
|
47
|
+
'primary': '#3b82f6',
|
|
48
|
+
'secondary': '#8b5cf6'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Environment Variables
|
|
56
|
+
|
|
57
|
+
Create a `.env` file in the project root for environment-specific settings:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
VITE_APP_NAME=My Documentation
|
|
61
|
+
VITE_API_URL=https://api.example.com
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Access in your code:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
const appName = import.meta.env.VITE_APP_NAME;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Site Metadata
|
|
71
|
+
|
|
72
|
+
Customize site metadata in your layout or config:
|
|
73
|
+
|
|
74
|
+
```svelte
|
|
75
|
+
<svelte:head>
|
|
76
|
+
<title>My Documentation | Project Name</title>
|
|
77
|
+
<meta name="description" content="Complete documentation for my project" />
|
|
78
|
+
</svelte:head>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Advanced Customization
|
|
82
|
+
|
|
83
|
+
### Custom Components
|
|
84
|
+
|
|
85
|
+
Create custom Svelte components and import them in your markdown:
|
|
86
|
+
|
|
87
|
+
```svelte
|
|
88
|
+
<script lang="ts">
|
|
89
|
+
import CustomComponent from '$lib/CustomComponent.svelte';
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<CustomComponent prop="value" />
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Custom Styles
|
|
96
|
+
|
|
97
|
+
Add global styles in `src/app.css`:
|
|
98
|
+
|
|
99
|
+
```css
|
|
100
|
+
@layer components {
|
|
101
|
+
.custom-class {
|
|
102
|
+
@apply px-4 py-2 rounded-lg bg-blue-500 text-white;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Performance Tuning
|
|
108
|
+
|
|
109
|
+
### Image Optimization
|
|
110
|
+
|
|
111
|
+
Use the Image component for optimized images:
|
|
112
|
+
|
|
113
|
+
```svelte
|
|
114
|
+
<Image
|
|
115
|
+
src="/images/screenshot.png"
|
|
116
|
+
alt="Screenshot"
|
|
117
|
+
loading="lazy"
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Code Splitting
|
|
122
|
+
|
|
123
|
+
Use dynamic imports for large components:
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
const HeavyComponent = dynamic(() => import('$lib/Heavy.svelte'));
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## SEO Configuration
|
|
130
|
+
|
|
131
|
+
Configure SEO settings:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"seo": {
|
|
136
|
+
"siteName": "My Docs",
|
|
137
|
+
"description": "Complete documentation",
|
|
138
|
+
"keywords": ["docs", "guide", "tutorial"],
|
|
139
|
+
"social": {
|
|
140
|
+
"twitter": "@myproject",
|
|
141
|
+
"github": "myorg/mydocs"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy to GitHub Pages
|
|
3
|
+
description: Deploy your documentation site to GitHub Pages
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitHub Pages Deployment
|
|
7
|
+
|
|
8
|
+
Deploy your documentation site to GitHub Pages for free hosting directly from your GitHub repository.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- GitHub account with repository containing your docs
|
|
13
|
+
- Repository must be public (for free GitHub Pages)
|
|
14
|
+
|
|
15
|
+
## Step-by-Step Guide
|
|
16
|
+
|
|
17
|
+
### 1. Enable GitHub Pages
|
|
18
|
+
|
|
19
|
+
1. Go to your repository settings
|
|
20
|
+
2. Scroll to "GitHub Pages" section
|
|
21
|
+
3. Under "Source", select "GitHub Actions"
|
|
22
|
+
4. Save settings
|
|
23
|
+
|
|
24
|
+
### 2. Create GitHub Actions Workflow
|
|
25
|
+
|
|
26
|
+
Create `.github/workflows/deploy.yml`:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
name: Deploy to GitHub Pages
|
|
30
|
+
|
|
31
|
+
on:
|
|
32
|
+
push:
|
|
33
|
+
branches:
|
|
34
|
+
- main
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
build_and_deploy:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
- name: Setup Node.js
|
|
44
|
+
uses: actions/setup-node@v3
|
|
45
|
+
with:
|
|
46
|
+
node-version: '18'
|
|
47
|
+
cache: 'npm'
|
|
48
|
+
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: npm install
|
|
51
|
+
|
|
52
|
+
- name: Build
|
|
53
|
+
run: npm run build
|
|
54
|
+
|
|
55
|
+
- name: Upload artifact
|
|
56
|
+
uses: actions/upload-pages-artifact@v2
|
|
57
|
+
with:
|
|
58
|
+
path: './build'
|
|
59
|
+
|
|
60
|
+
- name: Deploy to GitHub Pages
|
|
61
|
+
id: deployment
|
|
62
|
+
uses: actions/deploy-pages@v2
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Push Workflow File
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git add .github/workflows/deploy.yml
|
|
69
|
+
git commit -m "Add GitHub Pages deployment workflow"
|
|
70
|
+
git push origin main
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 4. Monitor Deployment
|
|
74
|
+
|
|
75
|
+
1. Go to "Actions" tab in your repository
|
|
76
|
+
2. Watch the workflow run
|
|
77
|
+
3. Once complete, your site is live at:
|
|
78
|
+
- `https://yourusername.github.io/repo-name` (for project repo)
|
|
79
|
+
- `https://yourusername.github.io` (for `yourusername.github.io` repo)
|
|
80
|
+
|
|
81
|
+
## Configure Base URL
|
|
82
|
+
|
|
83
|
+
If deploying to a project repository (not your username repo), update `svelte.config.js`:
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
import adapter from '@sveltejs/adapter-static';
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
kit: {
|
|
90
|
+
adapter: adapter({
|
|
91
|
+
pages: 'build',
|
|
92
|
+
assets: 'build',
|
|
93
|
+
fallback: 'index.html'
|
|
94
|
+
}),
|
|
95
|
+
prerender: {
|
|
96
|
+
entries: ['*']
|
|
97
|
+
},
|
|
98
|
+
paths: {
|
|
99
|
+
base: '/repo-name' // Set this to your repo name
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Also update links in your docs to use the base path:
|
|
106
|
+
|
|
107
|
+
```svelte
|
|
108
|
+
<a href={`${base}/docs`}>Docs</a>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Custom Domain
|
|
112
|
+
|
|
113
|
+
### Setup Custom Domain on GitHub Pages
|
|
114
|
+
|
|
115
|
+
1. Go to repository Settings → Pages
|
|
116
|
+
2. Under "Custom domain", enter your domain (e.g., `docs.example.com`)
|
|
117
|
+
3. Click "Save"
|
|
118
|
+
|
|
119
|
+
### Update DNS Records
|
|
120
|
+
|
|
121
|
+
Add a `CNAME` record in your domain registrar:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
CNAME docs yourusername.github.io
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or use an A record pointing to GitHub's IP addresses.
|
|
128
|
+
|
|
129
|
+
### Enable HTTPS
|
|
130
|
+
|
|
131
|
+
GitHub Pages automatically provides free HTTPS via Let's Encrypt.
|
|
132
|
+
|
|
133
|
+
If the domain shows as insecure:
|
|
134
|
+
1. Wait a few minutes for HTTPS to be provisioned
|
|
135
|
+
2. Check "Enforce HTTPS" box in Pages settings
|
|
136
|
+
|
|
137
|
+
## Automatic Deployments
|
|
138
|
+
|
|
139
|
+
Every push to the main branch automatically triggers a deployment:
|
|
140
|
+
|
|
141
|
+
1. Changes are pushed to GitHub
|
|
142
|
+
2. GitHub Actions workflow runs
|
|
143
|
+
3. Build completes and deploys to GitHub Pages
|
|
144
|
+
4. Your site updates automatically
|
|
145
|
+
|
|
146
|
+
Check the "Actions" tab to monitor deployment progress.
|
|
147
|
+
|
|
148
|
+
## Rollback Deployments
|
|
149
|
+
|
|
150
|
+
To rollback to a previous version:
|
|
151
|
+
|
|
152
|
+
1. Go to "Actions" tab
|
|
153
|
+
2. Find a previous successful workflow run
|
|
154
|
+
3. Click "Re-run jobs"
|
|
155
|
+
4. Workflow redeploys with the previous code
|
|
156
|
+
|
|
157
|
+
## Troubleshooting
|
|
158
|
+
|
|
159
|
+
### Workflow Fails
|
|
160
|
+
|
|
161
|
+
Check the workflow logs:
|
|
162
|
+
1. Go to "Actions" tab
|
|
163
|
+
2. Click on failed workflow
|
|
164
|
+
3. View step details for errors
|
|
165
|
+
|
|
166
|
+
Common issues:
|
|
167
|
+
- Node version mismatch: Update `node-version` in workflow
|
|
168
|
+
- Missing dependencies: Ensure all packages in `package.json`
|
|
169
|
+
- Build errors: Run `npm run build` locally to test
|
|
170
|
+
|
|
171
|
+
### Site Not Updating
|
|
172
|
+
|
|
173
|
+
- Clear browser cache (Ctrl+Shift+Del)
|
|
174
|
+
- Wait a few minutes for DNS propagation
|
|
175
|
+
- Check GitHub Actions workflow completed successfully
|
|
176
|
+
- Verify files in the `build` directory exist
|
|
177
|
+
|
|
178
|
+
### Custom Domain Not Working
|
|
179
|
+
|
|
180
|
+
- Verify DNS records are correct
|
|
181
|
+
- Wait 24 hours for DNS propagation
|
|
182
|
+
- Ensure CNAME record points to GitHub Pages
|
|
183
|
+
- Check domain is not redirecting elsewhere
|
|
184
|
+
|
|
185
|
+
## Performance Tips
|
|
186
|
+
|
|
187
|
+
### Optimize Build
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
- name: Build
|
|
191
|
+
run: npm run build
|
|
192
|
+
env:
|
|
193
|
+
VITE_INLINE_BUILD_ASSETS: 'true'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Enable Caching
|
|
197
|
+
|
|
198
|
+
The workflow example above includes npm cache:
|
|
199
|
+
```yaml
|
|
200
|
+
- uses: actions/setup-node@v3
|
|
201
|
+
with:
|
|
202
|
+
cache: 'npm'
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Minify Assets
|
|
206
|
+
|
|
207
|
+
Enable minification in `vite.config.ts`:
|
|
208
|
+
```typescript
|
|
209
|
+
build: {
|
|
210
|
+
minify: 'terser'
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Advanced Configuration
|
|
215
|
+
|
|
216
|
+
### Deploy on Schedule
|
|
217
|
+
|
|
218
|
+
Automatically rebuild docs daily:
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
on:
|
|
222
|
+
schedule:
|
|
223
|
+
- cron: '0 0 * * *' # Daily at midnight
|
|
224
|
+
push:
|
|
225
|
+
branches:
|
|
226
|
+
- main
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Deploy to Multiple Branches
|
|
230
|
+
|
|
231
|
+
Deploy from different branches to different sites:
|
|
232
|
+
|
|
233
|
+
```yaml
|
|
234
|
+
on:
|
|
235
|
+
push:
|
|
236
|
+
branches:
|
|
237
|
+
- main
|
|
238
|
+
- staging
|
|
239
|
+
- develop
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Limitations
|
|
243
|
+
|
|
244
|
+
- GitHub Pages serves static files only
|
|
245
|
+
- No serverless functions (use Vercel or Netlify instead)
|
|
246
|
+
- Build time limited to 10 minutes
|
|
247
|
+
- 1 GB soft storage limit
|
|
248
|
+
- 100 GB/month bandwidth limit
|
|
249
|
+
|
|
250
|
+
## Next Steps
|
|
251
|
+
|
|
252
|
+
- Set up branch protection to require workflow success
|
|
253
|
+
- Configure automatic PR comments with preview links
|
|
254
|
+
- Set up notifications for deployment failures
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy to Netlify
|
|
3
|
+
description: Deploy your documentation site to Netlify
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Netlify Deployment
|
|
7
|
+
|
|
8
|
+
Deploy your documentation site to Netlify with continuous deployment.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- GitHub account and repository with your docs
|
|
13
|
+
- Netlify account (free at https://netlify.com)
|
|
14
|
+
|
|
15
|
+
## Step-by-Step Guide
|
|
16
|
+
|
|
17
|
+
### 1. Connect Your Repository
|
|
18
|
+
|
|
19
|
+
1. Sign in to Netlify at https://app.netlify.com
|
|
20
|
+
2. Click "Add new site"
|
|
21
|
+
3. Select "Import an existing project"
|
|
22
|
+
4. Choose "GitHub" and authorize Netlify
|
|
23
|
+
5. Select your docs repository
|
|
24
|
+
|
|
25
|
+
### 2. Configure Build Settings
|
|
26
|
+
|
|
27
|
+
Netlify should auto-detect most settings:
|
|
28
|
+
|
|
29
|
+
- **Base directory:** (leave empty)
|
|
30
|
+
- **Build command:** `npm run build`
|
|
31
|
+
- **Publish directory:** `build`
|
|
32
|
+
|
|
33
|
+
### 3. Add Environment Variables
|
|
34
|
+
|
|
35
|
+
If your site needs environment variables:
|
|
36
|
+
|
|
37
|
+
1. Go to Site Settings → Environment
|
|
38
|
+
2. Click "Add environment variable"
|
|
39
|
+
3. Add variables like:
|
|
40
|
+
- `VITE_API_URL=https://api.example.com`
|
|
41
|
+
- `NODE_ENV=production`
|
|
42
|
+
|
|
43
|
+
### 4. Deploy
|
|
44
|
+
|
|
45
|
+
Click "Deploy site" and wait for the build to complete.
|
|
46
|
+
|
|
47
|
+
Your site will be available at `https://your-site.netlify.app`
|
|
48
|
+
|
|
49
|
+
## Custom Domain
|
|
50
|
+
|
|
51
|
+
1. Go to Site Settings → Domain settings
|
|
52
|
+
2. Add your custom domain
|
|
53
|
+
3. Update your domain's DNS settings to point to Netlify
|
|
54
|
+
4. Verify in domain settings
|
|
55
|
+
|
|
56
|
+
### Free SSL Certificate
|
|
57
|
+
|
|
58
|
+
Netlify automatically provides a free SSL certificate via Let's Encrypt.
|
|
59
|
+
|
|
60
|
+
## Continuous Deployment
|
|
61
|
+
|
|
62
|
+
Every push to your main branch automatically triggers a new deployment:
|
|
63
|
+
|
|
64
|
+
1. Changes are committed and pushed to GitHub
|
|
65
|
+
2. Netlify webhook triggers a build
|
|
66
|
+
3. Build completes and deploys to production
|
|
67
|
+
4. Your site updates automatically
|
|
68
|
+
|
|
69
|
+
### Preview Deployments
|
|
70
|
+
|
|
71
|
+
Push to a feature branch to create a preview deployment:
|
|
72
|
+
- Accessible at `https://branch-name--your-site.netlify.app`
|
|
73
|
+
- Great for testing before merging to main
|
|
74
|
+
|
|
75
|
+
## Deployment Controls
|
|
76
|
+
|
|
77
|
+
### Manual Deploy
|
|
78
|
+
|
|
79
|
+
Redeploy current branch:
|
|
80
|
+
1. Go to "Deploys" tab
|
|
81
|
+
2. Click on a deployment
|
|
82
|
+
3. Click "Publish deploy"
|
|
83
|
+
|
|
84
|
+
### Rollback
|
|
85
|
+
|
|
86
|
+
Revert to a previous deployment:
|
|
87
|
+
1. Go to "Deploys" tab
|
|
88
|
+
2. Find the deployment to rollback to
|
|
89
|
+
3. Click "Publish deploy"
|
|
90
|
+
|
|
91
|
+
## Build Logs
|
|
92
|
+
|
|
93
|
+
View detailed build logs in "Deploys" tab:
|
|
94
|
+
- Build steps and console output
|
|
95
|
+
- Error messages and warnings
|
|
96
|
+
- Deployment duration
|
|
97
|
+
|
|
98
|
+
## Monitoring & Analytics
|
|
99
|
+
|
|
100
|
+
Access site analytics:
|
|
101
|
+
- Go to "Analytics" tab
|
|
102
|
+
- Track page views and user behavior
|
|
103
|
+
- Monitor site performance
|
|
104
|
+
|
|
105
|
+
## Troubleshooting
|
|
106
|
+
|
|
107
|
+
### Build Fails
|
|
108
|
+
|
|
109
|
+
1. Check build logs for errors
|
|
110
|
+
2. Verify build command: `npm run build`
|
|
111
|
+
3. Ensure all dependencies are listed in `package.json`
|
|
112
|
+
4. Run `npm run check` locally to verify types
|
|
113
|
+
|
|
114
|
+
### Site Returns 404
|
|
115
|
+
|
|
116
|
+
- Check publish directory is set to `build`
|
|
117
|
+
- Verify files exist in build output
|
|
118
|
+
- Check redirect rules in `netlify.toml`
|
|
119
|
+
|
|
120
|
+
### Performance Issues
|
|
121
|
+
|
|
122
|
+
Review performance in Analytics tab:
|
|
123
|
+
- Optimize images and assets
|
|
124
|
+
- Consider using Netlify's image optimization
|
|
125
|
+
- Enable caching strategies
|
|
126
|
+
|
|
127
|
+
## Advanced Configuration
|
|
128
|
+
|
|
129
|
+
### Netlify Configuration File
|
|
130
|
+
|
|
131
|
+
Create `netlify.toml` in your project root:
|
|
132
|
+
|
|
133
|
+
```toml
|
|
134
|
+
[build]
|
|
135
|
+
command = "npm run build"
|
|
136
|
+
publish = "build"
|
|
137
|
+
|
|
138
|
+
[env]
|
|
139
|
+
VITE_API_URL = "https://api.example.com"
|
|
140
|
+
|
|
141
|
+
[[redirects]]
|
|
142
|
+
from = "/*"
|
|
143
|
+
to = "/index.html"
|
|
144
|
+
status = 200
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Build Plugins
|
|
148
|
+
|
|
149
|
+
Enhance your build with Netlify plugins:
|
|
150
|
+
```toml
|
|
151
|
+
[[plugins]]
|
|
152
|
+
package = "@netlify/plugin-nextjs"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Next Steps
|
|
156
|
+
|
|
157
|
+
- Set up form submission handling with Netlify Forms
|
|
158
|
+
- Configure serverless functions if needed
|
|
159
|
+
- Set up automatic backups of your documentation
|