Skip to content

ci: Undo merging integrations into examples #6821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "@tanstack/query-example-angular-cli-standalone-17",
"name": "angular-cli-standalone-17",
"private": true,
"scripts": {
"build": "ng build",
"test:types": "tsc"
"build": "ng build"
},
"dependencies": {
"@angular/animations": "^17.0.8",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@tanstack/query-example-react-create-react-app-4",
"name": "react-cra4",
"private": true,
"scripts": {
"build": "cross-env DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=--openssl-legacy-provider react-scripts build"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@tanstack/query-example-react-create-react-app-5",
"name": "react-cra5",
"private": true,
"scripts": {
"build": "cross-env DISABLE_ESLINT_PLUGIN=true react-scripts build"
Expand Down
18 changes: 18 additions & 0 deletions integrations/react-next/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: [
'../../.eslintrc.cjs',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
settings: {
react: {
version: 'detect',
},
},
}
35 changes: 35 additions & 0 deletions integrations/react-next/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
34 changes: 34 additions & 0 deletions integrations/react-next/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
24 changes: 24 additions & 0 deletions integrations/react-next/app/client-component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client'

import React from 'react'
import { useQuery } from '@tanstack/react-query'

export function ClientComponent() {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})

if (query.isPending) {
return <div>Loading...</div>
}

if (query.isError) {
return <div>An error has occurred!</div>
}

return <div>{query.data}</div>
}
Binary file added integrations/react-next/app/favicon.ico
Binary file not shown.
22 changes: 22 additions & 0 deletions integrations/react-next/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import Providers from './providers'
import type { Metadata } from 'next'

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>
<Providers>{children}</Providers>
</body>
</html>
)
}
16 changes: 16 additions & 0 deletions integrations/react-next/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import { queryOptions } from '@tanstack/react-query'
import { ClientComponent } from './client-component'

const options = queryOptions({
queryKey: ['foo'],
})

export default function Home() {
return (
<main>
<ClientComponent />
Key: {JSON.stringify(options.queryKey)}
</main>
)
}
15 changes: 15 additions & 0 deletions integrations/react-next/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use client'
import * as React from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'

export default function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = React.useState(() => new QueryClient())

return (
<QueryClientProvider client={queryClient}>
{children}
<ReactQueryDevtools />
</QueryClientProvider>
)
}
8 changes: 8 additions & 0 deletions integrations/react-next/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
}

module.exports = nextConfig
20 changes: 20 additions & 0 deletions integrations/react-next/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "react-next",
"private": true,
"scripts": {
"build": "next build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
"@tanstack/react-query-devtools": "workspace:*",
"next": "^14.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"typescript": "5.2.2"
}
}
34 changes: 34 additions & 0 deletions integrations/react-next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".eslintrc.cjs"
],
"exclude": ["node_modules"]
}
18 changes: 18 additions & 0 deletions integrations/react-vite/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: [
'../../.eslintrc.cjs',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
settings: {
react: {
version: 'detect',
},
},
}
24 changes: 24 additions & 0 deletions integrations/react-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 11 additions & 0 deletions integrations/react-vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions integrations/react-vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "react-vite",
"private": true,
"type": "module",
"scripts": {
"build": "vite build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
"@tanstack/react-query-devtools": "workspace:*",
"@vitejs/plugin-react": "^4.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.0.10"
}
}
24 changes: 24 additions & 0 deletions integrations/react-vite/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import { useQuery } from '@tanstack/react-query'

const App = () => {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})

if (query.isPending) {
return <div>Loading...</div>
}

if (query.isError) {
return <div>An error has occurred!</div>
}

return <div>{query.data}</div>
}

export default App
18 changes: 18 additions & 0 deletions integrations/react-vite/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import App from './App.jsx'

const queryClient = new QueryClient()

const root = ReactDOM.createRoot(document.getElementById('root'))

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
</React.StrictMode>,
)
20 changes: 20 additions & 0 deletions integrations/react-vite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src", ".eslintrc.cjs"]
}
Loading