Skip to content

Commit ce8b05f

Browse files
committed
docs: fix formatting and organization across documentation and configuration
- Adjust indentation consistency in code examples across documentation files. - Standardize the ordering of properties, such as `dependencies` and `keywords`, in package manifests. - Fix formatting issues in YAML workflows and JSON configurations for better readability. - Enhance code snippet clarity by reordering destructured properties in examples.
1 parent 9d709a2 commit ce8b05f

30 files changed

+308
-303
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
- main
77
paths:
88
- 'packages/**'
9-
- 'package.json'
10-
- 'pnpm-lock.yaml'
11-
- '.github/workflows/ci.yml'
9+
- package.json
10+
- pnpm-lock.yaml
11+
- .github/workflows/ci.yml
1212
pull_request:
1313
branches:
1414
- main
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/setup-node@v5
3232
with:
3333
node-version: 20
34-
cache: 'pnpm'
34+
cache: pnpm
3535

3636
- name: Install dependencies
3737
run: pnpm install
@@ -53,7 +53,7 @@ jobs:
5353
uses: actions/setup-node@v5
5454
with:
5555
node-version: 20
56-
cache: 'pnpm'
56+
cache: pnpm
5757

5858
- name: Install dependencies
5959
run: pnpm install
@@ -74,7 +74,7 @@ jobs:
7474
uses: actions/setup-node@v5
7575
with:
7676
node-version: 20
77-
cache: 'pnpm'
77+
cache: pnpm
7878

7979
- name: Install dependencies
8080
run: pnpm install

.github/workflows/deploy-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths:
88
- 'packages/docs/**'
99
- 'packages/core/**'
10-
- '.github/workflows/deploy-docs.yml'
10+
- .github/workflows/deploy-docs.yml
1111
workflow_dispatch:
1212

1313
concurrency:
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/setup-node@v5
3434
with:
3535
node-version: 20
36-
cache: 'pnpm'
36+
cache: pnpm
3737

3838
- name: Install dependencies
3939
run: pnpm install --frozen-lockfile

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
- main
77
paths:
88
- 'packages/**'
9-
- 'package.json'
10-
- 'pnpm-lock.yaml'
11-
- 'pnpm-workspace.yaml'
9+
- package.json
10+
- pnpm-lock.yaml
11+
- pnpm-workspace.yaml
1212
- '.changeset/**'
1313

1414
concurrency:
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/setup-node@v5
3737
with:
3838
node-version: 20
39-
cache: 'pnpm'
39+
cache: pnpm
4040
registry-url: 'https://registry.npmjs.org'
4141

4242
- name: Install dependencies

eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export default antfu(
55
ignores: [
66
'src/**/*.generated.*',
77
'.nuxt',
8-
'.junie/*'
8+
'.junie/*',
9+
'**/*/*.md'
910
],
1011
stylistic: {
1112
overrides: {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "root",
33
"type": "module",
44
"version": "1.0.0",
5+
"packageManager": "[email protected]",
56
"scripts": {
67
"build": "pnpm run build:core && pnpm run build:nuxt && pnpm run build:docs",
78
"build:core": "pnpm --filter @vue3-apollo/core run build",
@@ -30,6 +31,5 @@
3031
"eslint-plugin-perfectionist": "^4.15.1",
3132
"typescript": "^5.9.3",
3233
"unbuild": "^3.6.1"
33-
},
34-
"packageManager": "[email protected]"
35-
}
34+
}
35+
}

packages/core/README.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,32 @@ npm install @vue3-apollo/core @apollo/client graphql
2626
### 1. Create an Apollo Client
2727

2828
```ts
29-
import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client/core'
29+
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client/core'
3030

3131
export const defaultClient = new ApolloClient({
32-
cache: new InMemoryCache(),
33-
link: new HttpLink({
32+
cache: new InMemoryCache(),
33+
link: new HttpLink({
3434
// Example public GraphQL API
35-
uri: 'https://graphqlplaceholder.vercel.app/graphql',
36-
}),
35+
uri: 'https://graphqlplaceholder.vercel.app/graphql',
36+
}),
3737
})
3838
```
3939

