Skip to content

Commit bfdd31f

Browse files
ci: Undo merging integrations into examples (TanStack#6821)
* Prepare to add integrations * Move integrations back * Add back missing * Remove test:types
1 parent c190f68 commit bfdd31f

Some content is hidden

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

75 files changed

+887
-126
lines changed

examples/angular/cli-standalone-17/package.json integrations/angular-cli-standalone-17/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"name": "@tanstack/query-example-angular-cli-standalone-17",
2+
"name": "angular-cli-standalone-17",
33
"private": true,
44
"scripts": {
5-
"build": "ng build",
6-
"test:types": "tsc"
5+
"build": "ng build"
76
},
87
"dependencies": {
98
"@angular/animations": "^17.0.8",

examples/react/create-react-app-4/package.json integrations/react-cra4/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tanstack/query-example-react-create-react-app-4",
2+
"name": "react-cra4",
33
"private": true,
44
"scripts": {
55
"build": "cross-env DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=--openssl-legacy-provider react-scripts build"

examples/react/create-react-app-5/package.json integrations/react-cra5/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tanstack/query-example-react-create-react-app-5",
2+
"name": "react-cra5",
33
"private": true,
44
"scripts": {
55
"build": "cross-env DISABLE_ESLINT_PLUGIN=true react-scripts build"

integrations/react-next/.eslintrc.cjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
extends: [
5+
'../../.eslintrc.cjs',
6+
'plugin:react/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
parserOptions: {
10+
tsconfigRootDir: __dirname,
11+
project: './tsconfig.json',
12+
},
13+
settings: {
14+
react: {
15+
version: 'detect',
16+
},
17+
},
18+
}

integrations/react-next/.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts

integrations/react-next/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use client'
2+
3+
import React from 'react'
4+
import { useQuery } from '@tanstack/react-query'
5+
6+
export function ClientComponent() {
7+
const query = useQuery({
8+
queryKey: ['test'],
9+
queryFn: async () => {
10+
await new Promise((r) => setTimeout(r, 1000))
11+
return 'Success'
12+
},
13+
})
14+
15+
if (query.isPending) {
16+
return <div>Loading...</div>
17+
}
18+
19+
if (query.isError) {
20+
return <div>An error has occurred!</div>
21+
}
22+
23+
return <div>{query.data}</div>
24+
}
25.3 KB
Binary file not shown.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import Providers from './providers'
3+
import type { Metadata } from 'next'
4+
5+
export const metadata: Metadata = {
6+
title: 'Create Next App',
7+
description: 'Generated by create next app',
8+
}
9+
10+
export default function RootLayout({
11+
children,
12+
}: {
13+
children: React.ReactNode
14+
}) {
15+
return (
16+
<html lang="en">
17+
<body>
18+
<Providers>{children}</Providers>
19+
</body>
20+
</html>
21+
)
22+
}

integrations/react-next/app/page.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { queryOptions } from '@tanstack/react-query'
3+
import { ClientComponent } from './client-component'
4+
5+
const options = queryOptions({
6+
queryKey: ['foo'],
7+
})
8+
9+
export default function Home() {
10+
return (
11+
<main>
12+
<ClientComponent />
13+
Key: {JSON.stringify(options.queryKey)}
14+
</main>
15+
)
16+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use client'
2+
import * as React from 'react'
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
4+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
5+
6+
export default function Providers({ children }: { children: React.ReactNode }) {
7+
const [queryClient] = React.useState(() => new QueryClient())
8+
9+
return (
10+
<QueryClientProvider client={queryClient}>
11+
{children}
12+
<ReactQueryDevtools />
13+
</QueryClientProvider>
14+
)
15+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
eslint: {
4+
ignoreDuringBuilds: true,
5+
},
6+
}
7+
8+
module.exports = nextConfig

integrations/react-next/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "react-next",
3+
"private": true,
4+
"scripts": {
5+
"build": "next build"
6+
},
7+
"dependencies": {
8+
"@tanstack/react-query": "workspace:*",
9+
"@tanstack/react-query-devtools": "workspace:*",
10+
"next": "^14.0.0",
11+
"react": "^18.2.0",
12+
"react-dom": "^18.2.0"
13+
},
14+
"devDependencies": {
15+
"@types/node": "^18.19.3",
16+
"@types/react": "^18.2.45",
17+
"@types/react-dom": "^18.2.18",
18+
"typescript": "5.2.2"
19+
}
20+
}

integrations/react-next/tsconfig.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"module": "esnext",
12+
"moduleResolution": "bundler",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"jsx": "preserve",
16+
"incremental": true,
17+
"plugins": [
18+
{
19+
"name": "next"
20+
}
21+
],
22+
"paths": {
23+
"@/*": ["./*"]
24+
}
25+
},
26+
"include": [
27+
"next-env.d.ts",
28+
"**/*.ts",
29+
"**/*.tsx",
30+
".next/types/**/*.ts",
31+
".eslintrc.cjs"
32+
],
33+
"exclude": ["node_modules"]
34+
}

integrations/react-vite/.eslintrc.cjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
extends: [
5+
'../../.eslintrc.cjs',
6+
'plugin:react/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
parserOptions: {
10+
tsconfigRootDir: __dirname,
11+
project: './tsconfig.json',
12+
},
13+
settings: {
14+
react: {
15+
version: 'detect',
16+
},
17+
},
18+
}

integrations/react-vite/.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

integrations/react-vite/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Vite + React</title>
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script type="module" src="/src/main.jsx"></script>
10+
</body>
11+
</html>

integrations/react-vite/package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "react-vite",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "vite build"
7+
},
8+
"dependencies": {
9+
"@tanstack/react-query": "workspace:*",
10+
"@tanstack/react-query-devtools": "workspace:*",
11+
"@vitejs/plugin-react": "^4.2.1",
12+
"react": "^18.2.0",
13+
"react-dom": "^18.2.0",
14+
"vite": "^5.0.10"
15+
}
16+
}

integrations/react-vite/src/App.jsx

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react'
2+
import { useQuery } from '@tanstack/react-query'
3+
4+
const App = () => {
5+
const query = useQuery({
6+
queryKey: ['test'],
7+
queryFn: async () => {
8+
await new Promise((r) => setTimeout(r, 1000))
9+
return 'Success'
10+
},
11+
})
12+
13+
if (query.isPending) {
14+
return <div>Loading...</div>
15+
}
16+
17+
if (query.isError) {
18+
return <div>An error has occurred!</div>
19+
}
20+
21+
return <div>{query.data}</div>
22+
}
23+
24+
export default App

integrations/react-vite/src/main.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom/client'
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
4+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
5+
import App from './App.jsx'
6+
7+
const queryClient = new QueryClient()
8+
9+
const root = ReactDOM.createRoot(document.getElementById('root'))
10+
11+
root.render(
12+
<React.StrictMode>
13+
<QueryClientProvider client={queryClient}>
14+
<App />
15+
<ReactQueryDevtools />
16+
</QueryClientProvider>
17+
</React.StrictMode>,
18+
)

integrations/react-vite/tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"allowSyntheticDefaultImports": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"module": "esnext",
13+
"moduleResolution": "node",
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"noEmit": true,
17+
"jsx": "react-jsx"
18+
},
19+
"include": ["src", ".eslintrc.cjs"]
20+
}

0 commit comments

Comments
 (0)