Compare commits
93 Commits
@blitzjs/a
...
@blitzjs/a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff9fd042a | ||
|
|
2cc888eff8 | ||
|
|
8a0a97bebb | ||
|
|
176c7b8b57 | ||
|
|
b307931f2e | ||
|
|
14375e25c4 | ||
|
|
8b755574b5 | ||
|
|
4656e6ecd6 | ||
|
|
1e0ec7a972 | ||
|
|
f88702c1c1 | ||
|
|
8b9ad3f40c | ||
|
|
37623a4f4c | ||
|
|
6baab1907e | ||
|
|
b5de25c3d8 | ||
|
|
86af6dec5f | ||
|
|
52a6338772 | ||
|
|
72a332e013 | ||
|
|
fd31e56bc5 | ||
|
|
e2fac297fd | ||
|
|
a3c92cb863 | ||
|
|
2d1482fc8b | ||
|
|
85b15a9cfb | ||
|
|
4902802402 | ||
|
|
0bc107fd7f | ||
|
|
cb55ed266d | ||
|
|
271c58ac62 | ||
|
|
06427f67f2 | ||
|
|
f120f6723a | ||
|
|
bac5e740ba | ||
|
|
630c718129 | ||
|
|
078fe47419 | ||
|
|
8dfaad088d | ||
|
|
dd299ae89f | ||
|
|
41608c4c34 | ||
|
|
70b334a2f7 | ||
|
|
f0ca738d56 | ||
|
|
1010858446 | ||
|
|
ebd74b4e97 | ||
|
|
8870580710 | ||
|
|
414d758fe8 | ||
|
|
fce0f3135a | ||
|
|
9620ef6b1e | ||
|
|
240f3f3471 | ||
|
|
91aa535632 | ||
|
|
ccb1af8d08 | ||
|
|
807a2b5645 | ||
|
|
a3e6c49c4d | ||
|
|
4d7d126d9c | ||
|
|
890b0c0c9d | ||
|
|
928e840b59 | ||
|
|
55b1cb2044 | ||
|
|
3a6677b307 | ||
|
|
f202aac183 | ||
|
|
065db256d7 | ||
|
|
ada5cac7e3 | ||
|
|
e286bcb3ff | ||
|
|
dd5f51744f | ||
|
|
99b054a44a | ||
|
|
54db8a46dd | ||
|
|
6125eb7837 | ||
|
|
62bf12b5c6 | ||
|
|
8e4580a446 | ||
|
|
f52ca398ee | ||
|
|
922bc276d9 | ||
|
|
365e67094c | ||
|
|
31d7a6f413 | ||
|
|
8726b16bb9 | ||
|
|
240f378b54 | ||
|
|
d6655f0178 | ||
|
|
001c174cbf | ||
|
|
1d863f352a | ||
|
|
a36110171a | ||
|
|
37b5e35e22 | ||
|
|
3b213a35b0 | ||
|
|
809f6019be | ||
|
|
a51b1e85e1 | ||
|
|
a948dbb7b8 | ||
|
|
4b91c429ca | ||
|
|
6ab9db7802 | ||
|
|
d3e6b02ad4 | ||
|
|
813365da61 | ||
|
|
6559c25f71 | ||
|
|
83b355900b | ||
|
|
c721c104db | ||
|
|
7e538ba451 | ||
|
|
8e00605a86 | ||
|
|
dcdcd04055 | ||
|
|
e339e2fd0a | ||
|
|
37e1ec4abc | ||
|
|
718a194891 | ||
|
|
0f18c68d63 | ||
|
|
3511d5b69b | ||
|
|
716e188d13 |
@@ -970,7 +970,9 @@
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/3496193?v=4",
|
||||
"profile": "https://twitter.com/dillonraphael",
|
||||
"contributions": [
|
||||
"code"
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3590,6 +3592,117 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "saadaltabari",
|
||||
"name": "saadaltabari",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/29986512?v=4",
|
||||
"profile": "https://github.com/saadaltabari",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "iojcde",
|
||||
"name": "Jeeho Ahn",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/31413538?v=4",
|
||||
"profile": "https://github.com/iojcde",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"tool",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ryanwashburne",
|
||||
"name": "Ryan Washburne",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/12566087?v=4",
|
||||
"profile": "https://linkedin.com/in/ryanwashburne",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "sherryxiao1988",
|
||||
"name": "Shundan Xiao",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1202426?v=4",
|
||||
"profile": "https://github.com/sherryxiao1988",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "tommywong-dev",
|
||||
"name": "tommywong-dev",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/79971095?v=4",
|
||||
"profile": "https://github.com/tommywong-dev",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "datner",
|
||||
"name": "Datner",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/22598347?v=4",
|
||||
"profile": "https://github.com/datner",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "chaiwattsw",
|
||||
"name": "Chaiwat Trisuwan",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/30198386?v=4",
|
||||
"profile": "https://chaiwattsw.com/",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "oltdaniel",
|
||||
"name": "Daniel Oltmanns",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/53529846?v=4",
|
||||
"profile": "oltdaniel.eu",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "edrickleong",
|
||||
"name": "Edrick Leong",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/10529706?v=4",
|
||||
"profile": "https://github.com/edrickleong",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "siddhsuresh",
|
||||
"name": "Siddharth Suresh",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/83594610?v=4",
|
||||
"profile": "https://github.com/siddhsuresh",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "orionmiz",
|
||||
"name": "JH.Lee",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/39466936?v=4",
|
||||
"profile": "http://jins.dev",
|
||||
"contributions": [
|
||||
"code",
|
||||
"test",
|
||||
"maintenance",
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
5
.changeset/blue-pigs-tan.md
Normal file
5
.changeset/blue-pigs-tan.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Throw error if cookiePrefix is undefined when running codemod
|
||||
6
.changeset/breezy-moose-behave.md
Normal file
6
.changeset/breezy-moose-behave.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"blitz": minor
|
||||
"@blitzjs/auth": patch
|
||||
---
|
||||
|
||||
Truncate errors from `api/auth/<strategy>/callback` request to 100 characters before passing them to the `?authError=` query parameter
|
||||
5
.changeset/brown-avocados-wink.md
Normal file
5
.changeset/brown-avocados-wink.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Print model added or updated in schema.prisma after running model generator
|
||||
5
.changeset/calm-carpets-deny.md
Normal file
5
.changeset/calm-carpets-deny.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fixes the db seed command so that the database can disconnect after running the seed file.
|
||||
6
.changeset/calm-horses-tie.md
Normal file
6
.changeset/calm-horses-tie.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add back blitz generate command
|
||||
5
.changeset/calm-nails-wait.md
Normal file
5
.changeset/calm-nails-wait.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
These are various changes to will make the codemod more dynamic and work with a larger variety of codebases. These fixes are implemented to make the codemod work with flightdeck.
|
||||
5
.changeset/calm-tomatoes-drive.md
Normal file
5
.changeset/calm-tomatoes-drive.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Include `.env.test` file to the generator templates
|
||||
5
.changeset/chilled-carrots-own.md
Normal file
5
.changeset/chilled-carrots-own.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add `BlitzPage` type to Home pages in app templates
|
||||
5
.changeset/clean-hats-pump.md
Normal file
5
.changeset/clean-hats-pump.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Allow using `RouteUrlObject` as `redirect.destination` in `getStaticProps` and `getServerSideProps`
|
||||
5
.changeset/clean-walls-wink.md
Normal file
5
.changeset/clean-walls-wink.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Pass `signal` from useQuery to Blitz internal rpc client to be able to cancel queries on unmount
|
||||
5
.changeset/clever-radios-lie.md
Normal file
5
.changeset/clever-radios-lie.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
Add DocumentProps & DocumentContext to the codemod import map
|
||||
|
||||
5
.changeset/cuddly-pugs-crash.md
Normal file
5
.changeset/cuddly-pugs-crash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Wrap middlewares with BlitzServerMiddleware function with codemod
|
||||
5
.changeset/curly-rules-speak.md
Normal file
5
.changeset/curly-rules-speak.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Comment out generate command import until we add the full support back
|
||||
5
.changeset/fair-carrots-guess.md
Normal file
5
.changeset/fair-carrots-guess.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fixes loading production env variables by default for blitz build command
|
||||
5
.changeset/few-dogs-fetch.md
Normal file
5
.changeset/few-dogs-fetch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Use correct path for log utilities import
|
||||
5
.changeset/four-sheep-judge.md
Normal file
5
.changeset/four-sheep-judge.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Export router-context from browser entrypoint
|
||||
5
.changeset/fuzzy-bees-warn.md
Normal file
5
.changeset/fuzzy-bees-warn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix APP_ENV not being set before loading env config
|
||||
5
.changeset/gorgeous-games-obey.md
Normal file
5
.changeset/gorgeous-games-obey.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Avoid `invalid config detected` warnings by deleting `"blitz"` key from next config object
|
||||
6
.changeset/great-candles-stare.md
Normal file
6
.changeset/great-candles-stare.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Use internal branded blitz logger for @blitzjs/rpc
|
||||
5
.changeset/great-terms-rescue.md
Normal file
5
.changeset/great-terms-rescue.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Add BlitzServerMiddleware utility function to wrap middleware in blitz server file
|
||||
5
.changeset/green-pillows-hammer.md
Normal file
5
.changeset/green-pillows-hammer.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Runs the codegen on the blitz build command
|
||||
5
.changeset/happy-hotels-visit.md
Normal file
5
.changeset/happy-hotels-visit.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Add missing value to "skip" option when choosing a package manager during new app scaffolding
|
||||
5
.changeset/hot-cups-rhyme.md
Normal file
5
.changeset/hot-cups-rhyme.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix blitz codegen to work with monorepos
|
||||
5
.changeset/kind-walls-suffer.md
Normal file
5
.changeset/kind-walls-suffer.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Run codegen tasks on blitz dev command
|
||||
5
.changeset/light-donkeys-double.md
Normal file
5
.changeset/light-donkeys-double.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Run `prisma generate` as a `blitz codegen` step if "prisma" is found in project's dependencies
|
||||
5
.changeset/long-bees-hope.md
Normal file
5
.changeset/long-bees-hope.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add type checking to next.config.js files in new app templates
|
||||
5
.changeset/lovely-berries-sell.md
Normal file
5
.changeset/lovely-berries-sell.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Remove trailing comma when removing BlitzConfig from next.config.js & Fix codemod so if route (eg. `app/auth/pages`) convert to (eg. `pages/`) instead of (eg. `pages/auth`)
|
||||
5
.changeset/modern-ligers-behave.md
Normal file
5
.changeset/modern-ligers-behave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add hoist pattern entry for react-query in new app templates
|
||||
5
.changeset/ninety-lies-press.md
Normal file
5
.changeset/ninety-lies-press.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Temporarily skip version check
|
||||
6
.changeset/ninety-rice-tickle.md
Normal file
6
.changeset/ninety-rice-tickle.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Improve `blitz new` messaging and fix minor issues
|
||||
5
.changeset/perfect-trains-double.md
Normal file
5
.changeset/perfect-trains-double.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Wrap `blitz.config.ts` with the `withBlitz` function during the codemod step instead of creating a blank `next.config.js` file.
|
||||
5
.changeset/polite-lizards-love.md
Normal file
5
.changeset/polite-lizards-love.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Passes the correct arguments (without flags) to any bin command ran with the blitz cli
|
||||
@@ -1,61 +1,90 @@
|
||||
{
|
||||
"mode": "pre",
|
||||
"tag": "alpha",
|
||||
"tag": "beta",
|
||||
"initialVersions": {
|
||||
"web": "0.0.0",
|
||||
"test-auth": "0.0.0",
|
||||
"test-rpc": "0.0.0",
|
||||
"test-utils": "0.0.0",
|
||||
"blitz": "2.0.0-alpha.0",
|
||||
"@blitzjs/auth": "2.0.0-alpha.0",
|
||||
"@blitzjs/next": "2.0.0-alpha.0",
|
||||
"@blitzjs/rpc": "2.0.0-alpha.0",
|
||||
"blitz": "2.0.0-beta.0",
|
||||
"@blitzjs/auth": "2.0.0-beta.0",
|
||||
"@blitzjs/next": "2.0.0-beta.0",
|
||||
"@blitzjs/rpc": "2.0.0-beta.0",
|
||||
"@blitzjs/config": "0.0.0",
|
||||
"@blitzjs/generator": "2.0.0-alpha.0",
|
||||
"@blitzjs/codemod": "2.0.0-alpha.0",
|
||||
"@blitzjs/generator": "2.0.0-beta.0",
|
||||
"@blitzjs/codemod": "2.0.0-beta.0",
|
||||
"template": "0.0.0",
|
||||
"toolkit-app": "1.0.0",
|
||||
"test-qm": "0.0.0",
|
||||
"test-no-suspense": "0.0.0",
|
||||
"test-trailing-slash": "0.0.0",
|
||||
"test-middleware": "0.0.0"
|
||||
"test-middleware": "0.0.0",
|
||||
"test-react-query-utils": "0.0.0"
|
||||
},
|
||||
"changesets": [
|
||||
"big-phones-bow",
|
||||
"blue-pigs-tan",
|
||||
"breezy-cameras-double",
|
||||
"breezy-moose-behave",
|
||||
"bright-mangos-run",
|
||||
"brown-avocados-wink",
|
||||
"calm-carpets-deny",
|
||||
"calm-horses-tie",
|
||||
"calm-nails-wait",
|
||||
"calm-tomatoes-drive",
|
||||
"chilled-carrots-own",
|
||||
"clean-hats-pump",
|
||||
"clean-walls-wink",
|
||||
"clever-radios-lie",
|
||||
"cool-doors-invent",
|
||||
"cool-horses-check",
|
||||
"cuddly-pugs-crash",
|
||||
"curly-rules-speak",
|
||||
"curly-seas-serve",
|
||||
"dirty-monkeys-greet",
|
||||
"dirty-planets-chew",
|
||||
"eleven-humans-sort",
|
||||
"empty-berries-rule",
|
||||
"empty-turkeys-wave",
|
||||
"fair-carrots-guess",
|
||||
"fair-wombats-sneeze",
|
||||
"famous-kings-explain",
|
||||
"fast-trainers-kneel",
|
||||
"few-dogs-fetch",
|
||||
"flat-bees-approve",
|
||||
"four-brooms-juggle",
|
||||
"four-meals-fry",
|
||||
"four-sheep-judge",
|
||||
"fuzzy-bees-warn",
|
||||
"fuzzy-jars-admire",
|
||||
"gentle-dogs-reply",
|
||||
"good-apes-drum",
|
||||
"good-insects-wink",
|
||||
"gorgeous-buses-scream",
|
||||
"gorgeous-games-obey",
|
||||
"great-candles-stare",
|
||||
"great-months-train",
|
||||
"great-terms-rescue",
|
||||
"green-papayas-do",
|
||||
"green-pillows-hammer",
|
||||
"happy-hotels-visit",
|
||||
"healthy-rice-shout",
|
||||
"heavy-apes-judge",
|
||||
"hot-cups-rhyme",
|
||||
"hot-drinks-approve",
|
||||
"hungry-baboons-swim",
|
||||
"kind-walls-suffer",
|
||||
"late-steaks-give",
|
||||
"lemon-games-press",
|
||||
"lemon-seas-push",
|
||||
"light-donkeys-double",
|
||||
"long-bees-hope",
|
||||
"lovely-berries-sell",
|
||||
"lovely-colts-share",
|
||||
"lucky-cows-try",
|
||||
"mean-gorillas-reply",
|
||||
"modern-cameras-pull",
|
||||
"modern-ligers-behave",
|
||||
"moody-bags-walk",
|
||||
"moody-squids-cheer",
|
||||
"nervous-beds-travel",
|
||||
@@ -65,54 +94,83 @@
|
||||
"nice-starfishes-live",
|
||||
"nine-birds-confess",
|
||||
"nine-onions-admire",
|
||||
"ninety-lies-press",
|
||||
"ninety-pets-heal",
|
||||
"ninety-rice-tickle",
|
||||
"olive-bees-buy",
|
||||
"olive-feet-rhyme",
|
||||
"olive-sheep-rhyme",
|
||||
"perfect-eyes-repeat",
|
||||
"perfect-trains-double",
|
||||
"plenty-bottles-swim",
|
||||
"polite-lizards-love",
|
||||
"poor-peas-lick",
|
||||
"poor-penguins-look",
|
||||
"poor-shrimps-think",
|
||||
"popular-teachers-pay",
|
||||
"pretty-games-march",
|
||||
"purple-singers-greet",
|
||||
"quick-cycles-confess",
|
||||
"quiet-feet-travel",
|
||||
"quiet-pans-hunt",
|
||||
"quiet-sloths-rule",
|
||||
"red-badgers-retire",
|
||||
"rich-chairs-invent",
|
||||
"rich-queens-travel",
|
||||
"rotten-rocks-remember",
|
||||
"shaggy-carpets-brake",
|
||||
"sharp-falcons-begin",
|
||||
"shy-olives-hang",
|
||||
"shy-pumpkins-try",
|
||||
"silent-colts-reply",
|
||||
"silly-apricots-share",
|
||||
"six-apricots-kick",
|
||||
"slimy-humans-impress",
|
||||
"slimy-needles-taste",
|
||||
"slow-walls-poke",
|
||||
"small-socks-confess",
|
||||
"smooth-planets-admire",
|
||||
"smooth-rice-clap",
|
||||
"smooth-stingrays-drum",
|
||||
"smooth-tools-train",
|
||||
"soft-adults-smell",
|
||||
"sour-lemons-hunt",
|
||||
"sour-mails-lick",
|
||||
"spicy-beds-float",
|
||||
"spotty-dingos-stare",
|
||||
"stale-jobs-drum",
|
||||
"strong-apes-reply",
|
||||
"stupid-walls-sell",
|
||||
"sweet-kiwis-cross",
|
||||
"swift-drinks-dress",
|
||||
"tall-meals-learn",
|
||||
"tame-keys-reply",
|
||||
"tasty-maps-fetch",
|
||||
"tasty-news-collect",
|
||||
"ten-hairs-listen",
|
||||
"ten-rivers-burn",
|
||||
"tender-pianos-check",
|
||||
"thick-parrots-float",
|
||||
"thirty-countries-build",
|
||||
"three-lies-pull",
|
||||
"tidy-clouds-smoke",
|
||||
"tough-toes-pull",
|
||||
"twelve-hornets-sip",
|
||||
"twelve-lemons-smile",
|
||||
"twenty-beans-pump",
|
||||
"two-carpets-rhyme",
|
||||
"two-eyes-knock",
|
||||
"two-kiwis-help",
|
||||
"two-tigers-type",
|
||||
"unlucky-avocados-fix",
|
||||
"unlucky-papayas-sleep",
|
||||
"violet-bags-leave",
|
||||
"violet-lions-help",
|
||||
"weak-suns-shave",
|
||||
"wicked-ghosts-cough",
|
||||
"wise-frogs-give"
|
||||
"wicked-rings-walk",
|
||||
"wise-eels-visit",
|
||||
"wise-frogs-give",
|
||||
"wise-rabbits-complain"
|
||||
]
|
||||
}
|
||||
|
||||
5
.changeset/pretty-games-march.md
Normal file
5
.changeset/pretty-games-march.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Import ErrorComponent as DefaultErrorComponent
|
||||
8
.changeset/red-badgers-retire.md
Normal file
8
.changeset/red-badgers-retire.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/next": patch
|
||||
"@blitzjs/rpc": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Fixes peer dependency warnings
|
||||
5
.changeset/rotten-rocks-remember.md
Normal file
5
.changeset/rotten-rocks-remember.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Run codegen tasks after creating a new app if user chose yarn as a package manager
|
||||
5
.changeset/shaggy-carpets-brake.md
Normal file
5
.changeset/shaggy-carpets-brake.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Fix template path for the generator
|
||||
6
.changeset/shy-pumpkins-try.md
Normal file
6
.changeset/shy-pumpkins-try.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Upgrade react-query to v4
|
||||
5
.changeset/silly-apricots-share.md
Normal file
5
.changeset/silly-apricots-share.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Avoid reassigning queryClient in prefetch methods
|
||||
5
.changeset/six-apricots-kick.md
Normal file
5
.changeset/six-apricots-kick.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Infer result type in the `api` handler and allow customizing it
|
||||
5
.changeset/slimy-humans-impress.md
Normal file
5
.changeset/slimy-humans-impress.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Remove trailing comma from tsconfig.json file in the new app template"
|
||||
5
.changeset/smooth-rice-clap.md
Normal file
5
.changeset/smooth-rice-clap.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Fix typo in a next.config.js file name
|
||||
5
.changeset/smooth-stingrays-drum.md
Normal file
5
.changeset/smooth-stingrays-drum.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Updates the error messages based on if it's a babel parse error or an unexpected error
|
||||
5
.changeset/smooth-tools-train.md
Normal file
5
.changeset/smooth-tools-train.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add ts-jest to dependencies in new app templates
|
||||
5
.changeset/sour-mails-lick.md
Normal file
5
.changeset/sour-mails-lick.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Allow codemod to finish if `cookiePrefix` is undefined. Then show error at the end of running the codemod.
|
||||
8
.changeset/spicy-beds-float.md
Normal file
8
.changeset/spicy-beds-float.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
"@blitzjs/next": patch
|
||||
"@blitzjs/rpc": patch
|
||||
"blitz": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
Fixes the supports-color warning for pnpm
|
||||
5
.changeset/spotty-dingos-stare.md
Normal file
5
.changeset/spotty-dingos-stare.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Add `getQueryData` utility to get an existing query's cached data
|
||||
5
.changeset/stale-jobs-drum.md
Normal file
5
.changeset/stale-jobs-drum.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Set correct packages versions in package.json with upgrade-legacy codemod
|
||||
5
.changeset/sweet-kiwis-cross.md
Normal file
5
.changeset/sweet-kiwis-cross.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Fix queries/mutations lookup on Windows
|
||||
5
.changeset/tasty-maps-fetch.md
Normal file
5
.changeset/tasty-maps-fetch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix `enhancePrisma is undefined` errors by moving the utility function to a browser entrypoint
|
||||
5
.changeset/three-lies-pull.md
Normal file
5
.changeset/three-lies-pull.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
moves zod to devDependencies
|
||||
5
.changeset/tough-toes-pull.md
Normal file
5
.changeset/tough-toes-pull.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Remove debug console.log
|
||||
5
.changeset/twelve-hornets-sip.md
Normal file
5
.changeset/twelve-hornets-sip.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Fix codemod to accept a self closing `DocumentHead` in the `_document` page
|
||||
5
.changeset/two-eyes-knock.md
Normal file
5
.changeset/two-eyes-knock.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Update new app templates to use blitz-rpc's resolver function
|
||||
5
.changeset/unlucky-avocados-fix.md
Normal file
5
.changeset/unlucky-avocados-fix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add `@testing-library/jest-dom` to new app dependecies
|
||||
5
.changeset/wicked-rings-walk.md
Normal file
5
.changeset/wicked-rings-walk.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Set prefix in moduleNameWrapper's options in Blitz's jest configuration
|
||||
11
.changeset/wise-eels-visit.md
Normal file
11
.changeset/wise-eels-visit.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/auth": patch
|
||||
"@blitzjs/next": patch
|
||||
"@blitzjs/rpc": patch
|
||||
"@blitzjs/codemod": patch
|
||||
"@blitzjs/config": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Beta release
|
||||
5
.changeset/wise-rabbits-complain.md
Normal file
5
.changeset/wise-rabbits-complain.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Mocks @blitzjs/auth instead of blitz inside the forgotPassword mutation test & hardcodes blitz package version types instead of just using the alpha tag.
|
||||
91
README.md
91
README.md
@@ -6,9 +6,9 @@
|
||||
<img alt="" src="https://img.shields.io/badge/Join%20our%20community-6700EB.svg?style=for-the-badge&labelColor=000000&logoWidth=20&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQ9SURBVHgB7d3dVdtAEIbhcSpICUoH0IEogQqSVBBSAU4FSSpIOoAORAfQgSghHXzZ1U/YcMD4R9rZmf2ec3y448LyiNf27iLiGIAmPLrweC9Un3DhrzG6EarLNP09nlwJ1SOZ/lQr5N80/S/p2QMVCBf5N17XCfm1Y/rBHqjAG9PPHvBsz+mf9WAP+HLA9M/YA14cOP2payH7jpj+VCtk1wnTP+vj7xCy6cTpn7EHLMLp059iD1iD8eveJbVCNsSLheX1YA/YgOWnf8YeKB3Wmf7Ud6Fy4f/FHmtpxbl3YlC4MJ/Cj0bWdwPnPbARg+L0S54XQHS32WwuxClzd4CM0z9rPfeAuTtA5ulPXYQ7wZ04Y+oOoDD9KZc9YOoOoDj9s4dwFzgXR6w1wIPoOvPWA9buAHEJ173o3gWiy3AnuBUHLEbgmYwvAk1/wuM8vAgexThzbwPDkx7/DHwVXfFOxP2GmsKd4Ab6zPeAyU8CI7AHFmH2BRCBPXAyk18GzUrqAXCTiR4ssyj0VFw/oCU8+e+RZ33AWz6KMaYbIIWxB+JSLs1bsbkeMN0AqakHvoku9oA2sAfqBvbAQdw0QArsgb25aYBUQT3QgT2gB+yBuqGcHij2UCqXDZACe2Anlw2QYg/QAOyBuoE98CL3DZDCuK4/rh/Q7oGL6U+TOvcNkJoijN8X1C48+T+g75eQDrAH/qmqAVJgDwyqaoAUe4AGYA/UDZX3QLUNkEIZPRCd5+6BahsgVUgPROwBTSijB7jpVAvGHriHvmw9wAZ4BpX1ABvgmakHtPcbRuwBTWAPULgAV9D/jKDY9YRvwvgEaurD44uQHvAol7qBW7WKluVtIHiUS7GyvA0s6CiXDnxrpQfsgbqBS7GKk/2jYHCrVlGyfxTMrVo0ALdq1Q3sgSKofh0M9oA61a+D2QM0AHugbmAPqClmSRjK2apVVQ8UsySsoK1aHdgDesCtWnUDeyCrIpeFg1u3sylyWTi3btMA7IG6gT2wuuK3hoE9sKrit4YVslWLPaAN7IG6ocKt2zmY2h4O9sDiTG0PZw/QANy6XTewBxZj9ogYVHy025LMHhEz9cBn0We6B0yfERReBLfhx0/R1YQHPx/QBPbA0VwcEwf2wNFcHBPHHjiem3MC2QPHcXdSaJjA+KfgTPQ8hhfjBzHC40mhlzJ+Xq9lK4a4PCs43AVaGTed5mZq+iOXZwWHi3AnOj2wFWNcnxYe7gTxLtBKHuamP/J+Wnh8a5irB7ZC5Yk9gPX1QuXC+usHWqGyhYvUYR0a7zboUOFCNVhnk0krZAOW7wFOvzXhom2xnEbIHizTA1wEYhWW6YFGyC6c1gOcfg9wfA80Qj7g8B7g9HuCww+haIR8wf49wOn3Cvv9k8tGyC/s7gFOv3fY3QONkH+v9MBWqB7PeqDn9FcIT//kcitUn6kHOu/T/xfWzlQy3dEHhwAAAABJRU5ErkJggg==">
|
||||
</a>
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-381-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
|
||||
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-391-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/canary/LICENSE">
|
||||
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/main/LICENSE">
|
||||
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
|
||||
</a>
|
||||
<a aria-label="NPM version" href="https://www.npmjs.com/package/blitz">
|
||||
@@ -19,25 +19,12 @@
|
||||
|
||||
<br>
|
||||
|
||||
<h1 align="center">The Fullstack React Framework</h1>
|
||||
|
||||
<h5 align="center">"Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails</h3>
|
||||
<h3 align="center"><a href="https://blitzjs.com/docs/get-started" target="_blank">Read the Documentation</a></h3>
|
||||
<br>
|
||||
|
||||
“Zero-API” data layer **lets you import server code directly into your React components** instead of having to manually add API endpoints and do client-side fetching and caching.
|
||||
|
||||
New Blitz apps come with **all the boring stuff already set up for you!** Like ESLint, Prettier, Jest, user sign up, log in, and password reset.
|
||||
|
||||
Provides **helpful defaults and conventions** for things like routing, file structure, and authentication while also being extremely flexible.
|
||||
|
||||
<h1 align="center">The Missing Fullstack Toolkit for Next.js</h1>
|
||||
|
||||
<br>
|
||||
|
||||
### Quick Start
|
||||
|
||||
You need Node.js 12 or newer
|
||||
|
||||
#### Install Blitz
|
||||
|
||||
Run `npm install -g blitz` or `yarn global add blitz`
|
||||
@@ -53,37 +40,8 @@ _You can alternatively use [`npx`](https://www.npmjs.com/package/npx)_
|
||||
|
||||
<br><br>
|
||||
|
||||
<a aria-label="Bytes Newsletter" href="https://ui.dev/bytes/?r=blitzjs">
|
||||
<img alt="Bytes Newsletter" src="https://files-8wtskjofb.vercel.app/smarter-16x1.jpg">
|
||||
</a>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
|
||||
### The Foundational Principles
|
||||
|
||||
1. Fullstack & Monolithic
|
||||
2. API Not Required
|
||||
3. Convention over Configuration
|
||||
4. Loose Opinions
|
||||
5. Easy to Start, Easy to Scale
|
||||
6. Stability
|
||||
7. Community over Code
|
||||
|
||||
[The Blitz Manifesto](https://blitzjs.com/docs/manifesto) explains these principles in detail.
|
||||
|
||||
<br>
|
||||
|
||||
### What is Blitz Designed For?
|
||||
|
||||
Blitz is designed for tiny to large database-backed applications that have one or more graphical user interfaces.
|
||||
|
||||
While we currently only support web, we are pursuing the dream of a single monolithic application that runs on web and mobile with maximum code sharing and minimal boilerplate.
|
||||
|
||||
<br>
|
||||
|
||||
## Welcome to the Blitz Community 👋
|
||||
|
||||
The Blitz community is warm, safe, diverse, inclusive, and fun! LGBTQ+, women, and minorities are especially welcome. Please read our [Code of Conduct](https://blitzjs.com/docs/code-of-conduct).
|
||||
@@ -108,16 +66,16 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
<table>
|
||||
<tr>
|
||||
<td><a aria-label="Andreas Asprou" href="https://andreas.fyi">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/andreas.jpg" width="40px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/andreas.jpg" width="40px"/>
|
||||
</a></td>
|
||||
<td><a aria-label="Digas" href="https://digsas.com">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/digsas.svg" width="40px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/digsas.svg" width="40px"/>
|
||||
</a></td>
|
||||
<td><a aria-label="userTrack" href="https://www.usertrack.net/?ref=blitzjs">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/usertrack.png" width="40px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/usertrack.png" width="40px"/>
|
||||
</a></td>
|
||||
<td><a aria-label="MeetKai" href="https://meetkai.com/?ref=blitzjs">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/meetkai.png" width="40px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/meetkai.png" width="40px"/>
|
||||
</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -127,14 +85,11 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a aria-label="Render.com" href="https://render.com?utm_source=BlitzJS&utm_medium=sponsorship&utm_campaign=BlitzJS_Sponsorship_2020">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/render-logo-color2.png" width="200px">
|
||||
</a></td>
|
||||
<td><a aria-label="RIT" href="https://rit-inc.co.jp/?utm_source=BlitzJS&utm_medium=sponsorship&utm_campaign=BlitzJS_Sponsorship_2021">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/rit_logo.png" width="200px">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/rit_logo.png" width="200px">
|
||||
</a></td>
|
||||
<td><a aria-label="Boostry" href="https://boostry.co.jp/?utm_source=BlitzJS&utm_medium=sponsorship&utm_campaign=BlitzJS_Sponsorship_2021">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/boostry.svg" width="200px">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/boostry.svg" width="200px">
|
||||
</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -147,7 +102,7 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
<tr>
|
||||
<td>
|
||||
<a aria-label="Fauna" href="https://dashboard.fauna.com/accounts/register?utm_source=BlitzJS&utm_medium=sponsorship&utm_campaign=BlitzJS_Sponsorship_2020">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/Fauna_Logo_Blue.png" width="300px">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/Fauna_Logo_Blue.png" width="300px">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -161,9 +116,13 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
|
||||
### 💎 Diamond Sponsors
|
||||
|
||||
<a aria-label="Your Company" href="#">
|
||||
<img alt="" src="https://dummyimage.com/1000x330/efe8ff/000000.png&text=Your+Logo+Here" width="500px">
|
||||
</a>
|
||||
<table>
|
||||
<tr>
|
||||
<a aria-label="Flightcontrol" href="https://www.flightcontrol.dev?ref=blitzjs">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/flightcontrol.png" width="400px">
|
||||
</a>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -193,6 +152,7 @@ _Code ownership, pull request approvals and merging, etc_ (see [Maintainers L2](
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="http://simonknott.de"><img src="https://avatars1.githubusercontent.com/u/14912729?v=4" width="100px;" alt=""/><br /><sub><b>Simon Knott</b></sub></a><br />SuperJSON</td>
|
||||
<td align="center"><a href="http://jins.dev"><img src="https://avatars.githubusercontent.com/u/39466936?v=4" width="100px;" alt=""/><br /><sub><b>JH.Lee</b></sub></a><br />SuperJSON</td>
|
||||
<td align="center"><a href="https://juanm04.com"><img src="https://avatars0.githubusercontent.com/u/16712703?v=4" width="100px;" alt=""/><br /><sub><b>Juan Martín Seery</b></sub></a><br />Website/Docs</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -379,7 +339,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/jschepmans"><img src="https://avatars2.githubusercontent.com/u/5782977?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Johan Schepmans</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jschepmans" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://twitter.com/dillonraphael"><img src="https://avatars0.githubusercontent.com/u/3496193?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dillon Raphael</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=dillonraphael" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://twitter.com/dillonraphael"><img src="https://avatars0.githubusercontent.com/u/3496193?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dillon Raphael</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=dillonraphael" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=dillonraphael" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=dillonraphael" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/clgeoio"><img src="https://avatars2.githubusercontent.com/u/37571416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cody G</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=clgeoio" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=clgeoio" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/madflow"><img src="https://avatars0.githubusercontent.com/u/183248?v=4?s=100" width="100px;" alt=""/><br /><sub><b>madflow</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=madflow" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://twitter.com/nitaking_"><img src="https://avatars2.githubusercontent.com/u/10850034?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Satoshi Nitawaki</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nitaking" title="Code">💻</a> <a href="#maintenance-nitaking" title="Maintenance">🚧</a> <a href="#question-nitaking" title="Answering Questions">💬</a> <a href="https://github.com/blitz-js/blitz/commits?author=nitaking" title="Documentation">📖</a></td>
|
||||
@@ -741,6 +701,19 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<td align="center"><a href="https://github.com/c-ciobanu"><img src="https://avatars.githubusercontent.com/u/33382714?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cristi Ciobanu</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=c-ciobanu" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://arpitdalal.dev"><img src="https://avatars.githubusercontent.com/u/61059807?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arpit Dalal</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=arpitdalal" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/robertrisch"><img src="https://avatars.githubusercontent.com/u/73828816?v=4?s=100" width="100px;" alt=""/><br /><sub><b>robertrisch</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=robertrisch" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/saadaltabari"><img src="https://avatars.githubusercontent.com/u/29986512?v=4?s=100" width="100px;" alt=""/><br /><sub><b>saadaltabari</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=saadaltabari" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=saadaltabari" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/iojcde"><img src="https://avatars.githubusercontent.com/u/31413538?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeeho Ahn</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=iojcde" title="Documentation">📖</a> <a href="#tool-iojcde" title="Tools">🔧</a> <a href="https://github.com/blitz-js/blitz/commits?author=iojcde" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://linkedin.com/in/ryanwashburne"><img src="https://avatars.githubusercontent.com/u/12566087?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryan Washburne</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=ryanwashburne" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/sherryxiao1988"><img src="https://avatars.githubusercontent.com/u/1202426?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Shundan Xiao</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=sherryxiao1988" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/tommywong-dev"><img src="https://avatars.githubusercontent.com/u/79971095?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tommywong-dev</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=tommywong-dev" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/datner"><img src="https://avatars.githubusercontent.com/u/22598347?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Datner</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=datner" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=datner" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://chaiwattsw.com/"><img src="https://avatars.githubusercontent.com/u/30198386?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chaiwat Trisuwan</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=chaiwattsw" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=chaiwattsw" title="Code">💻</a></td>
|
||||
<td align="center"><a href="oltdaniel.eu"><img src="https://avatars.githubusercontent.com/u/53529846?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Oltmanns</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=oltdaniel" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=oltdaniel" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/edrickleong"><img src="https://avatars.githubusercontent.com/u/10529706?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Edrick Leong</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/siddhsuresh"><img src="https://avatars.githubusercontent.com/u/83594610?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Siddharth Suresh</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=siddhsuresh" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=siddhsuresh" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://jins.dev"><img src="https://avatars.githubusercontent.com/u/39466936?v=4" width="100px;" alt=""/><br /><sub><b>JH.Lee</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Tests">⚠️</a> <a href="#maintenance-orionmiz" title="Maintenance">🚧</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
save-exact=true
|
||||
legacy-peer-deps=true
|
||||
|
||||
public-hoist-pattern[]=@tanstack/react-query
|
||||
public-hoist-pattern[]=next
|
||||
public-hoist-pattern[]=secure-password
|
||||
public-hoist-pattern[]=*jest*
|
||||
@@ -1,10 +1,15 @@
|
||||
// @ts-check
|
||||
|
||||
const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
enabled: process.env.ANALYZE === "true",
|
||||
})
|
||||
const { withBlitz } = require("@blitzjs/next")
|
||||
|
||||
module.exports = withBlitz(
|
||||
withBundleAnalyzer({
|
||||
reactStrictMode: true,
|
||||
})
|
||||
)
|
||||
/**
|
||||
* @type {import('@blitzjs/next').BlitzConfig}
|
||||
**/
|
||||
const config = {
|
||||
reactStrictMode: true,
|
||||
}
|
||||
|
||||
module.exports = withBlitz(withBundleAnalyzer(config))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "toolkit-app",
|
||||
"version": "1.0.1-alpha.16",
|
||||
"scripts": {
|
||||
"start:dev": "pnpm run prisma:start && next dev",
|
||||
"start:dev": "pnpm run prisma:start && blitz dev",
|
||||
"buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
@@ -28,8 +28,8 @@
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@hookform/resolvers": "2.8.8",
|
||||
"@prisma/client": "3.9.0",
|
||||
"blitz": "workspace:2.0.0-alpha.56",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-beta.0",
|
||||
"next": "12.2.0",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.0.0",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useCurrentUser } from "app/core/hooks/useCurrentUser"
|
||||
import logout from "app/auth/mutations/logout"
|
||||
import logo from "public/logo.png"
|
||||
import { useMutation } from "@blitzjs/rpc"
|
||||
import { Routes } from "@blitzjs/next"
|
||||
import { Routes, BlitzPage } from "@blitzjs/next"
|
||||
|
||||
/*
|
||||
* This file is just for a pleasant getting started page for your new app.
|
||||
@@ -53,7 +53,7 @@ const UserInfo = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const Home = () => {
|
||||
const Home: BlitzPage = () => {
|
||||
return (
|
||||
<Layout title="Home">
|
||||
<div className="container">
|
||||
|
||||
8
apps/web/.npmrc
Normal file
8
apps/web/.npmrc
Normal file
@@ -0,0 +1,8 @@
|
||||
save-exact=true
|
||||
legacy-peer-deps=true
|
||||
|
||||
public-hoist-pattern[]=@tanstack/react-query
|
||||
public-hoist-pattern[]=next
|
||||
public-hoist-pattern[]=secure-password
|
||||
public-hoist-pattern[]=*jest*
|
||||
public-hoist-pattern[]=@testing-library/*
|
||||
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start:dev": "pnpm run prisma:start && next dev",
|
||||
"buildapp": "prisma generate && next build",
|
||||
"buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
|
||||
@@ -20,7 +20,7 @@
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "3.9.0",
|
||||
"@prisma/client": "4.0.0",
|
||||
"@types/jest": "27.4.1",
|
||||
"@types/passport-twitter": "1.0.37",
|
||||
"blitz": "workspace:*",
|
||||
|
||||
7
apps/web/pages/[postId]/index.tsx
Normal file
7
apps/web/pages/[postId]/index.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function Post() {
|
||||
return (
|
||||
<div>
|
||||
<h1>Post</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
24
apps/web/pages/page-with-get-query-data.tsx
Normal file
24
apps/web/pages/page-with-get-query-data.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import {getQueryData, useQuery} from "@blitzjs/rpc"
|
||||
import getBasic from "../app/queries/getBasic"
|
||||
import {useState} from "react"
|
||||
|
||||
function PageWithGetQueryData() {
|
||||
const [data] = useQuery(getBasic, {})
|
||||
const [newData, setNewData] = useState<string>()
|
||||
return (
|
||||
<div>
|
||||
<div>{data}</div>
|
||||
{newData && <div id="new-data">{newData}</div>}
|
||||
<button
|
||||
onClick={async () => {
|
||||
const newData = getQueryData(getBasic, {})
|
||||
setNewData(newData)
|
||||
}}
|
||||
>
|
||||
Call getQueryData
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageWithGetQueryData
|
||||
27
apps/web/pages/page-with-gssp-redirect.tsx
Normal file
27
apps/web/pages/page-with-gssp-redirect.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import {SessionContext} from "@blitzjs/auth"
|
||||
import {Routes} from "@blitzjs/next"
|
||||
import {gSSP} from "app/blitz-server"
|
||||
|
||||
type Props = {
|
||||
userId: unknown
|
||||
publicData: SessionContext["$publicData"]
|
||||
}
|
||||
|
||||
export const getServerSideProps = gSSP<Props>(async ({ctx}) => {
|
||||
const {session} = ctx
|
||||
|
||||
return {
|
||||
redirect: {destination: Routes.Post({postId: "1"})},
|
||||
props: {
|
||||
userId: session.userId,
|
||||
publicData: session.$publicData,
|
||||
publishedAt: new Date(0),
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
function PageWithGsspRedirect(props: Props) {
|
||||
return <div>{JSON.stringify(props, null, 2)}</div>
|
||||
}
|
||||
|
||||
export default PageWithGsspRedirect
|
||||
BIN
assets/flightcontrol.png
Normal file
BIN
assets/flightcontrol.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
@@ -16,7 +16,7 @@
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@prisma/client": "3.9.0",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:*",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.0",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "3.9.0",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:*",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.0",
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "3.9.0",
|
||||
"@prisma/client": "4.0.0",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"blitz": "workspace:*",
|
||||
"next": "12.2.0",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0",
|
||||
"react-query": "3.39.0"
|
||||
"react-dom": "18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/react": "13.0.0",
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
exports[`useMutation > useMutation calls the resolver with the argument > shouldn't work with query function 1`] = `"\\"useMutation\\" was expected to be called with a mutation but was called with a \\"query\\""`;
|
||||
|
||||
exports[`useMutation > useMutation calls the resolver with the argument > shouldn't work with regular functions 1`] = `"Either the file path to your resolver is incorrect (must be in a \\"queries\\" or \\"mutations\\" folder that isn't nested inside \\"pages\\" or \\"api\\") or you are trying to use Blitz's useQuery to fetch from third-party APIs (to do that, import useQuery directly from \\"react-query\\")"`;
|
||||
exports[`useMutation > useMutation calls the resolver with the argument > shouldn't work with regular functions 1`] = `"Either the file path to your resolver is incorrect (must be in a \\"queries\\" or \\"mutations\\" folder that isn't nested inside \\"pages\\" or \\"api\\") or you are trying to use Blitz's useQuery to fetch from third-party APIs (to do that, import useQuery directly from \\"@tanstack/react-query\\")."`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Vitest Snapshot v1
|
||||
|
||||
exports[`useQuery > a "query" that converts the string parameter to uppercase > shouldn't work with mutation function 1`] = `"Cannot read properties of null (reading 'isReady')"`;
|
||||
exports[`useQuery > a "query" that converts the string parameter to uppercase > shouldn't work with mutation function 1`] = `"\\"useQuery\\" was expected to be called with a query but was called with a \\"mutation\\""`;
|
||||
|
||||
exports[`useQuery > a "query" that converts the string parameter to uppercase > shouldn't work with regular functions 1`] = `"Cannot read properties of null (reading 'isReady')"`;
|
||||
exports[`useQuery > a "query" that converts the string parameter to uppercase > shouldn't work with regular functions 1`] = `"Either the file path to your resolver is incorrect (must be in a \\"queries\\" or \\"mutations\\" folder that isn't nested inside \\"pages\\" or \\"api\\") or you are trying to use Blitz's useQuery to fetch from third-party APIs (to do that, import useQuery directly from \\"@tanstack/react-query\\")."`;
|
||||
|
||||
@@ -1,166 +1,190 @@
|
||||
import {describe, it, expect, beforeAll, vi} from "vitest"
|
||||
import {act, screen, waitForElementToBeRemoved, waitFor} from "@testing-library/react"
|
||||
import {useQuery, useInfiniteQuery} from "@blitzjs/rpc"
|
||||
import {useQuery, useInfiniteQuery, BlitzRpcPlugin, QueryClientProvider} from "@blitzjs/rpc"
|
||||
import React from "react"
|
||||
import delay from "delay"
|
||||
import {buildMutationRpc, buildQueryRpc, render} from "../../utils/blitz-test-utils"
|
||||
import {buildMutationRpc, buildQueryRpc, mockRouter, render} from "../../utils/blitz-test-utils"
|
||||
import {RouterContext} from "next/dist/shared/lib/router-context"
|
||||
|
||||
beforeAll(() => {
|
||||
globalThis.__BLITZ_SESSION_COOKIE_PREFIX = "qm-test-cookie-prefix"
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true
|
||||
})
|
||||
|
||||
describe("useQuery", () => {
|
||||
it("Placeholder", async () => {
|
||||
console.log("placeholder")
|
||||
const setupHook = (
|
||||
ID: string,
|
||||
params: any,
|
||||
queryFn: (...args: any) => any,
|
||||
options: Parameters<typeof useQuery>[2] = {} as any,
|
||||
): [{data?: any; setQueryData?: any}, Function] => {
|
||||
let res = {}
|
||||
const qc = BlitzRpcPlugin({})
|
||||
|
||||
function TestHarness() {
|
||||
const [data, {setQueryData}] = useQuery(queryFn, params, {
|
||||
suspense: true,
|
||||
...options,
|
||||
} as any)
|
||||
|
||||
Object.assign(res, {data, setQueryData})
|
||||
return (
|
||||
<div id={`harness-${ID}`}>
|
||||
<span>{data ? `Ready${ID}` : "No data"}</span>
|
||||
<span>{data}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const ui = () => (
|
||||
<React.Suspense fallback="Loading...">
|
||||
<TestHarness />
|
||||
</React.Suspense>
|
||||
)
|
||||
|
||||
const {rerender} = render(ui(), {
|
||||
wrapper: ({children}) => (
|
||||
<QueryClientProvider client={globalThis.queryClient}>
|
||||
<RouterContext.Provider value={mockRouter}>{children}</RouterContext.Provider>
|
||||
</QueryClientProvider>
|
||||
),
|
||||
})
|
||||
return [res, () => rerender(ui())]
|
||||
}
|
||||
|
||||
describe('a "query" that converts the string parameter to uppercase', () => {
|
||||
const upcase = async (args: string) => {
|
||||
await delay(500)
|
||||
return args.toUpperCase()
|
||||
}
|
||||
|
||||
it("should work with Blitz queries", async () => {
|
||||
const [res] = setupHook("2", "test", buildQueryRpc(upcase))
|
||||
await waitForElementToBeRemoved(() => screen.getByText("Loading..."))
|
||||
await act(async () => {
|
||||
await screen.findByText("Ready2")
|
||||
expect(res.data).toBe("TEST")
|
||||
})
|
||||
})
|
||||
|
||||
it("should be able to change the data with setQueryData", async () => {
|
||||
const [res] = setupHook("3", "fooBar", buildQueryRpc(upcase))
|
||||
await waitForElementToBeRemoved(() => screen.getByText("Loading..."))
|
||||
await act(async () => {
|
||||
await screen.findByText("Ready3")
|
||||
expect(res.data).toBe("FOOBAR")
|
||||
res.setQueryData((p: string) => p.substr(3, 3), {refetch: false})
|
||||
await delay(100)
|
||||
})
|
||||
|
||||
expect(res.data).toBe("BAR")
|
||||
})
|
||||
|
||||
it("shouldn't work with regular functions", () => {
|
||||
console.error = vi.fn()
|
||||
expect(() => setupHook("4", "test", upcase)).toThrowErrorMatchingSnapshot()
|
||||
})
|
||||
|
||||
it("shouldn't work with mutation function", () => {
|
||||
console.error = vi.fn()
|
||||
expect(() => setupHook("5", "test", buildMutationRpc(upcase))).toThrowErrorMatchingSnapshot()
|
||||
})
|
||||
|
||||
it("suspense disabled if enabled is false", async () => {
|
||||
setupHook("6", "test", buildQueryRpc(upcase), {enabled: false})
|
||||
await screen.findByText("No data")
|
||||
})
|
||||
|
||||
it("suspense disabled if enabled is undefined", async () => {
|
||||
setupHook("7", "test", buildQueryRpc(upcase), {enabled: undefined})
|
||||
await screen.findByText("No data")
|
||||
})
|
||||
|
||||
// it("suspense disabled if enabled is false and suspense set", async () => {
|
||||
// setupHook("8", "test", buildQueryRpc(upcase), {
|
||||
// enabled: false,
|
||||
// suspense: true,
|
||||
// })
|
||||
// await screen.findByText("No data")
|
||||
// })
|
||||
|
||||
it("works with options other than enabled & suspense without type error", () => {
|
||||
const Demo = () => {
|
||||
useQuery(buildQueryRpc(upcase), undefined, {refetchInterval: 10000})
|
||||
return <div></div>
|
||||
}
|
||||
const ui = () => <Demo />
|
||||
|
||||
const {rerender} = render(ui(), {
|
||||
wrapper: ({children}) => (
|
||||
<QueryClientProvider client={globalThis.queryClient}>
|
||||
<RouterContext.Provider value={mockRouter}>{children}</RouterContext.Provider>
|
||||
</QueryClientProvider>
|
||||
),
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
// beforeAll(() => {
|
||||
// globalThis.__BLITZ_SESSION_COOKIE_PREFIX = "qm-test-cookie-prefix"
|
||||
// globalThis.IS_REACT_ACT_ENVIRONMENT = true
|
||||
// })
|
||||
|
||||
// describe("useQuery", () => {
|
||||
// const setupHook = (
|
||||
// params: any,
|
||||
// queryFn: (...args: any) => any,
|
||||
// options: Parameters<typeof useQuery>[2] = {} as any,
|
||||
// ): [{data?: any; setQueryData?: any}, Function] => {
|
||||
// let res = {}
|
||||
// function TestHarness() {
|
||||
// const [data, {setQueryData}] = useQuery(queryFn, params, {
|
||||
// suspense: true,
|
||||
// ...options,
|
||||
// } as any)
|
||||
// Object.assign(res, {data, setQueryData})
|
||||
// return (
|
||||
// <div id="harness">
|
||||
// <span>{data ? "Ready" : "No data"}</span>
|
||||
// <span>{data}</span>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
describe("useInfiniteQuery", () => {
|
||||
const setupHook = (
|
||||
ID: string,
|
||||
params: (arg?: any) => any,
|
||||
queryFn: (...args: any) => any,
|
||||
): [{data?: any; setQueryData?: any}, Function] => {
|
||||
let res = {}
|
||||
const qc = BlitzRpcPlugin({})
|
||||
|
||||
// const ui = () => (
|
||||
// <React.Suspense fallback="Loading...">
|
||||
// <TestHarness />
|
||||
// </React.Suspense>
|
||||
// )
|
||||
function TestHarness() {
|
||||
// TODO - fix typing
|
||||
//@ts-ignore
|
||||
const [groupedData] = useInfiniteQuery(queryFn, params, {
|
||||
suspense: true,
|
||||
getNextPageParam: () => {},
|
||||
})
|
||||
Object.assign(res, {groupedData})
|
||||
return (
|
||||
<div id="harness">
|
||||
<span>{groupedData ? `Ready${ID}` : "No data"}</span>
|
||||
<div>
|
||||
{groupedData.map((data: any, i) => (
|
||||
<div key={i}>{data}</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// const {rerender} = render(ui())
|
||||
// return [res, () => rerender(ui())]
|
||||
// }
|
||||
const ui = () => (
|
||||
<React.Suspense fallback={`Loading${ID}...`}>
|
||||
<TestHarness />
|
||||
</React.Suspense>
|
||||
)
|
||||
|
||||
// describe('a "query" that converts the string parameter to uppercase', () => {
|
||||
// const upcase = async (args: string) => {
|
||||
// await delay(1000)
|
||||
// return args.toUpperCase()
|
||||
// }
|
||||
// it("should work with Blitz queries", async () => {
|
||||
// const [res] = setupHook("test", buildQueryRpc(upcase))
|
||||
// await waitForElementToBeRemoved(() => screen.getByText("Loading..."))
|
||||
// await act(async () => {
|
||||
// await screen.findByText("Ready")
|
||||
// expect(res.data).toBe("TEST")
|
||||
// })
|
||||
// })
|
||||
const {rerender} = render(ui(), {
|
||||
wrapper: ({children}) => (
|
||||
<QueryClientProvider client={globalThis.queryClient}>
|
||||
<RouterContext.Provider value={mockRouter}>{children}</RouterContext.Provider>
|
||||
</QueryClientProvider>
|
||||
),
|
||||
})
|
||||
return [res, () => rerender(ui())]
|
||||
}
|
||||
|
||||
// it("should be able to change the data with setQueryData", async () => {
|
||||
// const [res] = setupHook("test", buildQueryRpc(upcase))
|
||||
// await waitForElementToBeRemoved(() => screen.getByText("Loading..."))
|
||||
// await act(async () => {
|
||||
// await screen.findByText("Ready")
|
||||
// expect(res.data).toBe("TEST")
|
||||
// res.setQueryData((p: string) => p.substr(1, 2), {refetch: false})
|
||||
// await waitFor(() => screen.getByText("ES"))
|
||||
// })
|
||||
// })
|
||||
|
||||
// it("shouldn't work with regular functions", () => {
|
||||
// console.error = vi.fn()
|
||||
// expect(() => setupHook("test", upcase)).toThrowErrorMatchingSnapshot()
|
||||
// })
|
||||
|
||||
// it("shouldn't work with mutation function", () => {
|
||||
// console.error = vi.fn()
|
||||
// expect(() => setupHook("test", buildMutationRpc(upcase))).toThrowErrorMatchingSnapshot()
|
||||
// })
|
||||
|
||||
// it("suspense disabled if enabled is false", async () => {
|
||||
// setupHook("test", buildQueryRpc(upcase), {enabled: false})
|
||||
// await screen.findByText("No data")
|
||||
// })
|
||||
|
||||
// it("suspense disabled if enabled is undefined", async () => {
|
||||
// setupHook("test", buildQueryRpc(upcase), {enabled: undefined})
|
||||
// await screen.findByText("No data")
|
||||
// })
|
||||
|
||||
// it("suspense disabled if enabled is false and suspense set", async () => {
|
||||
// setupHook("test", buildQueryRpc(upcase), {
|
||||
// enabled: false,
|
||||
// suspense: true,
|
||||
// })
|
||||
// await screen.findByText("No data")
|
||||
// })
|
||||
// })
|
||||
|
||||
// // it("works with options other than enabled & suspense without type error", () => {
|
||||
// // const queryFn = ((() => true) as unknown) as () => Promise<boolean>
|
||||
// // useQuery(queryFn, undefined, {refetchInterval: 10000})
|
||||
// // })
|
||||
// })
|
||||
|
||||
// describe("useInfiniteQuery", () => {
|
||||
// const setupHook = (
|
||||
// params: (arg?: any) => any,
|
||||
// queryFn: (...args: any) => any,
|
||||
// ): [{data?: any; setQueryData?: any}, Function] => {
|
||||
// let res = {}
|
||||
// function TestHarness() {
|
||||
// // TODO - fix typing
|
||||
// //@ts-ignore
|
||||
// const [groupedData] = useInfiniteQuery(queryFn, params, {
|
||||
// suspense: true,
|
||||
// getNextPageParam: () => {},
|
||||
// })
|
||||
// Object.assign(res, {groupedData})
|
||||
// return (
|
||||
// <div id="harness">
|
||||
// <span>{groupedData ? "Ready" : "No data"}</span>
|
||||
// <div>
|
||||
// {groupedData.map((data: any, i) => (
|
||||
// <div key={i}>{data}</div>
|
||||
// ))}
|
||||
// </div>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
|
||||
// const ui = () => (
|
||||
// <React.Suspense fallback="Loading...">
|
||||
// <TestHarness />
|
||||
// </React.Suspense>
|
||||
// )
|
||||
|
||||
// const {rerender} = render(ui())
|
||||
// return [res, () => rerender(ui())]
|
||||
// }
|
||||
|
||||
// const getItems = ({id}: {id: number}) => {
|
||||
// if (id === 1) {
|
||||
// return "item1"
|
||||
// } else if (id === 2) {
|
||||
// return "item2"
|
||||
// } else {
|
||||
// throw new Error("No item for this id")
|
||||
// }
|
||||
// }
|
||||
// it("should work", async () => {
|
||||
// setupHook(() => ({id: 1}), buildQueryRpc(getItems))
|
||||
// await waitForElementToBeRemoved(() => screen.getByText("Loading..."))
|
||||
// await act(async () => {
|
||||
// await screen.findByText("item1")
|
||||
// })
|
||||
|
||||
// setupHook(() => ({id: 2}), buildQueryRpc(getItems))
|
||||
// await act(async () => {
|
||||
// await screen.findByText("item2")
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
const getItems = ({id}: {id: number}) => {
|
||||
if (id === 1) {
|
||||
return "item1"
|
||||
} else if (id === 2) {
|
||||
return "item2"
|
||||
} else {
|
||||
throw new Error("No item for this id")
|
||||
}
|
||||
}
|
||||
it("should show loading", async () => {
|
||||
setupHook("1", () => ({id: 1}), buildQueryRpc(getItems))
|
||||
await waitForElementToBeRemoved(() => screen.getByText("Loading1..."))
|
||||
await act(async () => {
|
||||
await screen.findByText("item1")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
2
integration-tests/react-query-utils/.env
Normal file
2
integration-tests/react-query-utils/.env
Normal file
@@ -0,0 +1,2 @@
|
||||
SESSION_SECRET_KEY=hsdenhJfpLHrGjgdgg3jdF8g2bYD2PaQ
|
||||
HEADLESS=true
|
||||
1
integration-tests/react-query-utils/.eslintrc.js
Normal file
1
integration-tests/react-query-utils/.eslintrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("@blitzjs/config/eslint")
|
||||
3
integration-tests/react-query-utils/.gitignore
vendored
Normal file
3
integration-tests/react-query-utils/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
# Keep environment variables out of version control
|
||||
*.sqlite
|
||||
14
integration-tests/react-query-utils/app/blitz-client.ts
Normal file
14
integration-tests/react-query-utils/app/blitz-client.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {BlitzRpcPlugin} from "@blitzjs/rpc"
|
||||
import {setupBlitzClient} from "@blitzjs/next"
|
||||
import {AuthClientPlugin} from "@blitzjs/auth"
|
||||
|
||||
const {withBlitz} = setupBlitzClient({
|
||||
plugins: [
|
||||
AuthClientPlugin({
|
||||
cookiePrefix: "react-query-utils-tests-cookie-prefix",
|
||||
}),
|
||||
BlitzRpcPlugin({}),
|
||||
],
|
||||
})
|
||||
|
||||
export {withBlitz}
|
||||
16
integration-tests/react-query-utils/app/blitz-server.ts
Normal file
16
integration-tests/react-query-utils/app/blitz-server.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
AuthServerPlugin({
|
||||
cookiePrefix: "react-query-utils-tests-cookie-prefix",
|
||||
storage: PrismaStorage(db),
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default async function getBasic() {
|
||||
return "basic-result"
|
||||
}
|
||||
8
integration-tests/react-query-utils/db/index.ts
Normal file
8
integration-tests/react-query-utils/db/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import {enhancePrisma} from "blitz"
|
||||
import {PrismaClient} from "@prisma/client"
|
||||
|
||||
const EnhancedPrisma = enhancePrisma(PrismaClient)
|
||||
|
||||
export * from "@prisma/client"
|
||||
const prisma = new EnhancedPrisma()
|
||||
export default prisma
|
||||
@@ -0,0 +1,47 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"name" TEXT,
|
||||
"email" TEXT NOT NULL,
|
||||
"hashedPassword" TEXT,
|
||||
"role" TEXT NOT NULL DEFAULT 'user'
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Session" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"expiresAt" DATETIME,
|
||||
"handle" TEXT NOT NULL,
|
||||
"userId" INTEGER,
|
||||
"hashedSessionToken" TEXT,
|
||||
"antiCSRFToken" TEXT,
|
||||
"publicData" TEXT,
|
||||
"privateData" TEXT,
|
||||
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Token" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"hashedToken" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"expiresAt" DATETIME NOT NULL,
|
||||
"sentTo" TEXT NOT NULL,
|
||||
"userId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Token_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Session_handle_key" ON "Session"("handle");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Token_hashedToken_type_key" ON "Token"("hashedToken", "type");
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "sqlite"
|
||||
50
integration-tests/react-query-utils/db/schema.prisma
Normal file
50
integration-tests/react-query-utils/db/schema.prisma
Normal file
@@ -0,0 +1,50 @@
|
||||
datasource sqlite {
|
||||
provider = "sqlite"
|
||||
url = "file:./db.sqlite"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String?
|
||||
email String @unique
|
||||
hashedPassword String?
|
||||
role String @default("user")
|
||||
|
||||
sessions Session[]
|
||||
tokens Token[]
|
||||
}
|
||||
|
||||
model Session {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
expiresAt DateTime?
|
||||
handle String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int?
|
||||
hashedSessionToken String?
|
||||
antiCSRFToken String?
|
||||
publicData String?
|
||||
privateData String?
|
||||
}
|
||||
|
||||
model Token {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
hashedToken String
|
||||
type String
|
||||
expiresAt DateTime
|
||||
sentTo String
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
|
||||
@@unique([hashedToken, type])
|
||||
}
|
||||
7
integration-tests/react-query-utils/db/seed.ts
Normal file
7
integration-tests/react-query-utils/db/seed.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import prisma from "./index"
|
||||
|
||||
const seed = async () => {
|
||||
await prisma.$reset()
|
||||
}
|
||||
|
||||
export default seed
|
||||
5
integration-tests/react-query-utils/next-env.d.ts
vendored
Normal file
5
integration-tests/react-query-utils/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
2
integration-tests/react-query-utils/next.config.js
Normal file
2
integration-tests/react-query-utils/next.config.js
Normal file
@@ -0,0 +1,2 @@
|
||||
const {withBlitz} = require("@blitzjs/next")
|
||||
module.exports = withBlitz({})
|
||||
44
integration-tests/react-query-utils/package.json
Normal file
44
integration-tests/react-query-utils/package.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "test-react-query-utils",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start:dev": "pnpm run prisma:start && next dev",
|
||||
"test": "pnpm run prisma:start && vitest run",
|
||||
"test-watch": "vitest",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
|
||||
"prisma:start": "prisma generate && prisma migrate deploy",
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"prisma": {
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:*",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.0",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/node-fetch": "2.6.1",
|
||||
"@types/react": "18.0.1",
|
||||
"b64-lite": "1.4.0",
|
||||
"eslint": "7.32.0",
|
||||
"fs-extra": "10.0.1",
|
||||
"get-port": "6.1.2",
|
||||
"node-fetch": "3.2.3",
|
||||
"typescript": "^4.5.3"
|
||||
}
|
||||
}
|
||||
36
integration-tests/react-query-utils/pages/_app.tsx
Normal file
36
integration-tests/react-query-utils/pages/_app.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import {ErrorFallbackProps, ErrorComponent, ErrorBoundary, AppProps} from "@blitzjs/next"
|
||||
import {AuthenticationError, AuthorizationError} from "blitz"
|
||||
import React, {Suspense} from "react"
|
||||
import {withBlitz} from "../app/blitz-client"
|
||||
|
||||
function RootErrorFallback({error}: ErrorFallbackProps) {
|
||||
if (error instanceof AuthenticationError) {
|
||||
return <div>Error: You are not authenticated</div>
|
||||
} else if (error instanceof AuthorizationError) {
|
||||
return (
|
||||
<ErrorComponent
|
||||
statusCode={error.statusCode}
|
||||
title="Sorry, you are not authorized to access this"
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<ErrorComponent
|
||||
statusCode={(error as any)?.statusCode || 400}
|
||||
title={error.message || error.name}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function MyApp({Component, pageProps}: AppProps) {
|
||||
return (
|
||||
<Suspense fallback="Loading...">
|
||||
<ErrorBoundary FallbackComponent={RootErrorFallback}>
|
||||
<Component {...pageProps} />
|
||||
</ErrorBoundary>
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
export default withBlitz(MyApp)
|
||||
@@ -0,0 +1,4 @@
|
||||
import {rpcHandler} from "@blitzjs/rpc"
|
||||
import {api} from "../../../app/blitz-server"
|
||||
|
||||
export default api(rpcHandler({onError: console.log}))
|
||||
@@ -0,0 +1,35 @@
|
||||
import {getQueryData, useQuery} from "@blitzjs/rpc"
|
||||
import {Suspense, useState} from "react"
|
||||
import getBasic from "../app/queries/getBasic"
|
||||
|
||||
function Content() {
|
||||
const [data] = useQuery(getBasic, undefined)
|
||||
const [newData, setNewData] = useState<string>()
|
||||
return (
|
||||
<div>
|
||||
<div>{data}</div>
|
||||
{newData && <div id="new-data">{newData}</div>}
|
||||
<button
|
||||
id="button"
|
||||
onClick={async () => {
|
||||
const newData = getQueryData(getBasic, undefined)
|
||||
setNewData(newData)
|
||||
}}
|
||||
>
|
||||
Call getQueryData
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function PageWithGetQueryData() {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageWithGetQueryData
|
||||
59
integration-tests/react-query-utils/test/index.test.ts
Normal file
59
integration-tests/react-query-utils/test/index.test.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import {describe, it, expect, beforeAll, afterAll} from "vitest"
|
||||
import {killApp, findPort, launchApp, nextBuild, nextStart} from "../../utils/next-test-utils"
|
||||
import webdriver from "../../utils/next-webdriver"
|
||||
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = (mode?: string) => {
|
||||
describe("get query data", () => {
|
||||
it(
|
||||
"should work",
|
||||
async () => {
|
||||
const browser = await webdriver(appPort, "/page-with-get-query-data")
|
||||
|
||||
browser.waitForElementByCss("#button", 0)
|
||||
await browser.elementByCss("#button").click()
|
||||
|
||||
browser.waitForElementByCss("#new-data", 0)
|
||||
const newText = await browser.elementByCss("#new-data").text()
|
||||
expect(newText).toMatch(/basic-result/)
|
||||
|
||||
if (browser) await browser.close()
|
||||
},
|
||||
5000 * 60 * 2,
|
||||
)
|
||||
})
|
||||
}
|
||||
describe("React Query Utils Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
appPort = await findPort()
|
||||
app = await launchApp(appDir, appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}, 5000 * 60 * 2)
|
||||
afterAll(async () => await killApp(app))
|
||||
runTests()
|
||||
})
|
||||
|
||||
describe("server mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await nextBuild(appDir)
|
||||
appPort = await findPort()
|
||||
app = await nextStart(appDir, appPort, {cwd: process.cwd()})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}, 5000 * 60 * 2)
|
||||
afterAll(async () => await killApp(app))
|
||||
|
||||
runTests()
|
||||
})
|
||||
})
|
||||
11
integration-tests/react-query-utils/tsconfig.json
Normal file
11
integration-tests/react-query-utils/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "@blitzjs/config/tsconfig.nextjs.json",
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types"],
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"react": ["./node_modules/@types/react"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"baseUrl": "."
|
||||
}
|
||||
15
integration-tests/react-query-utils/types.ts
Normal file
15
integration-tests/react-query-utils/types.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {SimpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import {User} from "./db"
|
||||
|
||||
export type Role = "ADMIN" | "USER"
|
||||
|
||||
declare module "@blitzjs/auth" {
|
||||
export interface Session {
|
||||
isAuthorized: SimpleRolesIsAuthorized<Role>
|
||||
PublicData: {
|
||||
userId: User["id"]
|
||||
role: Role
|
||||
views?: number
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "3.9.0",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:*",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.0",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import {render as defaultRender} from "@testing-library/react"
|
||||
import {NextRouter} from "next/router"
|
||||
import {vi} from "vitest"
|
||||
import {QueryClient, QueryClientProvider} from "react-query"
|
||||
import React from "react"
|
||||
import {BlitzRpcPlugin} from "@blitzjs/rpc"
|
||||
import {vi} from "vitest"
|
||||
import {QueryClient} from "@tanstack/react-query"
|
||||
import {BlitzRpcPlugin, QueryClientProvider} from "@blitzjs/rpc"
|
||||
import {NextRouter} from "next/router"
|
||||
import {RouterContext} from "next/dist/shared/lib/router-context"
|
||||
import {render as defaultRender} from "@testing-library/react"
|
||||
|
||||
const mockRouter: NextRouter = {
|
||||
export const mockRouter: NextRouter = {
|
||||
basePath: "",
|
||||
pathname: "/",
|
||||
route: "/",
|
||||
@@ -56,8 +57,6 @@ const BlitzProvider = ({
|
||||
|
||||
return children
|
||||
}
|
||||
export const RouterContext = React.createContext(null as any)
|
||||
RouterContext.displayName = "RouterContext"
|
||||
const compose =
|
||||
(...rest) =>
|
||||
(x: React.ComponentType<any>) =>
|
||||
|
||||
58
integration-tests/utils/next-webdriver.d.ts
vendored
58
integration-tests/utils/next-webdriver.d.ts
vendored
@@ -1,34 +1,24 @@
|
||||
interface ChainMethods {
|
||||
elementByCss: (selector: string) => Chain<Element>
|
||||
elementById: () => Chain<Element>
|
||||
getValue: () => Chain<any>
|
||||
text: () => Chain<string>
|
||||
type: () => Chain<any>
|
||||
moveTo: () => Chain<any>
|
||||
getComputedCss: () => Chain<any>
|
||||
getAttribute: () => Chain<any>
|
||||
hasElementByCssSelector: () => Chain<any>
|
||||
click: () => Chain<any>
|
||||
elementsByCss: () => Chain<Element[]>
|
||||
waitForElementByCss: (arg: string) => Chain<any>
|
||||
eval: (evalStr: string) => Chain<any>
|
||||
log: () => Chain<any>
|
||||
url: () => Chain<any>
|
||||
back: () => Chain<any>
|
||||
forward: () => Chain<any>
|
||||
refresh: () => Chain<any>
|
||||
setDimensions: (opts: {height: number; width: number}) => Chain<any>
|
||||
close: () => Chain<any>
|
||||
quit: () => Chain<any>
|
||||
}
|
||||
|
||||
interface Chain<T> extends Promise<T & ChainMethods>, ChainMethods {}
|
||||
|
||||
type Browser = {__brand: "Browser"}
|
||||
|
||||
export default function (
|
||||
appPort: number,
|
||||
path: string,
|
||||
waitHydration?: boolean,
|
||||
allowHydrationRetry?: boolean,
|
||||
): Promise<Chain<Browser>>
|
||||
import {BrowserInterface} from "./browsers/base"
|
||||
export declare const USE_SELENIUM: boolean
|
||||
/**
|
||||
*
|
||||
* @param appPortOrUrl can either be the port or the full URL
|
||||
* @param url the path/query to append when using appPort
|
||||
* @param options.waitHydration whether to wait for react hydration to finish
|
||||
* @param options.retryWaitHydration allow retrying hydration wait if reload occurs
|
||||
* @param options.disableCache disable cache for page load
|
||||
* @param options.beforePageLoad the callback receiving page instance before loading page
|
||||
* @returns thenable browser instance
|
||||
*/
|
||||
export default function webdriver(
|
||||
appPortOrUrl: string | number,
|
||||
url: string,
|
||||
options?: {
|
||||
waitHydration?: boolean
|
||||
retryWaitHydration?: boolean
|
||||
disableCache?: boolean
|
||||
beforePageLoad?: (page: any) => void
|
||||
locale?: string
|
||||
},
|
||||
): Promise<BrowserInterface>
|
||||
//# sourceMappingURL=next-webdriver.d.ts.map
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace: *",
|
||||
"@blitzjs/rpc": "workspace: *",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"@testing-library/react": "13.0.0",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
@@ -23,7 +24,6 @@
|
||||
"playwright-chromium": "1.14.1",
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0",
|
||||
"react-query": "3.39.0",
|
||||
"resolve-cwd": "3.0.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"rimraf": "3.0.2",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user