4040
### 2. Register the Plugin
4141

4242
```ts
43-
import { createApp } from 'vue'
4443
import { apolloPlugin } from '@vue3-apollo/core'
45-
import { defaultClient, analyticsClient } from './apollo-clients'
44+
import { createApp } from 'vue'
45+
46+
import { analyticsClient, defaultClient } from './apollo-clients'
4647

4748
const app = createApp(App)
4849

4950
app.use(apolloPlugin, {
50-
clients: {
51-
default: defaultClient,
52-
analytics: analyticsClient,
53-
},
51+
clients: {
52+
analytics: analyticsClient,
53+
default: defaultClient,
54+
},
5455
})
5556
```
5657

@@ -73,12 +74,16 @@ const GET_POSTS = gql`
7374
}
7475
`
7576
76-
const { result, loading, error } = useQuery(GET_POSTS)
77+
const { error, loading, result } = useQuery(GET_POSTS)
7778
</script>
7879
7980
<template>
80-
<div v-if="loading">Loading...</div>
81-
<div v-else-if="error">{{ error.message }}</div>
81+
<div v-if="loading">
82+
Loading...
83+
</div>
84+
<div v-else-if="error">
85+
{{ error.message }}
86+
</div>
8287
<ul v-else>
8388
<li v-for="post in result.posts" :key="post.id">
8489
<strong>{{ post.title }}</strong> — {{ post.body }}
@@ -108,7 +113,7 @@ You can register and switch between multiple clients:
108113

109114
```ts
110115
const { result: analyticsData } = useQuery(ANALYTICS_QUERY, null, {
111-
clientId: 'analytics',
116+
clientId: 'analytics',
112117
})
113118
```
114119

