Skip to content

Commit 2aeb0bf

Browse files
ci(examples): test examples in CI (TanStack#6813)
* Update Nx config * Make nextjs examples work * Fix 2 more next examples * Fix solid and svelte examples * Fix react prefetching example * Fix svelte type
1 parent 237e52c commit 2aeb0bf

File tree

31 files changed

+68
-116
lines changed

31 files changed

+68
-116
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ concurrency:
1515

1616
env:
1717
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
18-
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
1918

2019
jobs:
2120
test-and-publish:

.github/workflows/pr.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
env:
15+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1516
NX_CLOUD_DISTRIBUTED_EXECUTION: true
1617
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
17-
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
18-
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
19-
NX_VERBOSE_LOGGING: true
2018

2119
jobs:
2220
main:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}

examples/react/auto-refetching/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tanstack/query-example-react-refetch-interval",
2+
"name": "@tanstack/query-example-react-auto-refetching",
33
"private": true,
44
"main": "index.js",
55
"license": "MIT",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}

examples/react/nextjs/next.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
eslint: {
3+
ignoreDuringBuilds: true,
4+
},
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
3+
4+
export default function MyApp({ Component, pageProps }) {
5+
const [queryClient] = React.useState(() => new QueryClient())
6+
7+
return (
8+
<QueryClientProvider client={queryClient}>
9+
<Component {...pageProps} />
10+
</QueryClientProvider>
11+
)
12+
}

examples/react/prefetching/src/pages/index.js

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import React from 'react'
22
import axios from 'axios'
3-
import {
4-
useQuery,
5-
useQueryClient,
6-
QueryClient,
7-
QueryClientProvider,
8-
} from '@tanstack/react-query'
3+
import { useQuery, useQueryClient } from '@tanstack/react-query'
94
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
105

116
const getCharacters = async () => {
@@ -22,17 +17,7 @@ const getCharacter = async (selectedChar) => {
2217
return data
2318
}
2419

25-
const queryClient = new QueryClient()
26-
27-
export default function App() {
28-
return (
29-
<QueryClientProvider client={queryClient}>
30-
<Example />
31-
</QueryClientProvider>
32-
)
33-
}
34-
35-
function Example() {
20+
export default function Example() {
3621
const queryClient = useQueryClient()
3722
const rerender = React.useState(0)[1]
3823
const [selectedChar, setSelectedChar] = React.useState(1)
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { defineConfig } from 'vite'
2-
import solidPlugin from 'vite-plugin-solid'
2+
import solid from 'vite-plugin-solid'
33

44
export default defineConfig({
5-
plugins: [solidPlugin()],
6-
server: {
7-
port: 3000,
8-
},
9-
build: {
10-
target: 'esnext',
11-
},
12-
resolve: {
13-
preserveSymlinks: true,
14-
},
5+
plugins: [solid()],
156
})
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { defineConfig } from 'vite'
2-
import solidPlugin from 'vite-plugin-solid'
2+
import solid from 'vite-plugin-solid'
33

44
export default defineConfig({
5-
plugins: [solidPlugin()],
6-
server: {
7-
port: 3000,
8-
},
9-
build: {
10-
target: 'esnext',
11-
},
12-
resolve: {
13-
preserveSymlinks: true,
14-
},
5+
plugins: [solid()],
156
})
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { defineConfig } from 'vite'
2-
import solidPlugin from 'vite-plugin-solid'
2+
import solid from 'vite-plugin-solid'
33

44
export default defineConfig({
5-
plugins: [solidPlugin()],
6-
server: {
7-
port: 3000,
8-
},
9-
build: {
10-
target: 'esnext',
11-
},
12-
resolve: {
13-
preserveSymlinks: true,
14-
},
5+
plugins: [solid()],
156
})

examples/solid/simple/vite.config.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { defineConfig } from 'vite'
2-
import solidPlugin from 'vite-plugin-solid'
2+
import solid from 'vite-plugin-solid'
33

44
export default defineConfig({
5-
plugins: [solidPlugin()],
6-
server: {
7-
port: 3000,
8-
},
9-
build: {
10-
target: 'esnext',
11-
},
12-
resolve: {
13-
preserveSymlinks: true,
14-
},
5+
plugins: [solid()],
156
})

examples/svelte/auto-refetching/sandbox.config.json

-5
This file was deleted.

examples/svelte/basic/sandbox.config.json

-5
This file was deleted.

examples/svelte/load-more-infinite-scroll/sandbox.config.json

-5
This file was deleted.

examples/svelte/optimistic-updates-typescript/sandbox.config.json

-5
This file was deleted.

examples/svelte/playground/sandbox.config.json

-5
This file was deleted.

examples/svelte/simple/index.html

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
65
<meta name="viewport" content="width=device-width" />
76
<title>Vite + Svelte + TS</title>
87
</head>

examples/svelte/simple/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "vite",
77
"build": "vite build",
88
"preview": "vite preview",
9-
"check": "svelte-check --tsconfig ./tsconfig.json"
9+
"test:types": "svelte-check --tsconfig ./tsconfig.json"
1010
},
1111
"dependencies": {
1212
"@tanstack/svelte-query": "^5.18.1",
-1.53 KB
Binary file not shown.

examples/svelte/simple/sandbox.config.json

-5
This file was deleted.

examples/svelte/simple/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import './app.css'
22
import App from './App.svelte'
33

44
const app = new App({
5-
target: document.getElementById('app'),
5+
target: document.getElementById('app')!,
66
})
77

88
export default app

examples/svelte/ssr/sandbox.config.json

-5
This file was deleted.

examples/svelte/star-wars/sandbox.config.json

-5
This file was deleted.

nx.json

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
"defaultBase": "main"
55
},
66
"defaultBase": "main",
7-
"pluginsConfig": {
8-
"@nrwl/js": {
9-
"analyzeSourceFiles": false
10-
}
11-
},
127
"nxCloudAccessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ=",
138
"parallel": 5,
149
"namedInputs": {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
1313
"install:csb": "corepack enable && pnpm install --frozen-lockfile",
1414
"test": "pnpm run test:ci",
15-
"test:pr": "nx affected --targets=test:eslint,test:lib,test:types,test:build,build --exclude=examples/**",
16-
"test:ci": "nx run-many --targets=test:format,test:sherif,test:eslint,test:lib,test:types,test:build,build --exclude=examples/**",
15+
"test:pr": "nx affected --targets=test:eslint,test:lib,test:types,test:build,build",
16+
"test:ci": "nx run-many --targets=test:format,test:sherif,test:eslint,test:lib,test:types,test:build,build",
1717
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",
1818
"test:format": "pnpm run prettier --check",
1919
"test:sherif": "sherif --ignore-package \"./integrations/*\"",

0 commit comments

Comments
 (0)