Skip to content

Commit c66788d

Browse files
committed
feat: add vitepress docs
1 parent f7392fe commit c66788d

File tree

9 files changed

+775
-3
lines changed

9 files changed

+775
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node_modules
88
.temp
99
.tmp
1010
.cache
11+
**/.vitepress/cache
1112

1213
# Yarn
1314
**/.yarn/cache

docs/.vitepress/config.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { resolve } from 'node:path'
2+
import { defineConfig } from 'vitepress'
3+
4+
// https://vitepress.dev/reference/site-config
5+
export default defineConfig({
6+
title: 'vue-composable-starter',
7+
description: 'A Vue Composable',
8+
vite: {
9+
resolve: {
10+
alias: [
11+
{
12+
find: 'vue-composable-starter',
13+
replacement: resolve(__dirname, '../../src/index.ts'),
14+
},
15+
],
16+
},
17+
},
18+
themeConfig: {
19+
// https://vitepress.dev/reference/default-theme-config
20+
nav: [
21+
{ text: 'Home', link: '/' },
22+
{ text: 'Examples', link: '/api-examples' },
23+
],
24+
25+
sidebar: [
26+
{
27+
text: 'Examples',
28+
items: [
29+
{ text: 'Runtime API Examples', link: '/api-examples' },
30+
],
31+
},
32+
],
33+
34+
socialLinks: [
35+
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
36+
],
37+
},
38+
})

docs/api-examples.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# EXAMPLE
6+
7+
<<< @/example.vue
8+
9+
## Results
10+
11+
<script setup>
12+
import Example from './example.vue'
13+
</script>
14+
15+
<Example />

docs/example.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup>
2+
import { useToggle } from 'vue-composable-starter'
3+
4+
const [toggleable, toggle] = useToggle()
5+
</script>
6+
7+
<template>
8+
<button :style="{ background: toggleable ? 'green' : 'red' }" @click="toggle">
9+
Toggle: {{ toggleable }}
10+
</button>
11+
</template>

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# https://vitepress.dev/reference/default-theme-home-page
3+
layout: home
4+
5+
hero:
6+
name: "vue-composable-starter"
7+
text: "A Vue Composable"
8+
tagline: My great project tagline
9+
actions:
10+
- theme: brand
11+
text: API Examples
12+
link: /api-examples
13+
14+
features:
15+
- title: Feature A
16+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
17+
- title: Feature B
18+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
19+
- title: Feature C
20+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
21+
---

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
"dev:vite": "pnpm --filter playgrounds-vite dev",
5252
"build:nuxt": "nuxi build playgrounds",
5353
"start:nuxt": "nuxi preview playgrounds",
54-
"prepare:nuxt": "pnpm --filter playgrounds-nuxt prepare:nuxt"
54+
"prepare:nuxt": "pnpm --filter playgrounds-nuxt prepare:nuxt",
55+
"docs:dev": "vitepress dev docs",
56+
"docs:build": "vitepress build docs",
57+
"docs:preview": "vitepress preview docs"
5558
},
5659
"peerDependencies": {
5760
"vue": ">=3.0.0"
@@ -67,6 +70,7 @@
6770
"lint-staged": "^15.2.10",
6871
"typescript": "^5.6.3",
6972
"unbuild": "^2.0.0",
73+
"vitepress": "^1.5.0",
7074
"vitest": "^2.1.4"
7175
},
7276
"gitHooks": {

0 commit comments

Comments
 (0)