Compare commits
23 Commits
@blitzjs/n
...
@blitzjs/c
| 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 |
@@ -3670,6 +3670,39 @@
|
||||
"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/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
|
||||
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/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/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/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/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/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.
|
||||
@@ -1,24 +1,25 @@
|
||||
{
|
||||
"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",
|
||||
@@ -26,13 +27,18 @@
|
||||
"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",
|
||||
@@ -44,6 +50,7 @@
|
||||
"fair-wombats-sneeze",
|
||||
"famous-kings-explain",
|
||||
"fast-trainers-kneel",
|
||||
"few-dogs-fetch",
|
||||
"flat-bees-approve",
|
||||
"four-brooms-juggle",
|
||||
"four-meals-fry",
|
||||
@@ -71,6 +78,8 @@
|
||||
"lemon-games-press",
|
||||
"lemon-seas-push",
|
||||
"light-donkeys-double",
|
||||
"long-bees-hope",
|
||||
"lovely-berries-sell",
|
||||
"lovely-colts-share",
|
||||
"lucky-cows-try",
|
||||
"mean-gorillas-reply",
|
||||
@@ -92,6 +101,7 @@
|
||||
"olive-feet-rhyme",
|
||||
"olive-sheep-rhyme",
|
||||
"perfect-eyes-repeat",
|
||||
"perfect-trains-double",
|
||||
"plenty-bottles-swim",
|
||||
"polite-lizards-love",
|
||||
"poor-peas-lick",
|
||||
@@ -120,11 +130,14 @@
|
||||
"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",
|
||||
@@ -156,6 +169,7 @@
|
||||
"weak-suns-shave",
|
||||
"wicked-ghosts-cough",
|
||||
"wicked-rings-walk",
|
||||
"wise-eels-visit",
|
||||
"wise-frogs-give",
|
||||
"wise-rabbits-complain"
|
||||
]
|
||||
|
||||
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/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.
|
||||
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
|
||||
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
|
||||
35
README.md
35
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-389-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">
|
||||
@@ -66,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>
|
||||
@@ -85,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>
|
||||
@@ -105,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>
|
||||
@@ -119,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>
|
||||
|
||||
@@ -151,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>
|
||||
@@ -709,6 +711,9 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<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,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))
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@hookform/resolvers": "2.8.8",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-alpha.68",
|
||||
"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">
|
||||
|
||||
@@ -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",
|
||||
|
||||
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 |
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"prepare": "husky install",
|
||||
"build": "turbo run build",
|
||||
"build:apps": "turbo run buildapp",
|
||||
"build:apps": "turbo run buildapp --concurrency=1",
|
||||
"dev": "turbo run dev --no-cache --parallel",
|
||||
"lint": "turbo run lint",
|
||||
"test": "turbo run test",
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# @blitzjs/auth
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
- Updated dependencies [2cc888ef]
|
||||
- blitz@2.0.0-beta.72
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- blitz@2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- blitz@2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd31e56b]
|
||||
- blitz@2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/auth",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts",
|
||||
@@ -26,7 +26,7 @@
|
||||
"@types/secure-password": "3.1.1",
|
||||
"b64-lite": "1.4.0",
|
||||
"bad-behavior": "1.0.1",
|
||||
"blitz": "2.0.0-alpha.68",
|
||||
"blitz": "2.0.0-beta.0",
|
||||
"cookie": "0.4.1",
|
||||
"cookie-session": "2.0.0",
|
||||
"debug": "4.3.3",
|
||||
@@ -40,7 +40,7 @@
|
||||
"url": "0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-alpha.68",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.0",
|
||||
"@testing-library/react": "13.0.0",
|
||||
"@testing-library/react-hooks": "7.0.2",
|
||||
"@types/cookie": "0.4.1",
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# @blitzjs/next
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
- Updated dependencies [2cc888ef]
|
||||
- @blitzjs/rpc@2.0.0-beta.72
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/rpc@2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/rpc@2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a3c92cb8: Allow using `RouteUrlObject` as `redirect.destination` in `getStaticProps` and `getServerSideProps`
|
||||
- Updated dependencies [49028024]
|
||||
- @blitzjs/rpc@2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/next",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "pnpm predev && pnpm watch unbuild src --wait=0.2",
|
||||
@@ -24,7 +24,7 @@
|
||||
"eslint.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/rpc": "2.0.0-alpha.68",
|
||||
"@blitzjs/rpc": "2.0.0-beta.0",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"@types/hoist-non-react-statics": "3.3.1",
|
||||
"debug": "4.3.3",
|
||||
@@ -34,7 +34,7 @@
|
||||
"supports-color": "8.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-alpha.68",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.0",
|
||||
"@testing-library/dom": "8.13.0",
|
||||
"@testing-library/jest-dom": "5.16.3",
|
||||
"@testing-library/react": "13.0.0",
|
||||
@@ -44,7 +44,7 @@
|
||||
"@types/react": "18.0.1",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"@types/testing-library__react-hooks": "4.0.0",
|
||||
"blitz": "2.0.0-alpha.68",
|
||||
"blitz": "2.0.0-beta.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"find-up": "4.1.0",
|
||||
"next": "12.2.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {NextConfig} from "next"
|
||||
import {
|
||||
import type {
|
||||
NextConfig,
|
||||
GetServerSideProps,
|
||||
GetServerSidePropsResult,
|
||||
GetStaticProps,
|
||||
@@ -30,6 +30,8 @@ import {IncomingMessage, ServerResponse} from "http"
|
||||
import {withSuperJsonProps} from "./superjson"
|
||||
import {ParsedUrlQuery} from "querystring"
|
||||
import {PreviewData} from "next/types"
|
||||
import {resolveHref} from "next/dist/shared/lib/router/router"
|
||||
import {RouteUrlObject, isRouteUrlObject} from "blitz"
|
||||
|
||||
export * from "./index-browser"
|
||||
|
||||
@@ -50,6 +52,25 @@ type SetupBlitzOptions = {
|
||||
onError?: (err: Error) => void
|
||||
}
|
||||
|
||||
export type Redirect =
|
||||
| {
|
||||
statusCode: 301 | 302 | 303 | 307 | 308
|
||||
destination: string | RouteUrlObject
|
||||
basePath?: false
|
||||
}
|
||||
| {
|
||||
permanent: boolean
|
||||
destination: string | RouteUrlObject
|
||||
basePath?: false
|
||||
}
|
||||
|
||||
export type BlitzGSSPResult<P> = {props: P | Promise<P>} | {redirect: Redirect} | {notFound: true}
|
||||
|
||||
export type BlitzGSPResult<P> =
|
||||
| {props: P; revalidate?: number | boolean}
|
||||
| {redirect: Redirect; revalidate?: number | boolean}
|
||||
| {notFound: true; revalidate?: number | boolean}
|
||||
|
||||
export type BlitzGSSPHandler<
|
||||
TProps,
|
||||
Query extends ParsedUrlQuery = ParsedUrlQuery,
|
||||
@@ -59,8 +80,8 @@ export type BlitzGSSPHandler<
|
||||
req,
|
||||
res,
|
||||
...args
|
||||
}: Parameters<GetServerSideProps<TProps, Query, PD>>[0] & {ctx: Ctx}) => ReturnType<
|
||||
GetServerSideProps<TProps, Query, PD>
|
||||
}: Parameters<GetServerSideProps<TProps, Query, PD>>[0] & {ctx: Ctx}) => Promise<
|
||||
BlitzGSSPResult<TProps>
|
||||
>
|
||||
|
||||
export type BlitzGSPHandler<
|
||||
@@ -70,9 +91,9 @@ export type BlitzGSPHandler<
|
||||
> = ({
|
||||
ctx,
|
||||
...args
|
||||
}: Parameters<GetStaticProps<TProps, Query, PD>>[0] & {ctx: Ctx}) => ReturnType<
|
||||
GetStaticProps<TProps, Query, PD>
|
||||
>
|
||||
}: Parameters<GetStaticProps<TProps, Query, PD>>[0] & {ctx: Ctx}) =>
|
||||
| Promise<BlitzGSPResult<TProps>>
|
||||
| BlitzGSPResult<TProps>
|
||||
|
||||
export type BlitzAPIHandler<TResult> = (
|
||||
req: NextApiRequest,
|
||||
@@ -123,7 +144,12 @@ export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
|
||||
|
||||
try {
|
||||
const result = await handler({req, res, ctx, ...rest})
|
||||
return withSuperJsonProps(withDehydratedState(result, getClient()))
|
||||
return withSuperJsonProps(
|
||||
withDehydratedState(
|
||||
normalizeRedirectValues<GetServerSidePropsResult<TProps>>(result),
|
||||
getClient(),
|
||||
),
|
||||
)
|
||||
} catch (err: any) {
|
||||
onError?.(err)
|
||||
throw err
|
||||
@@ -143,7 +169,12 @@ export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
|
||||
|
||||
try {
|
||||
const result = await handler({...context, ctx: ctx})
|
||||
return withSuperJsonProps(withDehydratedState(result, getClient()))
|
||||
return withSuperJsonProps(
|
||||
withDehydratedState(
|
||||
normalizeRedirectValues<GetStaticPropsResult<TProps>>(result),
|
||||
getClient(),
|
||||
),
|
||||
)
|
||||
} catch (err: any) {
|
||||
onError?.(err)
|
||||
throw err
|
||||
@@ -219,6 +250,7 @@ export type PrefetchQueryFn = <T extends AsyncFunc, TInput = FirstParam<T>>(
|
||||
options?: DefaultOptions,
|
||||
) => Promise<void>
|
||||
|
||||
type BlitzResult = Partial<BlitzGSPResult<any> & BlitzGSSPResult<any>>
|
||||
type Result = Partial<GetServerSidePropsResult<any> & GetStaticPropsResult<any>>
|
||||
|
||||
function withDehydratedState<T extends Result>(result: T, queryClient: QueryClient | null) {
|
||||
@@ -229,6 +261,27 @@ function withDehydratedState<T extends Result>(result: T, queryClient: QueryClie
|
||||
return {...result, props: {...("props" in result ? result.props : undefined), dehydratedState}}
|
||||
}
|
||||
|
||||
// Converts Blitz's GetServerSidePropsResult and GetStaticPropsResult to a NextJS compatible format
|
||||
// Blitz accepts string | RouteUrlObject as redirect.destination — this function converts it to a string
|
||||
const normalizeRedirectValues = <NormalizedResult extends Result>(
|
||||
result: BlitzResult,
|
||||
): NormalizedResult => {
|
||||
if ("redirect" in result) {
|
||||
const dest = result.redirect?.destination
|
||||
if (dest && isRouteUrlObject(dest)) {
|
||||
// Todo: find a better way to resolve href without `as any` assertion.
|
||||
const resolvedDest = resolveHref({asPath: "/", pathname: "/"} as any, dest, true)
|
||||
|
||||
return {
|
||||
...result,
|
||||
redirect: {...result.redirect, destination: resolvedDest[1] || resolvedDest[0]},
|
||||
} as NormalizedResult
|
||||
}
|
||||
}
|
||||
|
||||
return result as NormalizedResult
|
||||
}
|
||||
|
||||
declare module "blitz" {
|
||||
export interface Ctx {
|
||||
prefetchQuery: PrefetchQueryFn
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# @blitzjs/rpc
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
- Updated dependencies [2cc888ef]
|
||||
- @blitzjs/auth@2.0.0-beta.72
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/auth@2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/auth@2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 49028024: Add `getQueryData` utility to get an existing query's cached data
|
||||
- @blitzjs/auth@2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/rpc",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts && wait-on -d 250 ../blitz-auth/dist/index-browser.d.ts",
|
||||
@@ -20,7 +20,7 @@
|
||||
"dist/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-alpha.68",
|
||||
"@blitzjs/auth": "2.0.0-beta.0",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"b64-lite": "1.4.0",
|
||||
"bad-behavior": "1.0.1",
|
||||
@@ -30,11 +30,11 @@
|
||||
"supports-color": "8.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-alpha.68",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.0",
|
||||
"@types/debug": "4.1.7",
|
||||
"@types/react": "18.0.1",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-alpha.68",
|
||||
"blitz": "2.0.0-beta.0",
|
||||
"next": "12.2.0",
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0",
|
||||
|
||||
@@ -7,6 +7,7 @@ export {
|
||||
invalidateQuery,
|
||||
setQueryData,
|
||||
getQueryClient,
|
||||
getQueryData,
|
||||
} from "./react-query-utils"
|
||||
export {
|
||||
useQueryErrorResetBoundary,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {QueryClient} from "@tanstack/react-query"
|
||||
import {QueryClient, QueryFilters} from "@tanstack/react-query"
|
||||
import {serialize} from "superjson"
|
||||
import {isClient, isServer, AsyncFunc} from "blitz"
|
||||
import {ResolverType, RpcClient} from "./rpc"
|
||||
@@ -199,3 +199,15 @@ export function setQueryData<TInput, TResult, T extends AsyncFunc>(
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getQueryData<TInput, TResult, T extends AsyncFunc>(
|
||||
resolver: T | Resolver<TInput, TResult> | RpcClient<TInput, TResult>,
|
||||
params: TInput,
|
||||
): TResult | undefined {
|
||||
if (typeof resolver === "undefined") {
|
||||
throw new Error("getQueryData is missing the first argument - it must be a resolver function")
|
||||
}
|
||||
const queryKey = getQueryKey(resolver, params)
|
||||
|
||||
return getQueryClient().getQueryData(queryKey)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
# blitz
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
- Updated dependencies [2cc888ef]
|
||||
- @blitzjs/generator@2.0.0-beta.72
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [176c7b8b]
|
||||
- @blitzjs/generator@2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4656e6ec]
|
||||
- Updated dependencies [1e0ec7a9]
|
||||
- @blitzjs/generator@2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fd31e56b: Add back blitz generate command
|
||||
- Updated dependencies [fd31e56b]
|
||||
- Updated dependencies [6baab190]
|
||||
- Updated dependencies [37623a4f]
|
||||
- @blitzjs/generator@2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
@@ -23,7 +23,7 @@
|
||||
"blitz": "bin/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/generator": "2.0.0-alpha.68",
|
||||
"@blitzjs/generator": "2.0.0-beta.0",
|
||||
"arg": "5.0.1",
|
||||
"boxen": "7.0.0",
|
||||
"chalk": "^4.1.0",
|
||||
@@ -55,7 +55,7 @@
|
||||
"watchpack": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-alpha.68",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.0",
|
||||
"@types/cookie": "0.4.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/debug": "4.1.7",
|
||||
|
||||
@@ -8,6 +8,13 @@ import {
|
||||
singleCamel,
|
||||
singlePascal,
|
||||
uncapitalize,
|
||||
PageGenerator,
|
||||
FormGenerator,
|
||||
QueriesGenerator,
|
||||
MutationGenerator,
|
||||
MutationsGenerator,
|
||||
ModelGenerator,
|
||||
QueryGenerator,
|
||||
} from "@blitzjs/generator"
|
||||
|
||||
const getIsTypeScript = async () =>
|
||||
@@ -39,21 +46,21 @@ function ModelNames(input: string = "") {
|
||||
}
|
||||
|
||||
const generatorMap = {
|
||||
// [ResourceType.All]: [
|
||||
// PageGenerator,
|
||||
// FormGenerator,
|
||||
// QueriesGenerator,
|
||||
// MutationsGenerator,
|
||||
// ModelGenerator,
|
||||
// ],
|
||||
// [ResourceType.Crud]: [MutationsGenerator, QueriesGenerator],
|
||||
// [ResourceType.Model]: [ModelGenerator],
|
||||
// [ResourceType.Pages]: [PageGenerator, FormGenerator],
|
||||
// [ResourceType.Queries]: [QueriesGenerator],
|
||||
// [ResourceType.Query]: [QueryGenerator],
|
||||
// [ResourceType.Mutations]: [MutationsGenerator],
|
||||
// [ResourceType.Mutation]: [MutationGenerator],
|
||||
// [ResourceType.Resource]: [QueriesGenerator, MutationsGenerator, ModelGenerator],
|
||||
[ResourceType.All]: [
|
||||
PageGenerator,
|
||||
FormGenerator,
|
||||
QueriesGenerator,
|
||||
MutationsGenerator,
|
||||
ModelGenerator,
|
||||
],
|
||||
[ResourceType.Crud]: [MutationsGenerator, QueriesGenerator],
|
||||
[ResourceType.Model]: [ModelGenerator],
|
||||
[ResourceType.Pages]: [PageGenerator, FormGenerator],
|
||||
[ResourceType.Queries]: [QueriesGenerator],
|
||||
[ResourceType.Query]: [QueryGenerator],
|
||||
[ResourceType.Mutations]: [MutationsGenerator],
|
||||
[ResourceType.Mutation]: [MutationGenerator],
|
||||
[ResourceType.Resource]: [QueriesGenerator, MutationsGenerator, ModelGenerator],
|
||||
}
|
||||
|
||||
const args = arg(
|
||||
@@ -61,7 +68,6 @@ const args = arg(
|
||||
// Types
|
||||
"--help": Boolean,
|
||||
"--type": String,
|
||||
"--name": String,
|
||||
"--context": String,
|
||||
"--parent": String,
|
||||
"--dry-run": Boolean,
|
||||
@@ -69,10 +75,10 @@ const args = arg(
|
||||
|
||||
// Aliases
|
||||
"-e": "--env",
|
||||
"-n": "--name",
|
||||
"-t": "--type",
|
||||
"-c": "--context",
|
||||
"-p": "--dry-run",
|
||||
"-p": "--parent",
|
||||
"-d": "--dry-run",
|
||||
},
|
||||
{
|
||||
permissive: true,
|
||||
@@ -164,23 +170,8 @@ const determineName = async () => {
|
||||
}
|
||||
|
||||
const determineContext = async () => {
|
||||
if (args["--context"] && !selectedModelName) {
|
||||
if (args["--name"] && args["--name"].includes("/")) {
|
||||
throw new Error("Your model should not contain a context when supplying a context explicitly")
|
||||
}
|
||||
|
||||
const res = await prompts({
|
||||
type: "text",
|
||||
name: "model",
|
||||
message: `The name of your model, like "user". Can be singular or plural - same result`,
|
||||
})
|
||||
|
||||
if (res.model.includes("/")) {
|
||||
throw new Error("Your model should not contain a context when supplying a context explicitly")
|
||||
}
|
||||
const {model, context} = getModelNameAndContext(res.model, args["--context"])
|
||||
selectedModelName = model
|
||||
selectedContext = context
|
||||
if (args["--context"] && selectedModelName && !selectedContext) {
|
||||
selectedContext = args["--context"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,32 +180,32 @@ const getHelp = async () => {
|
||||
console.log(`
|
||||
# The 'crud' type will generate all queries & mutations for a model
|
||||
|
||||
> blitz generate --type crud --name productVariant
|
||||
> blitz generate crud productVariant
|
||||
|
||||
# The 'all' generator will scaffold out everything possible for a model
|
||||
|
||||
> blitz generate --type all --name products
|
||||
> blitz generate all products
|
||||
|
||||
# The '--context' flag will allow you to generate files in a nested folder
|
||||
# The '--context' flag will allow you to generate files such as components, queries & mutations in a nested folder
|
||||
|
||||
> blitz generate --type pages --name projects --context admin
|
||||
> blitz generate pages projects --context=admin
|
||||
|
||||
# Context can also be supplied in the model name directly
|
||||
|
||||
> blitz generate --type pages --name admin/projects
|
||||
> blitz generate pages admin/projects
|
||||
|
||||
# To generate nested routes for dependent models (e.g. Projects that contain Tasks), specify a parent model.
|
||||
For example, this command generates pages under app/tasks/pages/projects/[projectId]/tasks/
|
||||
For example, this command generates pages under pages/projects/[projectId]/tasks/
|
||||
|
||||
> blitz generate --type all --name tasks --parent=projects
|
||||
> blitz generate all tasks --parent=projects
|
||||
|
||||
# Database models can also be generated directly from the CLI.
|
||||
Model fields can be specified with any generator that generates a database model ("all", "model", "resource").
|
||||
Both of the commands below will generate the proper database model for a Task.
|
||||
|
||||
> blitz generate --type model --name task name:string completed:boolean:default=false belongsTo:project?
|
||||
> blitz generate model task name:string completed:boolean:default=false belongsTo:project?
|
||||
|
||||
> blitz generate --type all --name tasks name:string completed:boolean:default=false belongsTo:project?
|
||||
> blitz generate all tasks name:string completed:boolean:default=false belongsTo:project?
|
||||
|
||||
`)
|
||||
|
||||
@@ -222,26 +213,23 @@ const getHelp = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const generate: CliCommand = async (argv) => {
|
||||
const generate: CliCommand = async () => {
|
||||
await getHelp()
|
||||
await determineType()
|
||||
await determineContext()
|
||||
if (!selectedModelName) {
|
||||
await determineName()
|
||||
}
|
||||
await determineContext()
|
||||
|
||||
try {
|
||||
const singularRootContext = modelName(selectedModelName)
|
||||
validateModelName(singularRootContext)
|
||||
|
||||
// const {loadConfigProduction} = await import("next/dist/server/config-shared")
|
||||
// const blitzConfig = loadConfigProduction(process.cwd())
|
||||
const generators = generatorMap[selectedType as keyof typeof generatorMap]
|
||||
|
||||
for (const GeneratorClass of generators) {
|
||||
const generator = new GeneratorClass({
|
||||
destinationRoot: require("path").resolve(),
|
||||
// templateDir: blitzConfig.codegen?.templateDir,
|
||||
extraArgs: args["_"].slice(3) as string[],
|
||||
modelName: singularRootContext,
|
||||
modelNames: modelNames(singularRootContext),
|
||||
|
||||
@@ -31,7 +31,7 @@ const commands = {
|
||||
build: () => import("./commands/next/build").then((i) => i.build),
|
||||
start: () => import("./commands/next/start").then((i) => i.start),
|
||||
new: () => import("./commands/new").then((i) => i.newApp),
|
||||
// generate: () => import("./commands/generate").then((i) => i.generate),
|
||||
generate: () => import("./commands/generate").then((i) => i.generate),
|
||||
codegen: () => import("./commands/codegen").then((i) => i.codegen),
|
||||
db: () => import("./commands/db").then((i) => i.db),
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ export interface RouteUrlObject extends Pick<UrlObject, "pathname" | "query"> {
|
||||
pathname: string
|
||||
}
|
||||
|
||||
export const isRouteUrlObject = (x: any): x is RouteUrlObject => {
|
||||
return typeof x === "object" && "pathname" in x && typeof x.pathname === "string"
|
||||
}
|
||||
|
||||
export type AsyncFunc = (...args: any) => Promise<any>
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,45 @@
|
||||
# @blitzjs/codemod
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
- Updated dependencies [2cc888ef]
|
||||
- blitz@2.0.0-beta.72
|
||||
- @blitzjs/generator@2.0.0-beta.72
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [176c7b8b]
|
||||
- @blitzjs/generator@2.0.0-alpha.71
|
||||
- blitz@2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f88702c1: 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`)
|
||||
- Updated dependencies [4656e6ec]
|
||||
- Updated dependencies [1e0ec7a9]
|
||||
- @blitzjs/generator@2.0.0-alpha.70
|
||||
- blitz@2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 86af6dec: Wrap middlewares with BlitzServerMiddleware function with codemod
|
||||
- 72a332e0: Wrap `blitz.config.ts` with the `withBlitz` function during the codemod step instead of creating a blank `next.config.js` file.
|
||||
- 2d1482fc: Allow codemod to finish if `cookiePrefix` is undefined. Then show error at the end of running the codemod.
|
||||
- Updated dependencies [fd31e56b]
|
||||
- Updated dependencies [6baab190]
|
||||
- Updated dependencies [37623a4f]
|
||||
- blitz@2.0.0-alpha.69
|
||||
- @blitzjs/generator@2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/codemod",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
@@ -25,9 +25,9 @@
|
||||
"@babel/plugin-proposal-class-properties": "7.17.12",
|
||||
"@babel/plugin-syntax-jsx": "7.17.12",
|
||||
"@babel/plugin-syntax-typescript": "7.17.12",
|
||||
"@blitzjs/generator": "2.0.0-alpha.68",
|
||||
"@blitzjs/generator": "2.0.0-beta.0",
|
||||
"arg": "5.0.1",
|
||||
"blitz": "2.0.0-alpha.68",
|
||||
"blitz": "2.0.0-beta.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"debug": "4.3.3",
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import j, {ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier} from "jscodeshift"
|
||||
import j, {
|
||||
Expression,
|
||||
ImportDeclaration,
|
||||
ImportDefaultSpecifier,
|
||||
ImportSpecifier,
|
||||
} from "jscodeshift"
|
||||
import * as fs from "fs-extra"
|
||||
import path from "path"
|
||||
import {
|
||||
@@ -30,7 +35,7 @@ class ExpectedError extends Error {
|
||||
const isInternalBlitzMonorepoDevelopment = fs.existsSync(
|
||||
path.join(__dirname, "../../../blitz-next"),
|
||||
)
|
||||
|
||||
type Step = {name: string; action: (stepIndex: number) => Promise<void>}
|
||||
const upgradeLegacy = async () => {
|
||||
let isTypescript = fs.existsSync(path.resolve("tsconfig.json"))
|
||||
let blitzConfigFile = `blitz.config.${isTypescript ? "ts" : "js"}`
|
||||
@@ -38,11 +43,8 @@ const upgradeLegacy = async () => {
|
||||
const appDir = path.resolve("app")
|
||||
let failedAt =
|
||||
fs.existsSync(path.resolve(".migration.json")) && fs.readJSONSync("./.migration.json").failedAt
|
||||
|
||||
let steps: {
|
||||
name: string
|
||||
action: () => Promise<void>
|
||||
}[] = []
|
||||
let collectedErrors: {message: string; step: number}[] = []
|
||||
let steps: Step[] = []
|
||||
|
||||
// Add steps in order
|
||||
|
||||
@@ -52,36 +54,54 @@ const upgradeLegacy = async () => {
|
||||
const program = getCollectionFromSource(blitzConfigFile)
|
||||
const parsedProgram = program.get()
|
||||
|
||||
// Clear file
|
||||
parsedProgram.value.program.body = []
|
||||
// Remove BlitzConfig type annotation
|
||||
let findBlitzConfigType = program.find(j.Identifier, (node) => node.name === "BlitzConfig")
|
||||
if (findBlitzConfigType) {
|
||||
findBlitzConfigType.forEach((c) => {
|
||||
if (c.name === "typeName") {
|
||||
j(c.parentPath.parentPath).remove()
|
||||
}
|
||||
|
||||
if (c.name === "imported") {
|
||||
j(c.parentPath).remove()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Remove all typescript stuff
|
||||
let findTypes = program.find(j.TSType, (node) => node)
|
||||
if (findTypes) {
|
||||
findTypes.forEach((t) => j(t.parentPath).remove())
|
||||
}
|
||||
|
||||
// We create an object property eg. {withBlitz: withBlitz}
|
||||
let withBlitz = j.objectProperty(j.identifier("withBlitz"), j.identifier("withBlitz"))
|
||||
// Then set the shorthand to true so we get {withBlitz}
|
||||
withBlitz.shorthand = true
|
||||
let config = program.find(j.AssignmentExpression, {
|
||||
left: {
|
||||
type: "MemberExpression",
|
||||
object: {
|
||||
type: "Identifier",
|
||||
name: "module",
|
||||
},
|
||||
property: {
|
||||
type: "Identifier",
|
||||
name: "exports",
|
||||
},
|
||||
},
|
||||
})
|
||||
let createdConfig = config.get().value.right
|
||||
|
||||
/* Declare the variable using the object above that equals to a require expression, eg.
|
||||
const {withBlitz} = require("@blitzjs/next")
|
||||
*/
|
||||
let blitzDeclare = j.variableDeclaration("const", [
|
||||
j.variableDeclarator(
|
||||
j.objectPattern([withBlitz]),
|
||||
j.callExpression(j.identifier("require"), [j.stringLiteral("@blitzjs/next")]),
|
||||
),
|
||||
])
|
||||
parsedProgram.value.program.body.push(blitzDeclare)
|
||||
addNamedImport(program, "withBlitz", "@blitzjs/next")
|
||||
config.remove()
|
||||
|
||||
// Create the module.exports with the withBlitz callExpression and empty arguments. Giving us module.exports = withBlitz()
|
||||
let moduleExportExpression = j.expressionStatement(
|
||||
let moduleExportStatement = j.expressionStatement(
|
||||
j.assignmentExpression(
|
||||
"=",
|
||||
j.memberExpression(j.identifier("module"), j.identifier("exports")),
|
||||
j.callExpression(j.identifier("withBlitz"), [
|
||||
j.objectExpression([j.objectProperty(j.identifier("blitz"), j.objectExpression([]))]),
|
||||
]),
|
||||
j.callExpression(j.identifier("withBlitz"), [createdConfig]),
|
||||
),
|
||||
)
|
||||
parsedProgram.value.program.body.push(moduleExportExpression)
|
||||
parsedProgram.value.program.body.push(moduleExportStatement)
|
||||
|
||||
fs.writeFileSync(path.resolve("next.config.js"), program.toSource())
|
||||
},
|
||||
@@ -411,7 +431,7 @@ const upgradeLegacy = async () => {
|
||||
|
||||
steps.push({
|
||||
name: "Add cookiePrefix to blitz server",
|
||||
action: async () => {
|
||||
action: async (stepIndex) => {
|
||||
const blitzConfigProgram = getCollectionFromSource(blitzConfigFile)
|
||||
const cookieIdentifier = blitzConfigProgram.find(
|
||||
j.Identifier,
|
||||
@@ -434,9 +454,12 @@ const upgradeLegacy = async () => {
|
||||
blitzClientProgram.toSource(),
|
||||
)
|
||||
} else {
|
||||
throw new ExpectedError(
|
||||
"Cookie Prefix is undefined & not a string. Please set your cookie prefix manually in app/blitz-client",
|
||||
)
|
||||
// Show error at end of codemod
|
||||
collectedErrors.push({
|
||||
message:
|
||||
"Detected cookiePrefix is undefined. Please set your cookie prefix manually in app/blitz-client",
|
||||
step: stepIndex,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
log.error("Cookie Prefix not found in blitz config file")
|
||||
@@ -465,7 +488,7 @@ const upgradeLegacy = async () => {
|
||||
|
||||
pluginArray.get().parentPath.value.value.elements = [
|
||||
...pluginArray.get().parentPath.value.value.elements,
|
||||
...middlewares,
|
||||
...middlewares.map((m: Node) => j.template.expression`BlitzServerMiddleware(${m})`),
|
||||
]
|
||||
|
||||
let importStatements = []
|
||||
@@ -492,11 +515,21 @@ const upgradeLegacy = async () => {
|
||||
}
|
||||
|
||||
importStatements.forEach((s) => blitzServerProgram.get().value.program.body.unshift(s))
|
||||
addNamedImport(blitzServerProgram, "BlitzServerMiddleware", "blitz")
|
||||
|
||||
fs.writeFileSync(
|
||||
`${appDir}/blitz-server.${isTypescript ? "ts" : "js"}`,
|
||||
blitzServerProgram.toSource(),
|
||||
)
|
||||
|
||||
// Remove middleware array from next.config.js
|
||||
const nextConfigProgram = getCollectionFromSource(path.resolve("next.config.js"))
|
||||
const nextConfigMiddlewareArray = nextConfigProgram.find(
|
||||
j.Identifier,
|
||||
(node) => node.name === "middleware",
|
||||
)
|
||||
j(nextConfigMiddlewareArray.get().parentPath).remove()
|
||||
fs.writeFileSync(`next.config.js`, nextConfigProgram.toSource())
|
||||
} else {
|
||||
log.error("Middleware array not found in blit config file")
|
||||
}
|
||||
@@ -592,7 +625,7 @@ const upgradeLegacy = async () => {
|
||||
}
|
||||
} else {
|
||||
arr.push({
|
||||
model: file,
|
||||
model: "",
|
||||
path: dirPath + "/" + file + "/pages",
|
||||
})
|
||||
break
|
||||
@@ -626,6 +659,7 @@ const upgradeLegacy = async () => {
|
||||
// If the directory exists without a sub model (sub page directory), loop through the directory manually move each file/directory
|
||||
if (fs.existsSync(path.join(path.resolve("pages"), pages.model))) {
|
||||
let subs = fs.readdirSync(pages.path)
|
||||
|
||||
subs.forEach((sub) => {
|
||||
fs.moveSync(
|
||||
path.join(pages.path, sub),
|
||||
@@ -1110,7 +1144,7 @@ const upgradeLegacy = async () => {
|
||||
|
||||
steps.push({
|
||||
name: "check for usages of invokeWithMiddleware",
|
||||
action: async () => {
|
||||
action: async (stepIndex) => {
|
||||
let errors = 0
|
||||
|
||||
getAllFiles(appDir, [], [], [".ts", ".tsx", ".js", ".jsx"]).forEach((file) => {
|
||||
@@ -1132,58 +1166,21 @@ const upgradeLegacy = async () => {
|
||||
})
|
||||
|
||||
if (errors > 0) {
|
||||
throw new ExpectedError(
|
||||
"\n invokeWithMiddleware is not supported. \n Use invokeWithCtx instead: https://canary.blitzjs.com/docs/resolver-server-utilities#invoke-with-ctx \n Fix the files above, then run the codemod again.",
|
||||
)
|
||||
collectedErrors.push({
|
||||
message:
|
||||
"\n invokeWithMiddleware is not supported. \n Use invokeWithCtx instead: https://canary.blitzjs.com/docs/resolver-server-utilities#invoke-with-ctx \n Fix the files above, then run the codemod again.",
|
||||
step: stepIndex,
|
||||
})
|
||||
|
||||
// Write to the migration file so the user can run the migration again from this point
|
||||
failedAt = stepIndex + 1
|
||||
fs.writeJsonSync(".migration.json", {
|
||||
failedAt,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// steps.push({
|
||||
// name: "Update invokeMiddleware to invoke",
|
||||
// action: async () => {
|
||||
// getAllFiles(appDir, [], [], [".css"]).forEach((file) => {
|
||||
// const program = getCollectionFromSource(file)
|
||||
// const importSpecifier = findImportSpecifier(program, "invokeWithMiddleware")
|
||||
// importSpecifier?.paths().forEach((path) => {
|
||||
// path.get().value.imported.name = "invoke"
|
||||
// })
|
||||
|
||||
// const invokeWithMiddlewarePath = findCallExpression(program, "invokeWithMiddleware")
|
||||
// if (invokeWithMiddlewarePath?.length) {
|
||||
// invokeWithMiddlewarePath?.paths().forEach((path) => {
|
||||
// path.get().value.callee.name = "invoke"
|
||||
// if (path.get().value.arguments.length === 3) {
|
||||
// delete path.get().value.arguments[2]
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// fs.writeFileSync(path.resolve(file), program.toSource())
|
||||
// })
|
||||
|
||||
// getAllFiles(path.resolve("pages"), [], [], [".css"]).forEach((file) => {
|
||||
// const program = getCollectionFromSource(file)
|
||||
// const importSpecifier = findImportSpecifier(program, "invokeWithMiddleware")
|
||||
// importSpecifier?.paths().forEach((path) => {
|
||||
// path.get().value.imported.name = "invoke"
|
||||
// })
|
||||
|
||||
// const invokeWithMiddlewarePath = findCallExpression(program, "invokeWithMiddleware")
|
||||
// if (invokeWithMiddlewarePath?.length) {
|
||||
// invokeWithMiddlewarePath?.paths().forEach((path) => {
|
||||
// path.get().value.callee.name = "invoke"
|
||||
// if (path.get().value.arguments.length === 3) {
|
||||
// delete path.get().value.arguments[2]
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// fs.writeFileSync(path.resolve(file), program.toSource())
|
||||
// })
|
||||
// },
|
||||
// })
|
||||
|
||||
// Loop through steps and run the action
|
||||
if ((failedAt && failedAt < steps.length) || failedAt !== "SUCCESS" || isLegacyBlitz) {
|
||||
for (let [index, step] of steps.entries()) {
|
||||
@@ -1193,8 +1190,15 @@ const upgradeLegacy = async () => {
|
||||
}
|
||||
const spinner = log.spinner(log.withBrand(`Running ${step.name}...`)).start()
|
||||
try {
|
||||
await step.action()
|
||||
await step.action(index)
|
||||
if (collectedErrors.filter((e) => e.step === index).length) {
|
||||
// Soft stored error
|
||||
spinner.fail(`${step.name}`)
|
||||
} else {
|
||||
spinner.succeed(`Successfully ran ${step.name}`)
|
||||
}
|
||||
} catch (err) {
|
||||
// Hard exit error
|
||||
const error = err as {code: string} | string
|
||||
spinner.fail(`${step.name}`)
|
||||
log.error(error as string)
|
||||
@@ -1218,10 +1222,12 @@ const upgradeLegacy = async () => {
|
||||
})
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
spinner.succeed(`Successfully ran ${step.name}`)
|
||||
}
|
||||
|
||||
if (collectedErrors.length) {
|
||||
for (const error of collectedErrors) {
|
||||
log.error(`⚠️ ${error.message}`)
|
||||
}
|
||||
}
|
||||
fs.writeJsonSync(".migration.json", {
|
||||
failedAt: "SUCCESS",
|
||||
})
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @blitzjs/config
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
## 2.0.0-alpha.67
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"private": true,
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.9.1",
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# @blitzjs/generator
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc888ef: Beta release
|
||||
|
||||
## 2.0.0-alpha.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 176c7b8b: Use correct path for log utilities import
|
||||
|
||||
## 2.0.0-alpha.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4656e6ec: Print model added or updated in schema.prisma after running model generator
|
||||
- 1e0ec7a9: Add `BlitzPage` type to Home pages in app templates
|
||||
|
||||
## 2.0.0-alpha.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fd31e56b: Add back blitz generate command
|
||||
- 6baab190: Add type checking to next.config.js files in new app templates
|
||||
- 37623a4f: Fix typo in a next.config.js file name
|
||||
|
||||
## 2.0.0-alpha.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/generator",
|
||||
"version": "2.0.0-alpha.68",
|
||||
"version": "2.0.0-beta.0",
|
||||
"scripts": {
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
"build": "unbuild && pnpm build:templates",
|
||||
@@ -46,7 +46,7 @@
|
||||
"vinyl": "2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-alpha.68",
|
||||
"@blitzjs/config": "2.0.0-beta.0",
|
||||
"@juanm04/cpx": "2.0.1",
|
||||
"@types/babel__core": "7.1.19",
|
||||
"@types/diff": "5.0.2",
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as ast from "@mrleebo/prisma-ast"
|
||||
import {spawn} from "cross-spawn"
|
||||
import which from "npm-which"
|
||||
import path from "path"
|
||||
import {log} from "../utils/log"
|
||||
import {Generator, GeneratorOptions, SourceRootType} from "../generator"
|
||||
import {Field} from "../prisma/field"
|
||||
import {Model} from "../prisma/model"
|
||||
@@ -88,8 +89,10 @@ export class ModelGenerator extends Generator<ModelGeneratorOptions> {
|
||||
dryRun ? "" : ` ${updatedOrCreated} in schema.prisma`
|
||||
}:\n`,
|
||||
)
|
||||
ast.printSchema({type: "schema", list: [model]}).split("\n")
|
||||
// .map(log.progress) // todo
|
||||
ast
|
||||
.printSchema({type: "schema", list: [model]})
|
||||
.split("\n")
|
||||
.map(log.progress)
|
||||
console.log("\n")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import {Generator, GeneratorOptions, SourceRootType} from "../generator"
|
||||
import {getTemplateRoot} from "../utils/get-template-root"
|
||||
import {camelCaseToKebabCase} from "../utils/inflector"
|
||||
import {spawn} from "cross-spawn"
|
||||
import which from "npm-which"
|
||||
|
||||
export interface PageGeneratorOptions extends GeneratorOptions {
|
||||
ModelName: string
|
||||
@@ -67,9 +69,10 @@ export class PageGenerator extends Generator<PageGeneratorOptions> {
|
||||
}
|
||||
|
||||
async postWrite() {
|
||||
// const {loadConfigProduction} = await import("next/dist/server/config-shared")
|
||||
// const {saveRouteManifest} = await import("next/dist/build/routes")
|
||||
// const config = loadConfigProduction(process.cwd())
|
||||
// await saveRouteManifest(process.cwd(), config)
|
||||
await new Promise<void>((res, rej) => {
|
||||
const blitzBin = which(process.cwd()).sync("blitz")
|
||||
const child = spawn(blitzBin, ["codegen"], {stdio: "inherit"})
|
||||
child.on("exit", (code) => (code === 0 ? res() : rej()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export const getBlitzDependencyVersion = async () => {
|
||||
const result = await fetchDistTags("blitz")
|
||||
|
||||
if (CURRENT_BLITZ_TAG in result) {
|
||||
return {value: result}
|
||||
return {value: result[CURRENT_BLITZ_TAG]}
|
||||
}
|
||||
|
||||
logFailedVersionFetch("blitz")
|
||||
|
||||
@@ -67,7 +67,7 @@ export function assignDefaultsBase(userConfig: {[key: string]: any}) {
|
||||
export function loadConfigProduction(pagesDir: string) {
|
||||
let userConfigModule
|
||||
try {
|
||||
const path = join(pagesDir, "next.confi.js")
|
||||
const path = join(pagesDir, "next.config.js")
|
||||
debug("Loading config from ", path)
|
||||
// eslint-disable-next-line no-eval -- block webpack from following this module path
|
||||
userConfigModule = eval("require")(path)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
// @ts-check
|
||||
const {withBlitz} = require("@blitzjs/next")
|
||||
|
||||
module.exports = withBlitz()
|
||||
/**
|
||||
* @type {import('@blitzjs/next').BlitzConfig}
|
||||
**/
|
||||
const config = {}
|
||||
|
||||
module.exports = withBlitz(config)
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
enabled: process.env.ANALYZE === "true",
|
||||
})
|
||||
// @ts-check
|
||||
const {withBlitz} = require("@blitzjs/next")
|
||||
|
||||
module.exports = withBlitz(
|
||||
withBundleAnalyzer({
|
||||
reactStrictMode: true,
|
||||
}),
|
||||
)
|
||||
/**
|
||||
* @type {import('@blitzjs/next').BlitzConfig}
|
||||
**/
|
||||
const config = {}
|
||||
|
||||
module.exports = withBlitz(config)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Image from 'next/image'
|
||||
import { NextPage } from "next"
|
||||
import { BlitzPage } from "@blitzjs/next"
|
||||
import logo from "public/logo.png"
|
||||
|
||||
/*
|
||||
@@ -7,7 +7,7 @@ import logo from "public/logo.png"
|
||||
* You can delete everything in here and start from scratch if you like.
|
||||
*/
|
||||
|
||||
const Home: NextPage = () => {
|
||||
const Home: BlitzPage = () => {
|
||||
return (
|
||||
<div className="container">
|
||||
<main>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import { Ctx } from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
const __Name__Input = z.object({
|
||||
const __Name__ = z.object({
|
||||
id: z.number(),
|
||||
})
|
||||
|
||||
export default resolver.pipe(
|
||||
resolver.zod(__Name__),
|
||||
resolver.authorize(),
|
||||
async (input) => {
|
||||
|
||||
export default async function __Name__(input, ctx: Ctx) {
|
||||
__Name__Input.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
// Do your stuff :)
|
||||
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -1,27 +1,25 @@
|
||||
import {Ctx} from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
if (process.env.parentModel) {
|
||||
const Create__ModelName__Input = z.object({
|
||||
const Create__ModelName__ = z.object({
|
||||
name: z.string(),
|
||||
__parentModelId__: z.number()
|
||||
})
|
||||
} else {
|
||||
const Create__ModelName__Input = z.object({
|
||||
const Create__ModelName__ = z.object({
|
||||
name: z.string(),
|
||||
})
|
||||
}
|
||||
|
||||
export default async function Create__ModelName__(input, ctx: Ctx) {
|
||||
Create__ModelName__Input.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.create({data: input})
|
||||
|
||||
return __modelName__
|
||||
|
||||
}
|
||||
|
||||
export default resolver.pipe(
|
||||
resolver.zod(Create__ModelName__),
|
||||
resolver.authorize(),
|
||||
async (input) => {
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.create({data: input})
|
||||
|
||||
return __modelName__
|
||||
},
|
||||
)
|
||||
@@ -1,18 +1,18 @@
|
||||
import {Ctx} from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
const Delete__ModelName__Input = z.object({
|
||||
const Delete__ModelName__ = z.object({
|
||||
id: z.number(),
|
||||
})
|
||||
|
||||
export default async function Delete__ModelName__(input, ctx: Ctx) {
|
||||
Delete__ModelName__Input.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
export default resolver.pipe(
|
||||
resolver.zod(Delete__ModelName__),
|
||||
resolver.authorize(),
|
||||
async ({id}) => {
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.deleteMany({where: {id}})
|
||||
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.deleteMany({where: {id: input.id}})
|
||||
|
||||
return __modelName__
|
||||
|
||||
}
|
||||
return __modelName__
|
||||
},
|
||||
)
|
||||
@@ -1,18 +1,19 @@
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
const Update__ModelName__Input = z.object({
|
||||
const Update__ModelName__ = z.object({
|
||||
id: z.number(),
|
||||
name: z.string(),
|
||||
})
|
||||
|
||||
export default async function Update__ModelName__(input, ctx: Ctx) {
|
||||
Update__ModelName__Input.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
export default resolver.pipe(
|
||||
resolver.zod(Update__ModelName__),
|
||||
resolver.authorize(),
|
||||
async ({id, ... data}) => {
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.update({where: {id}, data})
|
||||
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.update({where: {id: input.id}, input})
|
||||
|
||||
return __modelName__
|
||||
|
||||
}
|
||||
return __modelName__
|
||||
},
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Suspense} from "react"
|
||||
|
||||
import {Routes} from '@blitzjs/next'
|
||||
import Head from "next/head"
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from "next/router"
|
||||
@@ -30,11 +30,11 @@ export const __ModelName__ = () => {
|
||||
<pre>{JSON.stringify(__modelName__, null, 2)}</pre>
|
||||
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s/[__modelId__]/edit', query: {__parentModelId__: __parentModelId__!, __modelId__: __modelName__.id}}}>
|
||||
<Link href={Routes.Edit__ModelName__Page({ __parentModelId__: __parentModelId__!, __modelId__: __modelName__.id })}>
|
||||
<a>Edit</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s/[__modelId__]/edit', query: {__modelId__: __modelName__.id}}}>
|
||||
<Link href={Routes.Edit__ModelName__Page({ __modelId__: __modelName__.id })}>
|
||||
<a>Edit</a>
|
||||
</Link>
|
||||
</else>
|
||||
@@ -46,9 +46,9 @@ export const __ModelName__ = () => {
|
||||
if (window.confirm("This will be deleted")) {
|
||||
await delete__ModelName__Mutation({id: __modelName__.id})
|
||||
if (process.env.parentModel) {
|
||||
router.push({pathname: '/__parentModel__/[__parentModelId__]/__modelName__s', query: {__parentModelId__: __parentModelId__!}})
|
||||
router.push(Routes.__ModelNames__Page({ __parentModelId__: __parentModelId__! }))
|
||||
} else {
|
||||
router.push({pathname: '/__modelName__s'})
|
||||
router.push(Routes.__ModelNames__Page())
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -70,11 +70,11 @@ const Show__ModelName__Page = () => {
|
||||
<div>
|
||||
<p>
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s', query: {__parentModelId__: __parentModelId__!}}}>
|
||||
<Link href={Routes.__ModelNames__Page({ __parentModelId__: __parentModelId__! })}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s'}}>
|
||||
<Link href={Routes.__ModelNames__Page()}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
</else>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Suspense} from "react"
|
||||
import {Routes} from '@blitzjs/next'
|
||||
import Head from "next/head"
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from "next/router"
|
||||
@@ -52,8 +53,8 @@ export const Edit__ModelName__ = () => {
|
||||
await setQueryData(updated)
|
||||
router.push(
|
||||
process.env.parentModel
|
||||
? {pathname: `/__parentModel__/[__parentModelId__]/__modelName__s/[__modelId__]`, query: {__parentModelId__: __parentModelId__!, __modelId__: updated.id}}
|
||||
: {pathname: `/__modelName__s/[__modelId__]`, query: {__modelId__: updated.id}},
|
||||
? Routes.Show__ModelName__Page({ __parentModelId__: __parentModelId__!, __modelId__: updated.id })
|
||||
: Routes.Show__ModelName__Page({ __modelId__: updated.id })
|
||||
)
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
@@ -81,11 +82,11 @@ const Edit__ModelName__Page = () => {
|
||||
|
||||
<p>
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s', query: {__parentModelId__: __parentModelId__!}}}>
|
||||
<Link href={Routes.__ModelNames__Page({ __parentModelId__: __parentModelId__! })}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s'}}>
|
||||
<Link href={Routes.__ModelNames__Page()}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
</else>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Suspense} from "react"
|
||||
import {Routes} from '@blitzjs/next'
|
||||
if (process.env.parentModel) {
|
||||
import Head from "next/head"
|
||||
import Link from 'next/link'
|
||||
@@ -37,7 +38,7 @@ export const __ModelNames__List = () => {
|
||||
<ul>
|
||||
{__modelNames__.map((__modelName__) => (
|
||||
<li key={__modelName__.id}>
|
||||
<Link href={{pathname: `/__modelName__s/[__modelId__]`, query: {__modelId__: __modelName__.id}}}>
|
||||
<Link href={Routes.Show__ModelName__Page({ __modelId__: __modelName__.id })}>
|
||||
<a>{__modelName__.name}</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -68,11 +69,11 @@ export const __ModelNames__List = () => {
|
||||
{__modelNames__.map((__modelName__) => (
|
||||
<li key={__modelName__.id}>
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s/[__modelId__]', query: {__parentModelId__: __parentModelId__!, __modelId__: __modelName__.id}}}>
|
||||
<Link href={Routes.Show__ModelName__Page({ __parentModelId__: __parentModelId__!, __modelId__: __modelName__.id })}>
|
||||
<a>{__modelName__.name}</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s/[__modelId__]', query: {__modelId__: __modelName__.id}}}>
|
||||
<Link href={Routes.Show__ModelName__Page({ __modelId__: __modelName__.id })}>
|
||||
<a>{__modelName__.name}</a>
|
||||
</Link>
|
||||
</else>
|
||||
@@ -106,11 +107,11 @@ const __ModelNames__Page = () => {
|
||||
<div>
|
||||
<p>
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s/new', query: {__parentModelId__: __parentModelId__!} }}>
|
||||
<Link href={Routes.New__ModelName__Page({ __parentModelId__: __parentModelId__! })}>
|
||||
<a>Create __ModelName__</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s/new'}}>
|
||||
<Link href={Routes.New__ModelName__Page()}>
|
||||
<a>Create __ModelName__</a>
|
||||
</Link>
|
||||
</else>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {Routes} from '@blitzjs/next'
|
||||
if (process.env.parentModel) {
|
||||
import Link from 'next/link'
|
||||
import {useParam} from '@blitzjs/next'
|
||||
@@ -39,8 +40,8 @@ const New__ModelName__Page = () => {
|
||||
)
|
||||
router.push(
|
||||
process.env.parentModel
|
||||
? {pathname: `/__parentModel__/[__parentModelId__]/__modelName__s/[__modelId__]`, query: {__parentModelId__: __parentModelId__!, __modelId__: __modelName__.id}}
|
||||
: {pathname: `/__modelName__s/[__modelId__]`, query: {__modelId__: __modelName__.id}},
|
||||
? Routes.Show__ModelName__Page({ __parentModelId__: __parentModelId__!, __modelId__: __modelName__.id })
|
||||
: Routes.Show__ModelName__Page({ __modelId__: __modelName__.id }),
|
||||
)
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
@@ -53,11 +54,11 @@ const New__ModelName__Page = () => {
|
||||
|
||||
<p>
|
||||
<if condition="parentModel">
|
||||
<Link href={{pathname: '/__parentModel__/[__parentModelId__]/__modelName__s', query: {__parentModelId__: __parentModelId__!}}}>
|
||||
<Link href={Routes.__ModelNames__Page({ __parentModelId__: __parentModelId__! })}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
<else>
|
||||
<Link href={{pathname: '/__modelName__s'}}>
|
||||
<Link href={Routes.__ModelNames__Page()}>
|
||||
<a>__ModelNames__</a>
|
||||
</Link>
|
||||
</else>
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import {Ctx, NotFoundError} from "blitz"
|
||||
import db from "db"
|
||||
import {NotFoundError} from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
const Get__ModelName__Input = z.object({
|
||||
const Get__ModelName__ = z.object({
|
||||
// This accepts type of undefined, but is required at runtime
|
||||
id: z.number().optional().refine(Boolean, 'Required'),
|
||||
})
|
||||
|
||||
export default async function Get__ModelName__(input, ctx: Ctx) {
|
||||
Get__ModelName__Input.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
export default resolver.pipe(
|
||||
resolver.zod(Get__ModelName__),
|
||||
resolver.authorize(),
|
||||
async ({ id }) => {
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.findFirst({where: {id}})
|
||||
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const __modelName__ = await db.__modelName__.findFirst({where: {id: input.id}})
|
||||
if (!__modelName__) throw new NotFoundError()
|
||||
|
||||
if (!__modelName__) throw new NotFoundError()
|
||||
|
||||
return __modelName__
|
||||
}
|
||||
return __modelName__
|
||||
}
|
||||
)
|
||||
@@ -1,28 +1,26 @@
|
||||
import {paginate, Ctx} from "blitz"
|
||||
import db from "db"
|
||||
import { Prisma } from "@prisma/client"
|
||||
import {paginate} from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db, {Prisma} from "db"
|
||||
|
||||
interface Get__ModelNames__Input
|
||||
extends Pick<Prisma.__ModelName__FindManyArgs, "where" | "orderBy" | "skip" | "take"> {}
|
||||
|
||||
export default async function Get__ModelNames(input: Get__ModelNames__Input, ctx: Ctx) {
|
||||
ctx.session.$isAuthorized()
|
||||
export default resolver.pipe(
|
||||
resolver.authorize(),
|
||||
async ({where, orderBy, skip = 0, take = 100}: Get__ModelNames__Input) => {
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const {items: __modelNames__, hasMore, nextPage, count} = await paginate({
|
||||
skip,
|
||||
take,
|
||||
count: () => db.__modelName__.count({where}),
|
||||
query: (paginateArgs) => db.__modelName__.findMany({...paginateArgs, where, orderBy}),
|
||||
})
|
||||
|
||||
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
||||
const {items: __modelNames__, hasMore, nextPage, count} = await paginate({
|
||||
skip: input.skip,
|
||||
take: input.take,
|
||||
count: () => db.__modelName__.count({where: input.where}),
|
||||
query: (paginateArgs) => db.__modelName__.findMany({...paginateArgs, where: input.where, orderBy: input.orderBy}),
|
||||
})
|
||||
|
||||
return {
|
||||
__modelNames__,
|
||||
nextPage,
|
||||
hasMore,
|
||||
count,
|
||||
return {
|
||||
__modelNames__,
|
||||
nextPage,
|
||||
hasMore,
|
||||
count,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
@@ -1,13 +1,17 @@
|
||||
import {Ctx} from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import db from "db"
|
||||
import {z} from "zod"
|
||||
|
||||
const __Name__ = z.object({
|
||||
id: z.number(),
|
||||
})
|
||||
|
||||
export default async function __Name__(input, ctx: Ctx) {
|
||||
__Name__.parse(input)
|
||||
ctx.session.$isAuthorized()
|
||||
export default resolver.pipe(
|
||||
resolver.zod(__Name__),
|
||||
resolver.authorize(),
|
||||
async (input) => {
|
||||
|
||||
// Do your stuff :)
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -25,7 +25,7 @@
|
||||
"@typescript-eslint/parser": "5.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-alpha.68",
|
||||
"@blitzjs/config": "2.0.0-beta.0",
|
||||
"@types/react": "18.0.1",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"react": "18.0.0",
|
||||
|
||||
104
pnpm-lock.yaml
generated
104
pnpm-lock.yaml
generated
@@ -49,7 +49,7 @@ importers:
|
||||
"@types/preview-email": 2.0.1
|
||||
"@types/react": 18.0.1
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
blitz: workspace:2.0.0-alpha.67
|
||||
blitz: workspace:2.0.0-alpha.71
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0
|
||||
eslint-config-prettier: 8.5.0
|
||||
@@ -324,11 +324,60 @@ importers:
|
||||
"@vitejs/plugin-react": 1.3.0
|
||||
delay: 5.0.0
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.4_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint-config-next: 12.2.5_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint-plugin-testing-library: 5.0.1_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
jsdom: 19.0.0
|
||||
typescript: 4.6.3
|
||||
|
||||
integration-tests/react-query-utils:
|
||||
specifiers:
|
||||
"@blitzjs/auth": workspace:*
|
||||
"@blitzjs/config": workspace:*
|
||||
"@blitzjs/next": workspace:*
|
||||
"@blitzjs/rpc": workspace:*
|
||||
"@next/bundle-analyzer": 12.0.8
|
||||
"@prisma/client": 4.0.0
|
||||
"@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
|
||||
blitz: workspace:*
|
||||
eslint: 7.32.0
|
||||
fs-extra: 10.0.1
|
||||
get-port: 6.1.2
|
||||
lowdb: 3.0.0
|
||||
next: 12.2.0
|
||||
node-fetch: 3.2.3
|
||||
prisma: 4.0.0
|
||||
react: 18.0.0
|
||||
react-dom: 18.0.0
|
||||
typescript: ^4.5.3
|
||||
dependencies:
|
||||
"@blitzjs/auth": link:../../packages/blitz-auth
|
||||
"@blitzjs/next": link:../../packages/blitz-next
|
||||
"@blitzjs/rpc": link:../../packages/blitz-rpc
|
||||
"@prisma/client": 4.0.0_prisma@4.0.0
|
||||
blitz: link:../../packages/blitz
|
||||
lowdb: 3.0.0
|
||||
next: 12.2.0_zpnidt7m3osuk7shl3s4oenomq
|
||||
prisma: 4.0.0
|
||||
react: 18.0.0
|
||||
react-dom: 18.0.0_react@18.0.0
|
||||
devDependencies:
|
||||
"@blitzjs/config": link:../../packages/config
|
||||
"@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.7.4
|
||||
|
||||
integration-tests/rpc:
|
||||
specifiers:
|
||||
"@blitzjs/auth": workspace:*
|
||||
@@ -475,8 +524,8 @@ importers:
|
||||
|
||||
packages/blitz:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.67
|
||||
"@blitzjs/generator": 2.0.0-alpha.67
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.71
|
||||
"@blitzjs/generator": 2.0.0-alpha.71
|
||||
"@types/cookie": 0.4.1
|
||||
"@types/cross-spawn": 6.0.2
|
||||
"@types/debug": 4.1.7
|
||||
@@ -586,7 +635,7 @@ importers:
|
||||
|
||||
packages/blitz-auth:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.67
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.71
|
||||
"@testing-library/react": 13.0.0
|
||||
"@testing-library/react-hooks": 7.0.2
|
||||
"@types/b64-lite": 1.3.0
|
||||
@@ -600,7 +649,7 @@ importers:
|
||||
"@types/secure-password": 3.1.1
|
||||
b64-lite: 1.4.0
|
||||
bad-behavior: 1.0.1
|
||||
blitz: 2.0.0-alpha.67
|
||||
blitz: 2.0.0-alpha.71
|
||||
cookie: 0.4.1
|
||||
cookie-session: 2.0.0
|
||||
debug: 4.3.3
|
||||
@@ -653,8 +702,8 @@ importers:
|
||||
|
||||
packages/blitz-next:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.67
|
||||
"@blitzjs/rpc": 2.0.0-alpha.67
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.71
|
||||
"@blitzjs/rpc": 2.0.0-alpha.71
|
||||
"@tanstack/react-query": 4.0.10
|
||||
"@testing-library/dom": 8.13.0
|
||||
"@testing-library/jest-dom": 5.16.3
|
||||
@@ -666,7 +715,7 @@ importers:
|
||||
"@types/react": 18.0.1
|
||||
"@types/react-dom": 17.0.14
|
||||
"@types/testing-library__react-hooks": 4.0.0
|
||||
blitz: 2.0.0-alpha.67
|
||||
blitz: 2.0.0-alpha.71
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
find-up: 4.1.0
|
||||
@@ -716,15 +765,15 @@ importers:
|
||||
|
||||
packages/blitz-rpc:
|
||||
specifiers:
|
||||
"@blitzjs/auth": 2.0.0-alpha.67
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.67
|
||||
"@blitzjs/auth": 2.0.0-alpha.71
|
||||
"@blitzjs/config": workspace:2.0.0-alpha.71
|
||||
"@tanstack/react-query": 4.0.10
|
||||
"@types/debug": 4.1.7
|
||||
"@types/react": 18.0.1
|
||||
"@types/react-dom": 17.0.14
|
||||
b64-lite: 1.4.0
|
||||
bad-behavior: 1.0.1
|
||||
blitz: 2.0.0-alpha.67
|
||||
blitz: 2.0.0-alpha.71
|
||||
chalk: ^4.1.0
|
||||
debug: 4.3.3
|
||||
next: 12.2.0
|
||||
@@ -767,12 +816,12 @@ importers:
|
||||
"@babel/plugin-syntax-typescript": 7.17.12
|
||||
"@babel/preset-env": 7.12.10
|
||||
"@blitzjs/config": workspace:*
|
||||
"@blitzjs/generator": 2.0.0-alpha.67
|
||||
"@blitzjs/generator": 2.0.0-alpha.71
|
||||
"@types/jscodeshift": 0.11.2
|
||||
"@types/node": 17.0.16
|
||||
arg: 5.0.1
|
||||
ast-types: 0.14.2
|
||||
blitz: 2.0.0-alpha.67
|
||||
blitz: 2.0.0-alpha.71
|
||||
chalk: ^4.1.0
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
@@ -827,7 +876,7 @@ importers:
|
||||
"@babel/plugin-transform-typescript": 7.12.1
|
||||
"@babel/preset-env": 7.12.10
|
||||
"@babel/types": 7.12.10
|
||||
"@blitzjs/config": 2.0.0-alpha.67
|
||||
"@blitzjs/config": 2.0.0-alpha.71
|
||||
"@juanm04/cpx": 2.0.1
|
||||
"@mrleebo/prisma-ast": 0.2.6
|
||||
"@types/babel__core": 7.1.19
|
||||
@@ -920,7 +969,7 @@ importers:
|
||||
|
||||
packages/pkg-template:
|
||||
specifiers:
|
||||
"@blitzjs/config": 2.0.0-alpha.67
|
||||
"@blitzjs/config": 2.0.0-alpha.71
|
||||
"@types/react": 18.0.1
|
||||
"@types/react-dom": 17.0.14
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
@@ -3060,6 +3109,7 @@ packages:
|
||||
semver: 5.7.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@babel/preset-flow/7.17.12_@babel+core@7.18.2:
|
||||
resolution:
|
||||
@@ -4032,10 +4082,10 @@ packages:
|
||||
dependencies:
|
||||
glob: 7.1.7
|
||||
|
||||
/@next/eslint-plugin-next/12.2.4:
|
||||
/@next/eslint-plugin-next/12.2.5:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ChDkUIkJeYWKRx+FdF+EhUgvKtK1wF+Xew4Os7ef3iAjMch5GGBiezw2zGXTa/C0E6potz4j11EpX89mngffug==,
|
||||
integrity: sha512-VBjVbmqEzGiOTBq4+wpeVXt/KgknnGB6ahvC/AxiIGnN93/RCSyXhFRI4uSfftM2Ba3w7ZO7076bfKasZsA0fw==,
|
||||
}
|
||||
dependencies:
|
||||
glob: 7.1.7
|
||||
@@ -5490,6 +5540,7 @@ packages:
|
||||
typescript: 4.6.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@typescript-eslint/experimental-utils/5.28.0_hrkuebk64jiu2ut2d2sm4oylnu:
|
||||
resolution:
|
||||
@@ -7354,7 +7405,10 @@ packages:
|
||||
dev: false
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==,
|
||||
}
|
||||
|
||||
/consola/2.15.3:
|
||||
resolution:
|
||||
@@ -9313,11 +9367,12 @@ packages:
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/eslint-config-next/12.2.4_hrkuebk64jiu2ut2d2sm4oylnu:
|
||||
/eslint-config-next/12.2.5_hrkuebk64jiu2ut2d2sm4oylnu:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-r3keSLY1Z+rN+ASN8nmWwZ+AsMl6IrPGRWgbQhKHcop4/fk1hJGxE9Xf/mYMkV07+1Q/catchw25lu525HFy5Q==,
|
||||
integrity: sha512-SOowilkqPzW6DxKp3a3SYlrfPi5Ajs9MIzp9gVfUDxxH9QFM5ElkR1hX5m/iICJuvCbWgQqFBiA3mCMozluniw==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
@@ -9326,7 +9381,7 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.2.4
|
||||
"@next/eslint-plugin-next": 12.2.5
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint: 7.32.0
|
||||
@@ -9350,6 +9405,7 @@ packages:
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
eslint: ">=7.0.0"
|
||||
dev: false
|
||||
|
||||
/eslint-config-prettier/8.5.0_eslint@7.32.0:
|
||||
resolution:
|
||||
@@ -12014,7 +12070,7 @@ packages:
|
||||
pretty-format: 27.5.1
|
||||
slash: 3.0.0
|
||||
strip-json-comments: 3.1.1
|
||||
ts-node: 10.7.0_typescript@4.6.3
|
||||
ts-node: 10.7.0_fxg3r7oju3tntkxsvleuiot4fa
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- canvas
|
||||
@@ -17300,7 +17356,6 @@ packages:
|
||||
typescript: 4.6.3
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
dev: false
|
||||
|
||||
/ts-node/10.7.0_typescript@4.6.3:
|
||||
resolution:
|
||||
@@ -17333,6 +17388,7 @@ packages:
|
||||
typescript: 4.6.3
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
dev: false
|
||||
|
||||
/tsconfig-paths/3.14.1:
|
||||
resolution:
|
||||
|
||||
Reference in New Issue
Block a user