Skip to content

Commit 0e22231

Browse files
authored
Merge branch 'main' into test/svelte-query-createQueries-use-precise-time-advanceTimersByTimeAsync-simplify-queryFn
2 parents aeedf76 + 3cc59be commit 0e22231

File tree

9 files changed

+212
-63
lines changed

9 files changed

+212
-63
lines changed

.github/labeler.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/labeler.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ name: Labeler
33
on:
44
- pull_request_target
55

6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
610
jobs:
7-
triage:
11+
labeler:
812
runs-on: ubuntu-latest
913
steps:
10-
- uses: actions/labeler@v4.3.0
14+
- uses: actions/labeler@v5.0.0
1115
with:
1216
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
configuration-path: labeler-config.yml

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.2.0
1+
24.4.1

labeler-config.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
'package: angular-query-devtools-experimental':
2+
- changed-files:
3+
- any-glob-to-any-file: 'packages/angular-query-devtools-experimental/**/*'
4+
'package: angular-query-experimental':
5+
- changed-files:
6+
- any-glob-to-any-file: 'packages/angular-query-experimental/**/*'
7+
'package: angular-query-persist-client':
8+
- changed-files:
9+
- any-glob-to-any-file: 'packages/angular-query-persist-client/**/*'
10+
'package: eslint-plugin-query':
11+
- changed-files:
12+
- any-glob-to-any-file: 'packages/eslint-plugin-query/**/*'
13+
'package: query-async-storage-persister':
14+
- changed-files:
15+
- any-glob-to-any-file: 'packages/query-async-storage-persister/**/*'
16+
'package: query-broadcast-client-experimental':
17+
- changed-files:
18+
- any-glob-to-any-file: 'packages/query-broadcast-client-experimental/**/*'
19+
'package: query-codemods':
20+
- changed-files:
21+
- any-glob-to-any-file: 'packages/query-codemods/**/*'
22+
'package: query-core':
23+
- changed-files:
24+
- any-glob-to-any-file: 'packages/query-core/**/*'
25+
'package: query-devtools':
26+
- changed-files:
27+
- any-glob-to-any-file: 'packages/query-devtools/**/*'
28+
'package: query-persist-client-core':
29+
- changed-files:
30+
- any-glob-to-any-file: 'packages/query-persist-client-core/**/*'
31+
'package: query-sync-storage-persister':
32+
- changed-files:
33+
- any-glob-to-any-file: 'packages/query-sync-storage-persister/**/*'
34+
'package: query-test-utils':
35+
- changed-files:
36+
- any-glob-to-any-file: 'packages/query-test-utils/**/*'
37+
'package: react-query':
38+
- changed-files:
39+
- any-glob-to-any-file: 'packages/react-query/**/*'
40+
'package: react-query-devtools':
41+
- changed-files:
42+
- any-glob-to-any-file: 'packages/react-query-devtools/**/*'
43+
'package: react-query-next-experimental':
44+
- changed-files:
45+
- any-glob-to-any-file: 'packages/react-query-next-experimental/**/*'
46+
'package: react-query-persist-client':
47+
- changed-files:
48+
- any-glob-to-any-file: 'packages/react-query-persist-client/**/*'
49+
'package: solid-query':
50+
- changed-files:
51+
- any-glob-to-any-file: 'packages/solid-query/**/*'
52+
'package: solid-query-devtools':
53+
- changed-files:
54+
- any-glob-to-any-file: 'packages/solid-query-devtools/**/*'
55+
'package: solid-query-persist-client':
56+
- changed-files:
57+
- any-glob-to-any-file: 'packages/solid-query-persist-client/**/*'
58+
'package: svelte-query':
59+
- changed-files:
60+
- any-glob-to-any-file: 'packages/svelte-query/**/*'
61+
'package: svelte-query-devtools':
62+
- changed-files:
63+
- any-glob-to-any-file: 'packages/svelte-query-devtools/**/*'
64+
'package: svelte-query-persist-client':
65+
- changed-files:
66+
- any-glob-to-any-file: 'packages/svelte-query-persist-client/**/*'
67+
'package: vue-query':
68+
- changed-files:
69+
- any-glob-to-any-file: 'packages/vue-query/**/*'
70+
'package: vue-query-devtools':
71+
- changed-files:
72+
- any-glob-to-any-file: 'packages/vue-query-devtools/**/*'
73+
'documentation':
74+
- changed-files:
75+
- any-glob-to-any-file: 'docs/**/*'

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "git",
66
"url": "https://github.com/TanStack/query.git"
77
},
8-
"packageManager": "pnpm@10.7.0",
8+
"packageManager": "pnpm@10.13.1",
99
"type": "module",
1010
"scripts": {
1111
"clean": "pnpm --filter \"./packages/**\" run clean",
@@ -28,8 +28,8 @@
2828
"prettier": "prettier --experimental-cli --ignore-unknown '**/*'",
2929
"prettier:write": "pnpm run prettier --write",
3030
"docs:generate": "node scripts/generateDocs.ts",
31-
"cipublish": "node scripts/publish.ts",
32-
"verify-links": "node scripts/verify-links.ts"
31+
"verify-links": "node scripts/verify-links.ts",
32+
"cipublish": "node scripts/publish.ts"
3333
},
3434
"nx": {
3535
"includedScripts": [
@@ -52,7 +52,6 @@
5252
"esbuild-plugin-file-path-extensions": "^2.1.4",
5353
"eslint": "^9.15.0",
5454
"eslint-plugin-react-hooks": "^6.0.0-rc.1",
55-
"fast-glob": "^3.3.3",
5655
"jsdom": "^25.0.1",
5756
"knip": "^5.50.2",
5857
"markdown-link-extractor": "^4.0.2",
@@ -64,6 +63,7 @@
6463
"react": "^19.0.0",
6564
"react-dom": "^19.0.0",
6665
"sherif": "^1.6.1",
66+
"tinyglobby": "^0.2.14",
6767
"tsup": "^8.4.0",
6868
"typescript": "5.8.3",
6969
"typescript50": "npm:typescript@5.0",

pnpm-lock.yaml

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generate-labeler-config.ts

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import * as fs from 'node:fs'
2+
import * as path from 'node:path'
3+
import * as prettier from 'prettier'
4+
5+
/** Pairs of package labels and their corresponding paths */
6+
type LabelerPair = [string, string]
7+
8+
function readPairsFromFs(): Array<LabelerPair> {
9+
const ignored = new Set(['.DS_Store'])
10+
11+
const pairs: Array<LabelerPair> = []
12+
13+
// Add subfolders in the packages folder, i.e. packages/**
14+
fs.readdirSync(path.resolve('packages'))
15+
.filter((folder) => !ignored.has(folder))
16+
.forEach((folder) => {
17+
// Check if package.json exists for the folder before adding it
18+
if (
19+
fs.existsSync(
20+
path.resolve(path.join('packages', folder, 'package.json')),
21+
)
22+
) {
23+
pairs.push([`package: ${folder}`, `packages/${folder}/**/*`])
24+
} else {
25+
console.info(
26+
`Skipping \`${folder}\` as it does not have a \`package.json\` file.`,
27+
)
28+
}
29+
})
30+
31+
// Sort by package name in alphabetical order
32+
pairs.sort((a, b) => a[0].localeCompare(b[0]))
33+
34+
return pairs
35+
}
36+
37+
async function generateLabelerYaml(pairs: Array<LabelerPair>): Promise<string> {
38+
function s(n = 1) {
39+
return ' '.repeat(n)
40+
}
41+
42+
// Convert the pairs into valid yaml
43+
const formattedPairs = pairs
44+
.map(([packageLabel, packagePath]) => {
45+
const result = [
46+
`'${packageLabel}':`,
47+
`${s(2)}-${s(1)}changed-files:`,
48+
`${s(4)}-${s(1)}any-glob-to-any-file:${s(1)}'${packagePath}'`,
49+
].join('\n')
50+
51+
return result
52+
})
53+
.join('\n')
54+
55+
// Get the location of the Prettier config file
56+
const prettierConfigPath = await prettier.resolveConfigFile()
57+
if (!prettierConfigPath) {
58+
throw new Error(
59+
'No Prettier config file found. Please ensure you have a Prettier config file in your project.',
60+
)
61+
}
62+
console.info('using prettier config file at:', prettierConfigPath)
63+
64+
// Resolve the Prettier config
65+
const prettierConfig = await prettier.resolveConfig(prettierConfigPath)
66+
console.info('using resolved prettier config:', prettierConfig)
67+
68+
// Format the YAML string using Prettier
69+
const formattedStr = await prettier.format(formattedPairs, {
70+
parser: 'yaml',
71+
...prettierConfig,
72+
})
73+
74+
return formattedStr
75+
}
76+
77+
async function run() {
78+
console.info('Generating labeler config...')
79+
80+
// Generate the pairs of package labels and their corresponding paths
81+
const pairs = readPairsFromFs()
82+
83+
// Always add the docs folder
84+
pairs.push(['documentation', 'docs/**/*'])
85+
86+
// Convert the pairs into valid yaml
87+
const yamlStr = await generateLabelerYaml(pairs)
88+
89+
// Write to 'labeler-config.yml'
90+
const configPath = path.resolve('labeler-config.yml')
91+
fs.writeFileSync(configPath, yamlStr, {
92+
encoding: 'utf-8',
93+
})
94+
95+
console.info(`Generated labeler config at \`${configPath}\`!`)
96+
return
97+
}
98+
99+
try {
100+
run().then(() => {
101+
process.exit(0)
102+
})
103+
} catch (error) {
104+
console.error('Error generating labeler config:', error)
105+
process.exit(1)
106+
}

scripts/generateDocs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { resolve } from 'node:path'
22
import { fileURLToPath } from 'node:url'
33
import { readFileSync, writeFileSync } from 'node:fs'
44
import { generateReferenceDocs } from '@tanstack/config/typedoc'
5-
import fg from 'fast-glob'
5+
import { glob } from 'tinyglobby'
66

77
const __dirname = fileURLToPath(new URL('.', import.meta.url))
88

@@ -39,7 +39,7 @@ await generateReferenceDocs({
3939
const markdownFilesPattern = 'docs/framework/{angular,svelte}/reference/**/*.md'
4040

4141
// Find all markdown files matching the pattern
42-
const markdownFiles = await fg(markdownFilesPattern)
42+
const markdownFiles = await glob(markdownFilesPattern)
4343

4444
console.log(`Found ${markdownFiles.length} markdown files to process\n`)
4545

scripts/verify-links.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync, readFileSync, statSync } from 'node:fs'
22
import path, { resolve } from 'node:path'
3-
import fg from 'fast-glob'
3+
import { glob } from 'tinyglobby'
44
// @ts-ignore Could not find a declaration file for module 'markdown-link-extractor'.
55
import markdownLinkExtractor from 'markdown-link-extractor'
66

@@ -86,7 +86,7 @@ function fileExistsForLink(
8686

8787
async function findMarkdownLinks() {
8888
// Find all markdown files in docs directory
89-
const markdownFiles = await fg('docs/**/*.md', {
89+
const markdownFiles = await glob('docs/**/*.md', {
9090
ignore: ['**/node_modules/**'],
9191
})
9292

0 commit comments

Comments
 (0)