@@ -117,7 +122,7 @@ const { result: analyticsData } = useQuery(ANALYTICS_QUERY, null, {
117122
All composables are fully typed, providing autocompletion and inference for query variables and responses.
118123

119124
```ts
120-
const { result } = useQuery<{ posts: { id: string; title: string }[] }>(GET_POSTS)
125+
const { result } = useQuery<{ posts: { id: string, title: string }[] }>(GET_POSTS)
121126
```
122127

123128
## 🧑‍💻 Contributing
@@ -141,4 +146,4 @@ pnpm dev:docs
141146
- 🌐 [Documentation](https://vue3-apollo.guen.dev/)
142147
- 💾 [GitHub Repository](https://github.com/guendev/vue3-apollo)
143148
- 📦 [npm - @vue3-apollo/core](https://www.npmjs.com/package/@vue3-apollo/core)
144-
- 🧱 [Nuxt Integration - @vue3-apollo/nuxt](https://www.npmjs.com/package/@vue3-apollo/nuxt)
149+
- 🧱 [Nuxt Integration - @vue3-apollo/nuxt](https://www.npmjs.com/package/@vue3-apollo/nuxt)

packages/core/package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
{
22
"name": "@vue3-apollo/core",
3+
"type": "module",
34
"version": "1.1.0",
5+
"packageManager": "[email protected]",
46
"description": "Composable Apollo Client utilities for Vue 3.",
5-
"keywords": [
6-
"vue",
7-
"vue3",
8-
"apollo",
9-
"graphql",
10-
"composables",
11-
"client"
12-
],
13-
"license": "MIT",
147
"author": "Guen <[email protected]>",
8+
"license": "MIT",
159
"homepage": "https://github.com/guendev/vue3-apollo#readme",
1610
"repository": {
1711
"type": "git",
@@ -20,10 +14,15 @@
2014
"bugs": {
2115
"url": "https://github.com/guendev/vue3-apollo/issues"
2216
},
23-
"type": "module",
24-
"main": "./dist/index.cjs",
25-
"module": "./dist/index.js",
26-
"types": "./dist/index.d.ts",
17+
"keywords": [
18+
"vue",
19+
"vue3",
20+
"apollo",
21+
"graphql",
22+
"composables",
23+
"client"
24+
],
25+
"sideEffects": false,
2726
"exports": {
2827
".": {
2928
"types": "./dist/index.d.ts",
@@ -33,6 +32,9 @@
3332
},
3433
"./package.json": "./package.json"
3534
},
35+
"main": "./dist/index.cjs",
36+
"module": "./dist/index.js",
37+
"types": "./dist/index.d.ts",
3638
"typesVersions": {
3739
"*": {
3840
"*": [
@@ -42,10 +44,12 @@
4244
}
4345
},
4446
"files": [
45-
"dist",
46-
"README.md"
47+
"README.md",
48+
"dist"
4749
],
48-
"sideEffects": false,
50+
"engines": {
51+
"node": ">=18.0.0"
52+
},
4953
"scripts": {
5054
"dev": "tsup --config tsup.config.ts --watch",
5155
"build": "tsup --config tsup.config.ts",
@@ -67,13 +71,9 @@
6771
"tsup": "^8.5.0",
6872
"typescript": "^5.9.3"
6973
},
70-
"packageManager": "[email protected]",
71-
"engines": {
72-
"node": ">=18.0.0"
73-
},
7474
"publishConfig": {
7575
"access": "public",
7676
"registry": "https://registry.npmjs.org/",
7777
"provenance": true
7878
}
79-
}
79+
}

packages/docs/advance/tracking.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import { useApolloTracking } from 'vue3-apollo'
2626
const loading = ref(false)
2727

2828
useApolloTracking({
29-
state: loading,
30-
type: 'queries',
29+
state: loading,
30+
type: 'queries',
3131
})
3232

3333
// later
@@ -103,26 +103,27 @@ import { ref } from 'vue'
103103
import { useApolloTracking } from 'vue3-apollo'
104104

105105
export function useSaveItem() {
106-
const saving = ref(false)
107-
108-
useApolloTracking({
109-
state: saving,
110-
type: 'mutations',
111-
})
112-
113-
const run = async (input: any) => {
114-
try {
115-
saving.value = true
116-
// await apolloClient.mutate(...)
117-
} finally {
118-
saving.value = false
106+
const saving = ref(false)
107+
108+
useApolloTracking({
109+
state: saving,
110+
type: 'mutations',
111+
})
112+
113+
const run = async (input: any) => {
114+
try {
115+
saving.value = true
116+
// await apolloClient.mutate(...)
117+
}
118+
finally {
119+
saving.value = false
120+
}
119121
}
120-
}
121122

122-
return {
123-
saving,
124-
run,
125-
}
123+
return {
124+
run,
125+
saving,
126+
}
126127
}
127128
```
128129

@@ -134,4 +135,4 @@ export function useSaveItem() {
134135

135136
## Errors & edge cases
136137
- Using owner-scoped hooks **outside a component** without an explicit `id` returns `false` (no `uid`).
137-
- If you unmount mid-load, `useApolloTracking` performs cleanup on dispose to avoid counter leaks.
138+
- If you unmount mid-load, `useApolloTracking` performs cleanup on dispose to avoid counter leaks.

packages/docs/composables/useApolloClient.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
# useApolloClient
42
Useful when you want direct access to a specific Apollo Client (e.g., for advanced cache operations, direct queries, or managing multiple clients).
53

@@ -13,7 +11,7 @@ const client = useApolloClient()
1311

1412
// Run a query directly
1513
const result = await client.query({
16-
query: GET_USERS,
14+
query: GET_USERS,
1715
})
1816
```
1917

@@ -24,4 +22,4 @@ const result = await client.query({
2422
- If omitted, returns the first available client (usually the `default` one).
2523

2624
### Returns
27-
- **`ApolloClient`** – the Apollo client instance.
25+
- **`ApolloClient`** – the Apollo client instance.

0 commit comments

Comments
 (0)