diff --git a/.all-contributorsrc b/.all-contributorsrc deleted file mode 100644 index dc468179c4c..00000000000 --- a/.all-contributorsrc +++ /dev/null @@ -1,141 +0,0 @@ -{ - "projectName": "react-query", - "projectOwner": "tannerlinsley", - "repoType": "github", - "repoHost": "https://github.com", - "files": [ - "README.md" - ], - "imageSize": 100, - "commit": false, - "commitConvention": "none", - "contributors": [ - { - "login": "tannerlinsley", - "name": "Tanner Linsley", - "avatar_url": "https://avatars0.githubusercontent.com/u/5580297?v=4", - "profile": "https://tannerlinsley.com", - "contributions": [ - "code", - "ideas", - "example", - "maintenance", - "review" - ] - }, - { - "login": "cherniavskii", - "name": "Andrew Cherniavskii", - "avatar_url": "https://avatars2.githubusercontent.com/u/13808724?v=4", - "profile": "http://cherniavskii.com", - "contributions": [ - "code", - "bug" - ] - }, - { - "login": "tibotiber", - "name": "Thibaut Tiberghien", - "avatar_url": "https://avatars3.githubusercontent.com/u/5635553?v=4", - "profile": "http://twitter.com/tibotiber", - "contributions": [ - "doc" - ] - }, - { - "login": "gargroh", - "name": "Rohit Garg", - "avatar_url": "https://avatars3.githubusercontent.com/u/42495927?v=4", - "profile": "https://github.com/gargroh", - "contributions": [ - "tool" - ] - }, - { - "login": "Avi98", - "name": "Avinash", - "avatar_url": "https://avatars1.githubusercontent.com/u/26133749?v=4", - "profile": "https://github.com/Avi98", - "contributions": [ - "code", - "bug" - ] - }, - { - "login": "CreativeTechGuy", - "name": "Jason O'Neill", - "avatar_url": "https://avatars1.githubusercontent.com/u/12002072?v=4", - "profile": "https://github.com/CreativeTechGuy", - "contributions": [ - "maintenance", - "test" - ] - }, - { - "login": "bugzpodder", - "name": "Jack Zhao", - "avatar_url": "https://avatars3.githubusercontent.com/u/14841421?v=4", - "profile": "http://fb.me/yz", - "contributions": [ - "code", - "bug" - ] - }, - { - "login": "dpyzo0o", - "name": "dpyzo0o", - "avatar_url": "https://avatars1.githubusercontent.com/u/24768249?v=4", - "profile": "https://github.com/dpyzo0o", - "contributions": [ - "code" - ] - }, - { - "login": "jelteliekens", - "name": "Jelte Liekens", - "avatar_url": "https://avatars1.githubusercontent.com/u/3418474?v=4", - "profile": "https://github.com/jelteliekens", - "contributions": [ - "code" - ] - }, - { - "login": "jgettings", - "name": "Jen Gettings", - "avatar_url": "https://avatars0.githubusercontent.com/u/4183742?v=4", - "profile": "https://github.com/jgettings", - "contributions": [ - "code" - ] - }, - { - "login": "justincy", - "name": "Justin", - "avatar_url": "https://avatars2.githubusercontent.com/u/1037458?v=4", - "profile": "https://github.com/justincy", - "contributions": [ - "code" - ] - }, - { - "login": "MarceloAlves", - "name": "Marcelo Alves", - "avatar_url": "https://avatars1.githubusercontent.com/u/216782?v=4", - "profile": "http://www.marceloalves.com", - "contributions": [ - "code" - ] - }, - { - "login": "zorzysty", - "name": "Zorza", - "avatar_url": "https://avatars0.githubusercontent.com/u/5398733?v=4", - "profile": "https://github.com/zorzysty", - "contributions": [ - "doc" - ] - } - ], - "contributorsPerLine": 7, - "skipCi": true -} diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index bdc7423b3f6..00000000000 --- a/.babelrc.js +++ /dev/null @@ -1,37 +0,0 @@ -const { NODE_ENV, BABEL_ENV } = process.env -const cjs = NODE_ENV === 'test' || BABEL_ENV === 'commonjs' -const loose = true - -module.exports = { - presets: [ - [ - '@babel/env', - { - loose, - modules: false, - exclude: ['@babel/plugin-transform-regenerator'], - }, - ], - '@babel/preset-typescript', - '@babel/react', - ], - plugins: [ - [ - 'const-enum', - { - transform: 'constObject', - }, - ], - 'babel-plugin-transform-async-to-promises', - cjs && ['@babel/transform-modules-commonjs', { loose }], - [ - '@babel/transform-runtime', - { - useESModules: !cjs, - version: require('./package.json').dependencies[ - '@babel/runtime' - ].replace(/^[^0-9]*/, ''), - }, - ], - ].filter(Boolean), -} diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 41bcaa1d381..00000000000 --- a/.browserslistrc +++ /dev/null @@ -1,9 +0,0 @@ -# Browsers we support -> 0.5% -Chrome >= 73 -ChromeAndroid >= 75 -Firefox >= 67 -Edge >= 17 -IE 11 -Safari >= 12.1 -iOS >= 11.3 \ No newline at end of file diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000000..d3af6f132a4 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json", + "changelog": [ + "@svitejs/changesets-changelog-github-compact", + { "repo": "TanStack/query" } + ], + "commit": false, + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "fixed": [], + "linked": [], + "ignore": [], + "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { + "onlyUpdatePeerDependentsWhenOutOfRange": true + } +} diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json deleted file mode 100644 index e9f693a51f3..00000000000 --- a/.codesandbox/ci.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "packages": ["./"], - "sandboxes": ["/examples/basic", "/examples/basic-typescript"], - "node": "14" -} diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index fcf0d28e86d..00000000000 --- a/.eslintrc +++ /dev/null @@ -1,36 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint", "import"], - "extends": [ - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:import/typescript", - "react-app", - "prettier" - ], - "env": { - "es6": true - }, - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-inferrable-types": [ - "error", - { - "ignoreParameters": true - } - ], - "no-shadow": "error", - "import/no-cycle": "error", - "import/no-unresolved": ["error", { "ignore": ["react-query"] }], - "import/no-unused-modules": ["off", { "unusedExports": true }], - "no-redeclare": "off" - } -} diff --git a/.gitattributes b/.gitattributes index dfe0770424b..5a0d5e480b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ # Auto detect text files and perform LF normalization -* text=auto +* text=auto eol=lf diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index fd99b3b17e8..b4b20dcf80a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: tannerlinsley +github: [tannerlinsley, tkdodo] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d7cd68d7f25..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser: [e.g. chrome, safari] - - Version: [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser: [e.g. stock browser, safari] - - Version: [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000000..585b6f1c05d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,133 @@ +name: '๐Ÿ› Bug report' +description: Report a reproducible bug or regression +body: + - type: markdown + attributes: + value: | + Thank you for reporting an issue :pray:. + + This issue tracker is for reporting reproducible bugs or regression's found in [TanStack Query](https://github.com/TanStack/query) + If you have a question about how to achieve something and are struggling, please post a question + inside of TanStack Query's [Discussions tab](https://github.com/TanStack/query/discussions) + + Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already: + - TanStack Query's [Discussions tab](https://github.com/TanStack/query/discussions) + - TanStack Query's [Open Issues](https://github.com/TanStack/query/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) + - TanStack Query's [Closed Issues](https://github.com/TanStack/query/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed) + + The more information you fill in, the better the community can help you. + - type: textarea + id: description + attributes: + label: Describe the bug + description: Provide a clear and concise description of the challenge you are running into. + validations: + required: true + - type: input + id: link + attributes: + label: Your minimal, reproducible example + description: | + Please add a link to a minimal reproduction. + Note: + - Your bug may get fixed much faster if we can run your code and it doesn't have dependencies other than React/Solid/Vue/Svelte. + - To create a shareable code example for web, you can use CodeSandbox (https://codesandbox.io/s/new) or Stackblitz (https://stackblitz.com/). + - Please make sure the example is complete and runnable - e.g. avoid localhost URLs. + - To stub out real api requests - Promise.resolve and Promise.reject are good options for easy reproduction + - Feel free to fork any of the official examples to reproduce your issue: https://tanstack.com/query/latest/docs/framework/react/examples/simple + - For React Native, you can use: https://snack.expo.dev/ + - For TypeScript related issues only, a TypeScript Playground link might be sufficient: https://www.typescriptlang.org/play + - Please read these tips for providing a minimal example: https://stackoverflow.com/help/mcve. + placeholder: | + e.g. Code Sandbox, Stackblitz, Expo Snack or TypeScript playground + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: Describe the steps we have to take to reproduce the behavior. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behavior + description: Provide a clear and concise description of what you expected to happen. + placeholder: | + As a user, I expected ___ behavior but i am seeing ___ + validations: + required: true + - type: dropdown + attributes: + label: How often does this bug happen? + description: | + Following the repro steps above, how easily are you able to reproduce this bug? + options: + - Every time + - Often + - Sometimes + - Only once + - type: textarea + id: screenshots_or_videos + attributes: + label: Screenshots or Videos + description: | + If applicable, add screenshots or a video to help explain your problem. + For more information on the supported file image/file types and the file size limits, please refer + to the following link: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/attaching-files + placeholder: | + You can drag your video or image files inside of this editor โ†“ + - type: textarea + id: platform + attributes: + label: Platform + description: | + Please let us know which Operting System, Browser and Browser version you were using when the issue occurred. + placeholder: | + - OS: [e.g. macOS, Windows, Linux, iOS, Android] + - Browser: [e.g. Chrome, Safari, Firefox, React Native] + - Version: [e.g. 91.1] + validations: + required: true + - type: dropdown + id: adapter + attributes: + label: Tanstack Query adapter + description: | + Please let us know which adapter of TanStack Query you were using when the issue occurred. + options: + - react-query + - solid-query + - svelte-query + - vue-query + - angular-query + - vanilla + - type: input + id: rq-version + attributes: + label: TanStack Query version + description: | + Please let us know the exact version of TanStack Query you were using when the issue occurred. Please don't just put in "latest", as this is subject to change. + placeholder: | + e.g. v5.51.9 + validations: + required: true + - type: input + id: ts-version + attributes: + label: TypeScript version + description: | + If you are using TypeScript, please let us know the exact version of TypeScript you were using when the issue occurred. + placeholder: | + e.g. v5.5.4 + - type: textarea + id: additional + attributes: + label: Additional context + description: Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index b34162a316b..f3372a89ce3 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,11 @@ blank_issues_enabled: false contact_links: - - name: Feature Requests & Questions - url: https://github.com/tannerlinsley/react-query/discussions + - name: ๐Ÿค” Feature Requests & Questions + url: https://github.com/TanStack/query/discussions about: Please ask and answer questions here. - - name: Community Chat + - name: ๐Ÿ’ฌ Community Chat url: https://discord.gg/mQd7egN - about: A dedicated discord server hosted by Tanner Linsley + about: A dedicated discord server hosted by TanStack + - name: ๐Ÿฆ‹ TanStack Bluesky + url: https://bsky.app/profile/tanstack.com + about: Stay up to date with new releases of our libraries diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..5d397ac0a28 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ +## ๐ŸŽฏ Changes + + + +## โœ… Checklist + +- [ ] I have followed the steps in the [Contributing guide](https://github.com/TanStack/query/blob/main/CONTRIBUTING.md). +- [ ] I have tested this code locally with `pnpm run test:pr`. + +## ๐Ÿš€ Release Impact + +- [ ] This change affects published code, and I have generated a [changeset](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md). +- [ ] This change is docs/CI/dev-only (no release). diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 00000000000..3c12db59658 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "configMigration": true, + "extends": [ + "config:recommended", + "group:allNonMajor", + "schedule:weekly", + ":approveMajorUpdates", + ":automergeMinor", + ":disablePeerDependencies", + ":maintainLockFilesMonthly", + ":semanticCommits", + ":semanticCommitTypeAll(chore)" + ], + "ignorePresets": [":ignoreModulesAndTests"], + "labels": ["dependencies"], + "rangeStrategy": "bump", + "postUpdateOptions": ["pnpmDedupe"], + "ignoreDeps": [ + "@types/node", + "@types/react", + "@types/react-dom", + "node", + "react", + "react-dom", + "tsup", + "typescript", + "typescript54", + "typescript55", + "typescript56", + "typescript57", + "typescript58", + "typescript59", + "typescript60", + "vue", + "vue-tsc", + "vue2", + "vue2.7", + "webpack" + ] +} diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 00000000000..8ee586fd6b6 --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,31 @@ +name: autofix.ci # needed to securely identify the workflow + +on: + pull_request: + push: + branches: [main, alpha, beta, rc, v4] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + autofix: + name: autofix + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Fix formatting + run: pnpm run format + - name: Apply fixes + uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 + with: + commit-message: 'ci: apply automated fixes' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000000..918ee80661e --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +name: Labeler + +on: + - pull_request_target + +permissions: + contents: read + pull-requests: write + +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: labeler-config.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000000..453400b546a --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,74 @@ +name: PR + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +env: + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + +permissions: + contents: read + pull-requests: write + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + with: + fetch-depth: 0 + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Get base and head commits for `nx affected` + uses: nrwl/nx-set-shas@v4.4.0 + with: + main-branch-name: main + - name: Run Checks + run: pnpm run test:pr + - name: Stop Nx Agents + if: ${{ always() }} + run: npx nx-cloud stop-all-agents + preview: + name: Preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Build Packages + run: pnpm run build:all + - name: Publish Previews + run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*' + - name: Determine commit SHA + id: determine-sha + run: | + echo "COMMIT_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV + - name: Size Limit + uses: andresz1/size-limit-action@94bc357df29c36c8f8d50ea497c3e225c3c95d1d + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + skip_step: install + build_script: build:all + provenance: + name: Provenance + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + with: + fetch-depth: 0 + - name: Check Provenance + uses: danielroe/provenance-action@v0.1.1 + with: + fail-on-downgrade: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..39223466e61 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,74 @@ +name: Release + +on: + push: + branches: [main, alpha, beta, rc, v4] + repository_dispatch: + types: [release] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +env: + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + +permissions: + contents: write + id-token: write + pull-requests: write + +jobs: + release: + name: Release + if: github.repository_owner == 'TanStack' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + with: + fetch-depth: 0 + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Run Tests + run: pnpm run test:ci + - name: Stop Nx Agents + if: ${{ always() }} + run: npx nx-cloud stop-all-agents + # - name: Check for Changesets marked as major + # id: major + # run: | + # echo "found=false" >> $GITHUB_OUTPUT + # regex="(major)" + # shopt -s nullglob + # for file in .changeset/*.md; do + # if [[ $(cat $file) =~ $regex ]]; then + # echo "found=true" >> $GITHUB_OUTPUT + # fi + # done + - name: Run Changesets (version or publish) + id: changesets + uses: changesets/action@v1.5.3 + with: + version: pnpm run changeset:version + publish: pnpm run changeset:publish + commit: 'ci: Version Packages' + title: 'ci: Version Packages' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Auto-merge Changesets PR + # if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false' + # run: | + # gh pr merge --squash "$PR_NUMBER" + # gh api --method POST /repos/$REPO/dispatches -f 'event_type=release' + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # REPO: ${{ github.repository }} + # PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }} + - name: Comment on PRs about release + if: steps.changesets.outputs.published == 'true' + uses: tanstack/config/.github/comment-on-release@main + with: + published-packages: ${{ steps.changesets.outputs.publishedPackages }} diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml deleted file mode 100644 index c4bab97bb64..00000000000 --- a/.github/workflows/test-and-publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: react-query tests - -on: - push: - branches: - - 'master' - - 'next' - - 'beta' - - '1.x' - - '2.x' - pull_request: - -jobs: - test: - name: 'Node ${{ matrix.node }}' - runs-on: ubuntu-latest - strategy: - matrix: - node: [10, 12, 14, 16] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - name: Install dependencies - uses: bahmutov/npm-install@v1 - - run: yarn test:ci - - publish-module: - name: 'Publish Module to NPM' - needs: test - # publish only when merged in master on original repo, not on PR - if: github.repository == 'tannerlinsley/react-query' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/1.x' || github.ref == 'refs/heads/2.x') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org/ - - name: Install dependencies - uses: bahmutov/npm-install@v1 - - run: yarn build - - run: npx semantic-release@17 - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} - GH_TOKEN: ${{secrets.GH_TOKEN}} diff --git a/.gitignore b/.gitignore index e50ed1d73a0..6e71fdf278c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,17 +3,14 @@ # dependencies node_modules +package-lock.json +yarn.lock # builds -types build -dist -lib -es -artifacts -.rpt2_cache coverage -*.tgz +dist +dist-ts # misc .DS_Store @@ -23,6 +20,7 @@ coverage .env.test.local .env.production.local .next +next-env.d.ts npm-debug.log* yarn-debug.log* @@ -30,6 +28,25 @@ yarn-error.log* .history size-plugin.json stats-hydration.json -stats-react.json +stats.json stats.html .vscode/settings.json +.vscode/mcp.json +.cursor/rules +.github/instructions/nx.instructions.md + +*.log +*.tsbuildinfo +.angular +.cache +.idea +.nx/cache +.nx/workspace-data +.pnpm-store +.svelte-kit +.tsup +.vinxi +temp + +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 7639205ec97..00000000000 --- a/.gitpod.yml +++ /dev/null @@ -1,18 +0,0 @@ -tasks: - - name: Auto Build - init: | - yarn install - gp sync-done boot - command: yarn run start - - - name: Docs - before: cd docs/ - init: | - gp sync-await boot - yarn install - command: yarn dev - openMode: split-right - -ports: - - port: 3000 - onOpen: open-preview diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000000..268c392d3cb --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +provenance=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000000..b4040276043 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24.8.0 diff --git a/.nx/workflows/dynamic-changesets.yaml b/.nx/workflows/dynamic-changesets.yaml new file mode 100644 index 00000000000..8458c190607 --- /dev/null +++ b/.nx/workflows/dynamic-changesets.yaml @@ -0,0 +1,4 @@ +distribute-on: + small-changeset: 3 linux-medium-js + medium-changeset: 4 linux-medium-js + large-changeset: 5 linux-medium-js diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..d1bb5343b0b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +**/.next +**/.nx/cache +**/.svelte-kit +**/build +**/coverage +**/dist +**/query-codemods/**/__testfixtures__ +.changeset/*.md +pnpm-lock.yaml +packages/**/tsup.config.bundled*.mjs +**/tsconfig.vitest-temp.json +docs/framework/*/reference diff --git a/.size-limit.json b/.size-limit.json new file mode 100644 index 00000000000..4ec421f4d52 --- /dev/null +++ b/.size-limit.json @@ -0,0 +1,15 @@ +[ + { + "name": "react full", + "path": "packages/react-query/build/modern/index.js", + "limit": "13.00 kB", + "ignore": ["react", "react-dom"] + }, + { + "name": "react minimal", + "path": "packages/react-query/build/modern/index.js", + "limit": "9.99 kB", + "import": "{ useQuery, QueryClient, QueryClientProvider }", + "ignore": ["react", "react-dom"] + } +] diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 420d141d57e..00000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "workbench.colorCustomizations": { - "titleBar.activeBackground": "#00da63", // change this color! - "titleBar.inactiveBackground": "#00da63", // change this color! - "titleBar.activeForeground": "#ffffff", // change this color! - "titleBar.inactiveForeground": "#ffffff" // change this color! - } -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a32287c3c2..46ed81cdf2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,11 @@ ## Questions -If you have questions about implementation details, help or support, then please use our dedicated community forum at [Github Discussions](https://github.com/tannerlinsley/react-query/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum. +If you have questions about implementation details, help or support, then please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/query/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum. ## Reporting Issues -If you have found what you think is a bug, please [file an issue](https://github.com/tannerlinsley/react-query/issues/new). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [Github Discussions](https://github.com/tannerlinsley/react-query/discussions) +If you have found what you think is a bug, please [file an issue](https://github.com/TanStack/query/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [GitHub Discussions](https://github.com/TanStack/query/discussions) ## Suggesting new features @@ -14,105 +14,150 @@ If you are here to suggest a feature, first create an issue if it does not alrea ## Development +_TanStack/query uses **symlink-based** configuration files. For smooth development in a local environment, we recommend developing in an environment that supports symlinks(ex: Linux, macOS, Windows Subsystem for Linux / WSL)._ + If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started: -- Fork this repository -- Install dependencies by running `$ yarn` -- Link `react-query` locally by running `$ yarn link` -- Auto-build files as you edit by running `$ yarn start` -- Implement your changes and tests to files in the `src/` directory and corresponding test files -- To run examples, follow their individual directions. Usually this is just `$ yarn && yarn start`. -- To run examples using your local build, link to the local `react-query` by running `$ yarn link react-query` from the example's directory -- Document your changes in the appropriate doc page -- Git stage your required changes and commit (see below commit guidelines) -- Submit PR for review +- Fork this repository. +- Install dependencies -## Online one-click setup + ```bash + pnpm install + ``` -You can use Gitpod(An Online Open Source VS Code like IDE which is free for Open Source) for developing online. With a single click it will start a workspace and automatically: + - We use [pnpm](https://pnpm.io/) v10 for package management (run in case of pnpm-related issues). -- clone the `react-query` repo. -- install all the dependencies in `/` and `/docs`. -- run `yarn start` in the root(`/`) to Auto-build files. -- run `yarn dev` in `/docs`. + ```bash + corepack enable && corepack prepare + ``` + + - We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions - please make sure to use the version mentioned in `.nvmrc` + + ```bash + nvm use + ``` + +- Build all packages. + + ```bash + pnpm build:all + ``` + +- Run development server. -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/) + ```bash + pnpm run watch + ``` -## Commit message conventions +- Implement your changes and tests to files in the `src/` directory and corresponding test files. +- Document your changes in the appropriate doc page. +- Git stage your required changes and commit (see below commit guidelines). +- Submit PR for review. -`react-query` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). +### Editing the docs locally and previewing the changes -We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. +The documentations for all the TanStack projects are hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/query` docs. -### Commit Message Format +> [!NOTE] +> The website fetches the doc pages from GitHub in production, and searches for them at `../query/docs` in development. Your local clone of `TanStack/query` needs to be in the same directory as the local clone of `TanStack/tanstack.com`. -Each commit message consists of a **header**, a **body** and a **footer**. The header has a special -format that includes a **type**, a **scope** and a **subject**: +You can follow these steps to set up the docs for local development: +1. Make a new directory called `tanstack`. + +```sh +mkdir tanstack ``` -(): - - - -