Skip to content

Commit 25aefb1

Browse files
committed
docs: add basic usage docs
1 parent fb671ad commit 25aefb1

File tree

92 files changed

+1176
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1176
-312
lines changed

eslint.config.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import antfu from '@antfu/eslint-config'
22

3-
export default antfu({
4-
vue: true,
5-
typescript: true,
6-
ignores: ['.old'],
7-
rules: {
8-
'ts/no-namespace': 'off',
9-
'ts/no-empty-object-type': 'off',
3+
export default antfu(
4+
{
5+
vue: true,
6+
typescript: true,
7+
ignores: ['src/docs'],
8+
rules: {
9+
'ts/no-namespace': 'off',
10+
'ts/no-empty-object-type': 'off',
11+
'import/first': 'off',
12+
},
1013
},
11-
})
14+
{
15+
files: ['src/docs/**/*'],
16+
rules: {
17+
'import/first': 'off',
18+
},
19+
},
20+
)

packages/docs/.vitepress/config.ts

Lines changed: 96 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,94 @@
11
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
22
import { defineConfig } from 'vitepress'
3-
import typedocSidebar from '../api/typedoc-sidebar.json'
3+
import typedocSidebar from '../api/composable/typedoc-sidebar.json'
4+
5+
// Shared sidebar for guide sections
6+
const guideSidebar = [
7+
{
8+
text: 'Getting Started',
9+
items: [
10+
{ text: 'Introduction', link: '/guide/' },
11+
{ text: 'Why Apollo Client?', link: '/guide/why-apollo' },
12+
{ text: 'Installation', link: '/guide/installation' },
13+
],
14+
},
15+
{
16+
text: 'Core Concepts',
17+
items: [
18+
{ text: 'Queries', link: '/data/queries' },
19+
{ text: 'Mutations', link: '/data/mutations' },
20+
{ text: 'Subscriptions', link: '/data/subscriptions' },
21+
{ text: 'Fragments', link: '/data/fragments' },
22+
{ text: 'Data Masking', link: '/data/data-masking' },
23+
{ text: 'Error Handling', link: '/data/error-handling' },
24+
{ text: 'TypeScript', link: '/data/typescript' },
25+
],
26+
},
27+
{
28+
text: 'Caching',
29+
items: [
30+
{ text: 'Overview', link: '/caching/overview' },
31+
{ text: 'Reading & Writing', link: '/caching/interaction' },
32+
{ text: 'Cache Updates', link: '/caching/cache-updates' },
33+
{ text: 'Optimistic UI', link: '/caching/optimistic-ui' },
34+
],
35+
},
36+
{
37+
text: 'Pagination',
38+
items: [
39+
{ text: 'Overview', link: '/pagination/overview' },
40+
{ text: 'Offset-based', link: '/pagination/offset-based' },
41+
{ text: 'Cursor-based', link: '/pagination/cursor-based' },
42+
],
43+
},
44+
{
45+
text: 'Local State',
46+
items: [
47+
{ text: 'Overview', link: '/local-state/overview' },
48+
{ text: 'Reactive Variables', link: '/local-state/reactive-variables' },
49+
],
50+
},
51+
{
52+
text: 'Advanced',
53+
items: [
54+
{ text: 'Lazy Queries', link: '/advanced/lazy-queries' },
55+
{ text: 'Streaming & @defer', link: '/advanced/streaming' },
56+
{ text: 'Loading States', link: '/advanced/loading-states' },
57+
{ text: 'Multiple Clients', link: '/advanced/multiple-clients' },
58+
{ text: 'Outside Components', link: '/advanced/outside-components' },
59+
],
60+
},
61+
{
62+
text: 'Networking',
63+
items: [
64+
{ text: 'Basic HTTP', link: '/networking/basic-http' },
65+
{ text: 'Authentication', link: '/networking/authentication' },
66+
{ text: 'WebSocket', link: '/networking/websocket' },
67+
],
68+
},
69+
{
70+
text: 'Server-Side Rendering',
71+
items: [
72+
{ text: 'Nuxt', link: '/ssr/nuxt' },
73+
],
74+
},
75+
]
476

577
// https://vitepress.dev/reference/site-config
678
export default defineConfig({
779
title: 'Vue Apollo',
880
description: 'Apollo/GraphQL integration for VueJS',
981
markdown: {
10-
codeTransformers: [transformerTwoslash() as any],
82+
codeTransformers: [
83+
transformerTwoslash({
84+
twoslashOptions: {
85+
extraFiles: {
86+
'shims.d.ts': `
87+
`,
88+
},
89+
},
90+
}) as any,
91+
],
1192
},
1293
head: [['link', { rel: 'icon', href: '/favicon.png' }]],
1394
themeConfig: {
@@ -18,70 +99,31 @@ export default defineConfig({
1899
},
19100
editLink: {
20101
pattern:
21-
'https://github.com/vuejs/apollo/edit/v4/packages/docs/src/:path',
102+
'https://github.com/vuejs/apollo/edit/v4/packages/docs/:path',
22103
},
23104
nav: [
24105
{ text: 'Home', link: '/' },
25106
{ text: 'Guide', link: '/guide/' },
26-
{ text: 'API Reference', link: '/api/' },
107+
{ text: 'API Reference', link: '/api/composable/' },
27108
{
28109
text: 'Sponsor',
29110
link: 'https://github.com/sponsors/Akryum',
30111
},
31112
],
32113

33114
sidebar: {
34-
'/guide/': [
35-
{
36-
text: 'Getting Started',
37-
items: [
38-
{ text: 'Introduction', link: '/guide/' },
39-
{ text: 'Installation', link: '/guide/installation' },
40-
],
41-
},
42-
{
43-
text: 'Next Steps',
44-
items: [
45-
{ text: 'Composition API', link: '/guide-composable/setup' },
46-
],
47-
},
48-
],
49-
'/guide-composable/': [
50-
{
51-
text: 'Composition API',
52-
items: [
53-
{ text: 'Setup', link: '/guide-composable/setup' },
54-
],
55-
},
56-
],
57-
'/guide-option/': [
58-
{
59-
text: 'Option API',
60-
items: [
61-
{ text: 'Setup', link: '/guide-option/setup' },
62-
],
63-
},
64-
],
65-
'/guide-components/': [
66-
{
67-
text: 'Components',
68-
items: [
69-
{ text: 'Setup', link: '/guide-components/setup' },
70-
],
71-
},
72-
],
73-
'/guide-advanced/': [
74-
{
75-
text: 'Advanced',
76-
items: [
77-
{ text: 'Overview', link: '/guide-advanced/' },
78-
],
79-
},
80-
],
81-
'/api/': [
115+
'/guide/': guideSidebar,
116+
'/data/': guideSidebar,
117+
'/caching/': guideSidebar,
118+
'/pagination/': guideSidebar,
119+
'/local-state/': guideSidebar,
120+
'/advanced/': guideSidebar,
121+
'/networking/': guideSidebar,
122+
'/ssr/': guideSidebar,
123+
'/api/composable/': [
82124
{
83125
text: '@vue/apollo-composable',
84-
link: '/api/',
126+
link: '/api/composable/',
85127
items: typedocSidebar,
86128
},
87129
],
@@ -108,4 +150,4 @@ export default defineConfig({
108150
noExternal: ['vue-github-button'],
109151
},
110152
},
111-
})
153+
})
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions

packages/docs/api/@vue/namespaces/provideApolloClient/index.md renamed to packages/docs/api/composable/@vue/namespaces/provideApolloClient/index.md

packages/docs/api/@vue/namespaces/provideApolloClient/type-aliases/Callback.md renamed to packages/docs/api/composable/@vue/namespaces/provideApolloClient/type-aliases/Callback.md

packages/docs/api/@vue/namespaces/provideApolloClient/type-aliases/Result.md renamed to packages/docs/api/composable/@vue/namespaces/provideApolloClient/type-aliases/Result.md

0 commit comments

Comments
 (0)