@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,165 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Callout, Tabs, CodeBlock, Image, APITable, Breadcrumbs } from '$lib';
|
|
3
|
+
|
|
4
|
+
const exampleCode = `function greet(name) {
|
|
5
|
+
return \`Hello, \${name}!\`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
console.log(greet('World'));`;
|
|
9
|
+
|
|
10
|
+
const apiTableColumns = [
|
|
11
|
+
{ key: 'name', label: 'Parameter Name' },
|
|
12
|
+
{ key: 'type', label: 'Type' },
|
|
13
|
+
{ key: 'required', label: 'Required' },
|
|
14
|
+
{ key: 'description', label: 'Description', width: '40%' }
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const apiTableRows = [
|
|
18
|
+
{
|
|
19
|
+
name: 'variant',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: false,
|
|
22
|
+
description: 'The callout type: info, warning, success, or error'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'title',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: false,
|
|
28
|
+
description: 'Optional title for the callout'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'children',
|
|
32
|
+
type: 'HTMLContent',
|
|
33
|
+
required: true,
|
|
34
|
+
description: 'The content to display inside the callout'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const breadcrumbItems = [
|
|
39
|
+
{ label: 'Home', href: '/' },
|
|
40
|
+
{ label: 'Components', href: '/components' },
|
|
41
|
+
{ label: 'Callout' }
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const tabItems = [
|
|
45
|
+
{ label: 'JavaScript', content: '<code>const x = 42;</code>' },
|
|
46
|
+
{ label: 'Python', content: '<code>x = 42</code>' },
|
|
47
|
+
{ label: 'Rust', content: '<code>let x = 42;</code>' }
|
|
48
|
+
];
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<main class="mx-auto max-w-4xl px-6 py-12">
|
|
52
|
+
<h1 class="mb-2 text-4xl font-bold">Documentation Components</h1>
|
|
53
|
+
<p class="mb-8 text-gray-600">A collection of reusable Svelte components for building beautiful documentation.</p>
|
|
54
|
+
|
|
55
|
+
<!-- Breadcrumbs Section -->
|
|
56
|
+
<section class="mb-12">
|
|
57
|
+
<h2 class="mb-4 text-2xl font-bold">Breadcrumbs Navigation</h2>
|
|
58
|
+
<Breadcrumbs items={breadcrumbItems} />
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<!-- Callout Section -->
|
|
62
|
+
<section class="mb-12">
|
|
63
|
+
<h2 class="mb-4 text-2xl font-bold">Callout Components</h2>
|
|
64
|
+
|
|
65
|
+
<h3 class="mb-3 text-xl font-semibold">Info Callout</h3>
|
|
66
|
+
<Callout variant="info" title="Information">
|
|
67
|
+
This is an informational message to guide users through the documentation.
|
|
68
|
+
</Callout>
|
|
69
|
+
|
|
70
|
+
<h3 class="mb-3 mt-6 text-xl font-semibold">Warning Callout</h3>
|
|
71
|
+
<Callout variant="warning" title="Warning">
|
|
72
|
+
Be careful! This action might have unexpected consequences.
|
|
73
|
+
</Callout>
|
|
74
|
+
|
|
75
|
+
<h3 class="mb-3 mt-6 text-xl font-semibold">Success Callout</h3>
|
|
76
|
+
<Callout variant="success" title="Success">
|
|
77
|
+
Great job! Your configuration has been saved successfully.
|
|
78
|
+
</Callout>
|
|
79
|
+
|
|
80
|
+
<h3 class="mb-3 mt-6 text-xl font-semibold">Error Callout</h3>
|
|
81
|
+
<Callout variant="error" title="Error">
|
|
82
|
+
Something went wrong. Please check your input and try again.
|
|
83
|
+
</Callout>
|
|
84
|
+
</section>
|
|
85
|
+
|
|
86
|
+
<!-- CodeBlock Section -->
|
|
87
|
+
<section class="mb-12">
|
|
88
|
+
<h2 class="mb-4 text-2xl font-bold">Code Block</h2>
|
|
89
|
+
<CodeBlock code={exampleCode} language="javascript" filename="example.js" />
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<!-- Tabs Section -->
|
|
93
|
+
<section class="mb-12">
|
|
94
|
+
<h2 class="mb-4 text-2xl font-bold">Tabs Component</h2>
|
|
95
|
+
<Tabs items={tabItems} />
|
|
96
|
+
</section>
|
|
97
|
+
|
|
98
|
+
<!-- API Table Section -->
|
|
99
|
+
<section class="mb-12">
|
|
100
|
+
<h2 class="mb-4 text-2xl font-bold">API Reference Table</h2>
|
|
101
|
+
<APITable title="Callout Component Props" columns={apiTableColumns} rows={apiTableRows} />
|
|
102
|
+
</section>
|
|
103
|
+
|
|
104
|
+
<!-- Image Section -->
|
|
105
|
+
<section class="mb-12">
|
|
106
|
+
<h2 class="mb-4 text-2xl font-bold">Image Component</h2>
|
|
107
|
+
<Image
|
|
108
|
+
src="https://via.placeholder.com/600x400"
|
|
109
|
+
alt="Example placeholder image"
|
|
110
|
+
caption="This is an example image with a caption"
|
|
111
|
+
zoomable={true}
|
|
112
|
+
/>
|
|
113
|
+
</section>
|
|
114
|
+
</main>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
:global(body) {
|
|
118
|
+
background-color: white;
|
|
119
|
+
color: #333;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:global(.dark) :global(body) {
|
|
123
|
+
background-color: #030712;
|
|
124
|
+
color: #f3f4f6;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
main {
|
|
128
|
+
max-width: 56rem;
|
|
129
|
+
margin: 0 auto;
|
|
130
|
+
padding: 3rem 1.5rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
h1 {
|
|
134
|
+
margin-bottom: 0.5rem;
|
|
135
|
+
font-size: 2.25rem;
|
|
136
|
+
font-weight: 700;
|
|
137
|
+
color: #111827;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:global(.dark) h1 {
|
|
141
|
+
color: white;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
h2 {
|
|
145
|
+
margin-bottom: 1rem;
|
|
146
|
+
font-size: 1.5rem;
|
|
147
|
+
font-weight: 700;
|
|
148
|
+
color: #111827;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:global(.dark) h2 {
|
|
152
|
+
color: white;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
h3 {
|
|
156
|
+
margin-bottom: 0.75rem;
|
|
157
|
+
font-size: 1.25rem;
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
color: #111827;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:global(.dark) h3 {
|
|
163
|
+
color: white;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
package/svelte.config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import adapter from '@sveltejs/adapter-static';
|
|
2
|
+
|
|
3
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
4
|
+
const config = {
|
|
5
|
+
kit: {
|
|
6
|
+
adapter: adapter({
|
|
7
|
+
// Pre-render all pages for static site generation
|
|
8
|
+
// This is required for Pagefind to index the site
|
|
9
|
+
precompress: false,
|
|
10
|
+
strict: false
|
|
11
|
+
}),
|
|
12
|
+
prerender: {
|
|
13
|
+
handleHttpError: 'warn'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
content: ['./src/**/*.{html,js,svelte,ts}'],
|
|
5
|
+
theme: {
|
|
6
|
+
extend: {
|
|
7
|
+
colors: {
|
|
8
|
+
// Claude Code aesthetic - professional, clean
|
|
9
|
+
'claude': {
|
|
10
|
+
'bg': '#FFFFFF',
|
|
11
|
+
'bg-secondary': '#F7F6F3',
|
|
12
|
+
'text': '#1A1A1A',
|
|
13
|
+
'text-secondary': '#565656',
|
|
14
|
+
'border': '#ECECEC',
|
|
15
|
+
'accent': '#0066CC',
|
|
16
|
+
'accent-hover': '#0052A3',
|
|
17
|
+
},
|
|
18
|
+
'claude-dark': {
|
|
19
|
+
'bg': '#1A1A1A',
|
|
20
|
+
'bg-secondary': '#2D2D2D',
|
|
21
|
+
'text': '#FFFFFF',
|
|
22
|
+
'text-secondary': '#B0B0B0',
|
|
23
|
+
'border': '#3A3A3A',
|
|
24
|
+
'accent': '#4D94FF',
|
|
25
|
+
'accent-hover': '#6BA3FF',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
fontFamily: {
|
|
29
|
+
'sans': ['-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif'],
|
|
30
|
+
'mono': ['"Fira Code"', '"Source Code Pro"', 'Menlo', 'monospace'],
|
|
31
|
+
},
|
|
32
|
+
typography: (theme: any) => ({
|
|
33
|
+
DEFAULT: {
|
|
34
|
+
css: {
|
|
35
|
+
color: theme('colors.claude.text'),
|
|
36
|
+
a: {
|
|
37
|
+
color: theme('colors.claude.accent'),
|
|
38
|
+
'&:hover': {
|
|
39
|
+
color: theme('colors.claude.accent-hover'),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
code: {
|
|
43
|
+
color: theme('colors.claude.accent'),
|
|
44
|
+
backgroundColor: theme('colors.claude.bg-secondary'),
|
|
45
|
+
padding: '0.25rem 0.5rem',
|
|
46
|
+
borderRadius: '0.25rem',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
plugins: [],
|
|
54
|
+
darkMode: 'class', // Use class-based dark mode
|
|
55
|
+
} satisfies Config;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- develop
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
- develop
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: '18'
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm install
|
|
28
|
+
|
|
29
|
+
- name: Lint and type check
|
|
30
|
+
run: npm run check
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: npm run build
|
|
34
|
+
|
|
35
|
+
- name: Upload build artifacts
|
|
36
|
+
uses: actions/upload-artifact@v3
|
|
37
|
+
with:
|
|
38
|
+
name: build
|
|
39
|
+
path: build/
|
|
40
|
+
retention-days: 1
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build_and_deploy:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
environment:
|
|
19
|
+
name: github-pages
|
|
20
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
|
|
25
|
+
- name: Setup Node.js
|
|
26
|
+
uses: actions/setup-node@v3
|
|
27
|
+
with:
|
|
28
|
+
node-version: '18'
|
|
29
|
+
cache: 'npm'
|
|
30
|
+
|
|
31
|
+
- name: Setup Pages
|
|
32
|
+
uses: actions/configure-pages@v3
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: npm install
|
|
36
|
+
|
|
37
|
+
- name: Build
|
|
38
|
+
run: npm run build
|
|
39
|
+
|
|
40
|
+
- name: Upload artifact
|
|
41
|
+
uses: actions/upload-pages-artifact@v2
|
|
42
|
+
with:
|
|
43
|
+
path: './build'
|
|
44
|
+
|
|
45
|
+
- name: Deploy to GitHub Pages
|
|
46
|
+
id: deployment
|
|
47
|
+
uses: actions/deploy-pages@v2
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Deploy to Netlify
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build_and_deploy:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: '18'
|
|
22
|
+
cache: 'npm'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm install
|
|
26
|
+
|
|
27
|
+
- name: Build
|
|
28
|
+
run: npm run build
|
|
29
|
+
|
|
30
|
+
- name: Deploy to Netlify
|
|
31
|
+
uses: nwtgck/actions-netlify@v2.0
|
|
32
|
+
with:
|
|
33
|
+
publish-dir: './build'
|
|
34
|
+
production-branch: main
|
|
35
|
+
deploy-message: 'Deploy from GitHub Actions'
|
|
36
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
37
|
+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
38
|
+
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
|
|
39
|
+
env:
|
|
40
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Deploy to Vercel
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- staging
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
- staging
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build_and_deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: '18'
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm install
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
run: npm run build
|
|
31
|
+
|
|
32
|
+
- name: Deploy to Vercel (Production)
|
|
33
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
34
|
+
uses: amondnet/vercel-action@v25
|
|
35
|
+
with:
|
|
36
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
37
|
+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
|
38
|
+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
39
|
+
vercel-args: '--prod'
|
|
40
|
+
|
|
41
|
+
- name: Deploy to Vercel (Preview)
|
|
42
|
+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
|
|
43
|
+
uses: amondnet/vercel-action@v25
|
|
44
|
+
with:
|
|
45
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
46
|
+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
|
47
|
+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
48
|
+
|
|
49
|
+
- name: Comment PR with Vercel URL
|
|
50
|
+
if: github.event_name == 'pull_request'
|
|
51
|
+
uses: actions/github-script@v6
|
|
52
|
+
with:
|
|
53
|
+
script: |
|
|
54
|
+
const vercelUrl = process.env.VERCEL_URL || '';
|
|
55
|
+
if (vercelUrl) {
|
|
56
|
+
github.rest.issues.createComment({
|
|
57
|
+
issue_number: context.issue.number,
|
|
58
|
+
owner: context.repo.owner,
|
|
59
|
+
repo: context.repo.repo,
|
|
60
|
+
body: `🚀 [Preview](https://${vercelUrl}) deployed to Vercel!`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
env:
|
|
64
|
+
VERCEL_URL: ${{ steps.deploy.outputs.preview_url }}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# NPM Package Setup for Create Command
|
|
2
|
+
|
|
3
|
+
This template is designed to be published as an npm package that supports the `npm create` command.
|
|
4
|
+
|
|
5
|
+
## Publishing as @andrew-org/create-docs-system
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- npm account with access to @andrew-org organization
|
|
10
|
+
- Authenticated npm CLI (`npm login`)
|
|
11
|
+
|
|
12
|
+
### Package Configuration
|
|
13
|
+
|
|
14
|
+
The `package.json` is pre-configured for:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"name": "@andrew-org/create-docs-system",
|
|
19
|
+
"version": "1.0.0",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"bin": {
|
|
22
|
+
"create-docs-system": "./bin/create.js"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Create Setup Script
|
|
28
|
+
|
|
29
|
+
Create `bin/create.js` for the setup process:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
#!/usr/bin/env node
|
|
33
|
+
import fs from 'fs';
|
|
34
|
+
import path from 'path';
|
|
35
|
+
import { fileURLToPath } from 'url';
|
|
36
|
+
|
|
37
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
38
|
+
const sourceDir = path.join(__dirname, '..', 'template');
|
|
39
|
+
const targetDir = process.argv[2] || 'my-docs';
|
|
40
|
+
|
|
41
|
+
// Copy template files
|
|
42
|
+
fs.cpSync(sourceDir, targetDir, { recursive: true });
|
|
43
|
+
|
|
44
|
+
console.log(`✨ Documentation site created at ${targetDir}`);
|
|
45
|
+
console.log('Next steps:');
|
|
46
|
+
console.log(` cd ${targetDir}`);
|
|
47
|
+
console.log(` npm install`);
|
|
48
|
+
console.log(` npm run dev`);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Steps to Publish
|
|
52
|
+
|
|
53
|
+
1. **Update package.json**
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"name": "@andrew-org/create-docs-system",
|
|
57
|
+
"version": "1.0.0",
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/andrew-org/create-docs-system.git"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. **Create bin/create.js** (setup script above)
|
|
69
|
+
|
|
70
|
+
3. **Test locally**
|
|
71
|
+
```bash
|
|
72
|
+
npm link
|
|
73
|
+
npm create @andrew-org/docs-system@latest my-test-docs
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
4. **Publish to npm**
|
|
77
|
+
```bash
|
|
78
|
+
npm publish
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Usage After Publishing
|
|
82
|
+
|
|
83
|
+
Users can then create a new documentation site with:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm create @andrew-org/docs-system@latest my-docs
|
|
87
|
+
cd my-docs
|
|
88
|
+
npm install
|
|
89
|
+
npm run dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Or with a custom name:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm create @andrew-org/docs-system@latest -- --name my-custom-docs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Testing the Template Locally
|
|
99
|
+
|
|
100
|
+
### Option 1: Direct Copy
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cp -r template-starter my-docs
|
|
104
|
+
cd my-docs
|
|
105
|
+
npm install
|
|
106
|
+
npm run build
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Option 2: npm link (Simulate Published Package)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd template-starter
|
|
113
|
+
npm link
|
|
114
|
+
|
|
115
|
+
# In another terminal, create from it
|
|
116
|
+
npm create linked-package my-docs
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Option 3: Via npm create with Local Path
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npm create file:./template-starter my-docs
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Template Structure for Publishing
|
|
126
|
+
|
|
127
|
+
Ensure the template root contains:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
template-starter/
|
|
131
|
+
├── bin/
|
|
132
|
+
│ └── create.js # Setup script (when published)
|
|
133
|
+
├── docs/
|
|
134
|
+
│ ├── index.md
|
|
135
|
+
│ ├── setup.md
|
|
136
|
+
│ ├── guides/
|
|
137
|
+
│ ├── api/
|
|
138
|
+
│ └── _config.json
|
|
139
|
+
├── src/
|
|
140
|
+
│ ├── routes/
|
|
141
|
+
│ ├── lib/
|
|
142
|
+
│ ├── app.css
|
|
143
|
+
│ ├── app.html
|
|
144
|
+
│ └── app.d.ts
|
|
145
|
+
├── .github/workflows/
|
|
146
|
+
│ ├── build.yml
|
|
147
|
+
│ ├── deploy-github-pages.yml
|
|
148
|
+
│ ├── deploy-netlify.yml
|
|
149
|
+
│ └── deploy-vercel.yml
|
|
150
|
+
├── .gitignore
|
|
151
|
+
├── .npmrc
|
|
152
|
+
├── README.md
|
|
153
|
+
├── package.json
|
|
154
|
+
├── svelte.config.js
|
|
155
|
+
├── tailwind.config.ts
|
|
156
|
+
├── tsconfig.json
|
|
157
|
+
├── vite.config.ts
|
|
158
|
+
├── postcss.config.js
|
|
159
|
+
└── pagefind.toml
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Updating the Package
|
|
163
|
+
|
|
164
|
+
To release a new version:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Update version in package.json
|
|
168
|
+
npm version minor # or major/patch
|
|
169
|
+
|
|
170
|
+
# Publish
|
|
171
|
+
npm publish
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Development Workflow
|
|
175
|
+
|
|
176
|
+
1. Make changes to template files
|
|
177
|
+
2. Test locally by copying template-starter to a test directory
|
|
178
|
+
3. Test build: `npm run build`
|
|
179
|
+
4. Test dev server: `npm run dev`
|
|
180
|
+
5. Update version and publish when ready
|
|
181
|
+
|
|
182
|
+
## Continuous Integration
|
|
183
|
+
|
|
184
|
+
Configure GitHub Actions to:
|
|
185
|
+
- Run tests on the template
|
|
186
|
+
- Build and verify it works
|
|
187
|
+
- Automatically publish on version tags
|
|
188
|
+
|
|
189
|
+
Example workflow (`.github/workflows/publish.yml`):
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
name: Publish to npm
|
|
193
|
+
|
|
194
|
+
on:
|
|
195
|
+
push:
|
|
196
|
+
tags:
|
|
197
|
+
- 'v*'
|
|
198
|
+
|
|
199
|
+
jobs:
|
|
200
|
+
publish:
|
|
201
|
+
runs-on: ubuntu-latest
|
|
202
|
+
steps:
|
|
203
|
+
- uses: actions/checkout@v3
|
|
204
|
+
- uses: actions/setup-node@v3
|
|
205
|
+
with:
|
|
206
|
+
node-version: '18'
|
|
207
|
+
registry-url: 'https://registry.npmjs.org'
|
|
208
|
+
- run: npm install
|
|
209
|
+
- run: npm publish --workspaces
|
|
210
|
+
env:
|
|
211
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Migration from Old Starter Template
|
|
215
|
+
|
|
216
|
+
When upgrading users from an old version:
|
|
217
|
+
|
|
218
|
+
1. Update CHANGELOG.md with breaking changes
|
|
219
|
+
2. Provide migration guide in docs
|
|
220
|
+
3. Maintain backwards compatibility where possible
|
|
221
|
+
4. Test upgrade path
|
|
222
|
+
|
|
223
|
+
## Support
|
|
224
|
+
|
|
225
|
+
For issues with the template, users can:
|
|
226
|
+
- Check documentation in `docs/`
|
|
227
|
+
- Review GitHub issues
|
|
228
|
+
- Submit pull requests
|
|
229
|
+
- Contact @andrew-org organization
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
**Ready for npm publishing!**
|