Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

March 5 pull request #1

Merged
merged 37 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
34f249d
fix some issues with `blitz start` using wrong build folder (#2017)
flybayer Feb 27, 2021
4203d94
(newapp) change template to use typescript 4.1 because 4.2 is broken …
flybayer Feb 27, 2021
cf6a906
v0.30.6
flybayer Feb 27, 2021
2880fbb
Switch from tsdx to preconstruct for DX/perf improvements (meta) (#2013)
flybayer Feb 28, 2021
ec64559
Update .npmrc (#2021)
mitchazj Mar 1, 2021
2fcd6d8
docs: add mitchazj as a contributor (#2028)
allcontributors[bot] Mar 1, 2021
d2e5368
Fix Cannot read property 'toString' of null for `blitz new` (#2025)
roshan-sama Mar 1, 2021
50c5009
docs: add Roesh as a contributor (#2029)
allcontributors[bot] Mar 1, 2021
e8551a0
Add `blitz install secureheaders` recipe for setting secure headers (…
MrLeebo Mar 1, 2021
328035b
(meta) Remove need to build framework code during development 🎉 (#2032)
flybayer Mar 1, 2021
fe87534
(meta) upgrade husky to v5 (#2033)
flybayer Mar 1, 2021
b34368c
(meta) add manypkg, a linter for monorepo dependencies (#2034)
flybayer Mar 1, 2021
b347a7d
fix: remove bit of test code
MrLeebo Mar 1, 2021
e4a8a8b
(meta) use ultra for running monorepo workspace commands (#2035)
flybayer Mar 1, 2021
63387ab
fix `db.$reset` to not spew prisma logs (patch) (#2041)
flybayer Mar 3, 2021
e41401c
Fix `invoke` return type (#2044)
Skn0tt Mar 3, 2021
3565c57
Bind to 127.0.0.1 by default instead of 0.0.0.0 (for security) (#2045)
Skn0tt Mar 3, 2021
2178f11
v0.30.7
flybayer Mar 3, 2021
efcd1da
fix deps (meta)
flybayer Mar 3, 2021
bcec418
refactor jest preset (meta) (#2049)
flybayer Mar 3, 2021
eaef66b
(meta) added husky initialization in `pre-commit` (#2051)
JuanM04 Mar 4, 2021
66cd766
Major internal refactor + add multiple entry points + change all impo…
flybayer Mar 4, 2021
4be4c51
remove `blitz test` command because almost no-one uses it (#2057)
flybayer Mar 4, 2021
31fada7
(recipe) Add `blitz install gh-action-yarn-mariadb` GH action config …
kevinlangleyjr Mar 4, 2021
7250a27
docs: add kevinlangleyjr as a contributor (#2059)
allcontributors[bot] Mar 4, 2021
0f9b19c
v0.31.0
flybayer Mar 4, 2021
c1a72f7
Update LICENSE year (#2060)
QueenPew Mar 5, 2021
ae4ca39
docs: add heavygabriel as a contributor (#2061)
allcontributors[bot] Mar 5, 2021
e4cebb2
Add @chenkie as a contributor
JuanM04 Mar 5, 2021
cc8a10f
Add @sbappan as a contributor
JuanM04 Mar 5, 2021
be9d712
Update @akbo as a contributor
JuanM04 Mar 5, 2021
90b44ee
(recipe) change render.com recipe to build app before running migration
flybayer Mar 5, 2021
b38ab9b
Added @Kosai106 as contributor (#2067)
blitzjs-bot[bot] Mar 5, 2021
c21445a
Fix deployments to vercel (#2068)
flybayer Mar 5, 2021
ca7ad29
v0.31.1
flybayer Mar 5, 2021
9568d1c
update release patch
flybayer Mar 5, 2021
7ff1d2d
Added @flybayer as contributor (#2069)
blitzjs-bot[bot] Mar 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"code",
"content",
"ideas",
"review"
"review",
"test"
]
},
{
Expand Down Expand Up @@ -1908,7 +1909,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/1926271?v=4",
"profile": "https://github.com/akbo",
"contributions": [
"code"
"code",
"doc"
]
},
{
Expand Down Expand Up @@ -2167,8 +2169,62 @@
"code",
"test"
]
},
{
"login": "mitchazj",
"name": "Mitchell Johnson",
"avatar_url": "https://avatars.githubusercontent.com/u/15032956?v=4",
"profile": "https://github.com/mitchazj",
"contributions": [
"code"
]
},
{
"login": "Roesh",
"name": "Roshan Manuel",
"avatar_url": "https://avatars.githubusercontent.com/u/31125563?v=4",
"profile": "https://roshan.page/",
"contributions": [
"code"
]
},
{
"login": "kevinlangleyjr",
"name": "Kevin Langley Jr.",
"avatar_url": "https://avatars.githubusercontent.com/u/877634?v=4",
"profile": "https://kevinlangleyjr.com",
"contributions": [
"code"
]
},
{
"login": "heavygabriel",
"name": "Gabriel Picard",
"avatar_url": "https://avatars.githubusercontent.com/u/51029779?v=4",
"profile": "https://projet-test-99df0.firebaseapp.com/",
"contributions": [
"doc"
]
},
{
"login": "chenkie",
"name": "Ryan Chenkie",
"avatar_url": "https://avatars.githubusercontent.com/u/1847678?v=4",
"profile": "http://ryanchenkie.com/",
"contributions": [
"doc"
]
},
{
"login": "sbappan",
"name": "Santhosh B. Appan",
"avatar_url": "https://avatars.githubusercontent.com/u/12586088?v=4",
"profile": "https://github.com/sbappan",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
"skipCi": true
}
}
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
ecmaFeatures: {
jsx: true,
},
project: `./tsconfig.json`,
project: `./tsconfig.eslint.json`,
},
plugins: ["@typescript-eslint", "import", "unicorn", "simple-import-sort"],
extends: ["react-app"],
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
run: yarn install --frozen-lockfile --silent
env:
CI: true
- name: manypkg lint
run: yarn manypkg check
env:
CI: true
- name: yarn lint
run: yarn lint
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ dist
**/.test*
examples/auth2
.idea
.ultra.cache.json
db.sqlite-journal
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
yarn pretty-quick --staged
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Brandon Bayer
Copyright (c) 2021 Brandon Bayer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<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-230-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-236-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">
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
Expand Down Expand Up @@ -213,7 +213,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://twitter.com/flybayer"><img src="https://avatars3.githubusercontent.com/u/8813276?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brandon Bayer</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=flybayer" title="Code">💻</a> <a href="#content-flybayer" title="Content">🖋</a> <a href="#ideas-flybayer" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/blitz-js/blitz/pulls?q=is%3Apr+reviewed-by%3Aflybayer" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://twitter.com/flybayer"><img src="https://avatars3.githubusercontent.com/u/8813276?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brandon Bayer</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=flybayer" title="Code">💻</a> <a href="#content-flybayer" title="Content">🖋</a> <a href="#ideas-flybayer" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/blitz-js/blitz/pulls?q=is%3Apr+reviewed-by%3Aflybayer" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/blitz-js/blitz/commits?author=flybayer" title="Tests">⚠️</a></td>
<td align="center"><a href="https://medium.com/@ryardley"><img src="https://avatars0.githubusercontent.com/u/1256409?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rudi Yardley</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=ryardley" title="Code">💻</a> <a href="#ideas-ryardley" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/blitz-js/blitz/pulls?q=is%3Apr+reviewed-by%3Aryardley" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/blitz-js/blitz/commits?author=ryardley" title="Tests">⚠️</a></td>
<td align="center"><a href="https://merelinguist.me"><img src="https://avatars3.githubusercontent.com/u/24858006?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dylan Brookes</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=merelinguist" title="Code">💻</a> <a href="#ideas-merelinguist" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/blitz-js/blitz/pulls?q=is%3Apr+reviewed-by%3Amerelinguist" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/blitz-js/blitz/commits?author=merelinguist" title="Tests">⚠️</a> <a href="https://github.com/blitz-js/blitz/commits?author=merelinguist" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/aem"><img src="https://avatars0.githubusercontent.com/u/1909883?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Adam Markon</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=aem" title="Code">💻</a> <a href="#ideas-aem" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/blitz-js/blitz/pulls?q=is%3Apr+reviewed-by%3Aaem" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/blitz-js/blitz/commits?author=aem" title="Tests">⚠️</a> <a href="#maintenance-aem" title="Maintenance">🚧</a></td>
Expand Down Expand Up @@ -470,7 +470,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<td align="center"><a href="https://github.com/rince"><img src="https://avatars.githubusercontent.com/u/933895?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kazuma Suzuki</b></sub></a><br /><a href="#design-rince" title="Design">🎨</a> <a href="https://github.com/blitz-js/blitz/commits?author=rince" title="Code">💻</a></td>
<td align="center"><a href="http://queq1890.info"><img src="https://avatars.githubusercontent.com/u/32263803?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yuji Matsumoto</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=queq1890" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/Gim3l"><img src="https://avatars.githubusercontent.com/u/46765702?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gimel Dick</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Gim3l" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/akbo"><img src="https://avatars.githubusercontent.com/u/1926271?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andreas Bollig</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=akbo" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/akbo"><img src="https://avatars.githubusercontent.com/u/1926271?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andreas Bollig</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=akbo" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=akbo" title="Documentation">📖</a></td>
<td align="center"><a href="https://ajm.codes"><img src="https://avatars.githubusercontent.com/u/66390428?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AJ Markow</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=ajmarkow" title="Tests">⚠️</a> <a href="https://github.com/blitz-js/blitz/commits?author=ajmarkow" title="Code">💻</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -507,6 +507,14 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<td align="center"><a href="https://lewisb.cloud/"><img src="https://avatars.githubusercontent.com/u/51877955?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lewis Blackburn</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=lewisblackburn" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/FDiskas"><img src="https://avatars.githubusercontent.com/u/468006?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vytenis</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=FDiskas" title="Code">💻</a></td>
<td align="center"><a href="https://portfolio.matthieupetit.com"><img src="https://avatars.githubusercontent.com/u/12969089?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matthieu</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=matthieu994" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=matthieu994" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/mitchazj"><img src="https://avatars.githubusercontent.com/u/15032956?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mitchell Johnson</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=mitchazj" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://roshan.page/"><img src="https://avatars.githubusercontent.com/u/31125563?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roshan Manuel</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Roesh" title="Code">💻</a></td>
<td align="center"><a href="https://kevinlangleyjr.com"><img src="https://avatars.githubusercontent.com/u/877634?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kevin Langley Jr.</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=kevinlangleyjr" title="Code">💻</a></td>
<td align="center"><a href="https://projet-test-99df0.firebaseapp.com/"><img src="https://avatars.githubusercontent.com/u/51029779?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gabriel Picard</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=heavygabriel" title="Documentation">📖</a></td>
<td align="center"><a href="http://ryanchenkie.com/"><img src="https://avatars.githubusercontent.com/u/1847678?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryan Chenkie</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=chenkie" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/sbappan"><img src="https://avatars.githubusercontent.com/u/12586088?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Santhosh B. Appan</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=sbappan" title="Documentation">📖</a></td>
</tr>
</table>

Expand Down
29 changes: 29 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
presets: [
"@babel/preset-typescript",
"@babel/preset-react",
[
"@babel/preset-env",
{
modules: false,
loose: true,
exclude: [
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-transform-regenerator",
],
},
],
],
plugins: [
"babel-plugin-annotate-pure-calls",
"babel-plugin-dev-expression",
["@babel/plugin-proposal-class-properties", {loose: true}],
"babel-plugin-macros",
[
"transform-inline-environment-variables",
{
include: ["BLITZ_PROD_BUILD"],
},
],
],
}
4 changes: 2 additions & 2 deletions examples/auth/app/auth/mutations/forgotPassword.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ beforeEach(async () => {
})

const generatedToken = "plain-token"
jest.mock("blitz", () => ({
...jest.requireActual("blitz")!,
jest.mock("@blitzjs/core/server", () => ({
...jest.requireActual("@blitzjs/core/server")!,
generateToken: () => generatedToken,
}))
jest.mock("preview-email", () => jest.fn())
Expand Down
13 changes: 0 additions & 13 deletions examples/auth/app/mutations/makeCoffee.ts

This file was deleted.

4 changes: 2 additions & 2 deletions examples/auth/app/pages/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {render} from "test/utils"
import Home from "./index"

jest.mock("blitz", () => ({
...jest.requireActual("blitz")!,
jest.mock("@blitzjs/core", () => ({
...jest.requireActual("@blitzjs/core")!,
useQuery: () => [
{
id: 1,
Expand Down
22 changes: 7 additions & 15 deletions examples/auth/app/pages/ssr.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
import {FC} from "react"
import {getSessionContext} from "@blitzjs/server"
import {
getSession,
invokeWithMiddleware,
useRouter,
GetServerSideProps,
PromiseReturnType,
ErrorComponent as ErrorPage,
useMutation,
AuthenticationError,
AuthorizationError,
GetServerSideProps,
InferGetServerSidePropsType,
BlitzPage,
} from "blitz"
import getUser from "app/users/queries/getUser"
import logout from "app/auth/mutations/logout"
import path from "path"

type PageProps = {
user?: PromiseReturnType<typeof getUser>
error?: {
statusCode: number
message: string
}
}

export const getServerSideProps: GetServerSideProps<PageProps> = async ({req, res}) => {
export const getServerSideProps: GetServerSideProps = async ({req, res}) => {
// Ensure these files are not eliminated by trace-based tree-shaking (like Vercel)
// https://github.com/blitz-js/blitz/issues/794
path.resolve("next.config.js")
path.resolve("blitz.config.js")
path.resolve(".next/blitz/db.js")
// End anti-tree-shaking

const session = await getSessionContext(req, res)
const session = await getSession(req, res)
console.log("Session id:", session.userId)
try {
const user = await invokeWithMiddleware(
Expand Down Expand Up @@ -62,7 +54,7 @@ export const getServerSideProps: GetServerSideProps<PageProps> = async ({req, re
}
}

const Test: FC<PageProps> = ({user, error}: PageProps) => {
const Test: BlitzPage<InferGetServerSidePropsType<typeof getServerSideProps>> = ({user, error}) => {
const router = useRouter()
const [logoutMutation] = useMutation(logout)

Expand Down
35 changes: 19 additions & 16 deletions examples/auth/blitz.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
const {sessionMiddleware, simpleRolesIsAuthorized} = require("@blitzjs/server")
const {sessionMiddleware, simpleRolesIsAuthorized} = require("blitz")
const withMonorepoBuildTooling = require("@preconstruct/next")
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
})

module.exports = withBundleAnalyzer({
middleware: [
sessionMiddleware({
isAuthorized: simpleRolesIsAuthorized,
// sessionExpiryMinutes: 4,
}),
],
log: {
// level: "trace",
},
experimental: {
isomorphicResolverImports: false,
},
/*
module.exports = withMonorepoBuildTooling(
withBundleAnalyzer({
middleware: [
sessionMiddleware({
isAuthorized: simpleRolesIsAuthorized,
// sessionExpiryMinutes: 4,
}),
],
log: {
// level: "trace",
},
experimental: {
isomorphicResolverImports: false,
},
/*
webpack: (config, {buildId, dev, isServer, defaultLoaders, webpack}) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
Expand All @@ -29,4 +31,5 @@ module.exports = withBundleAnalyzer({
return config
},
*/
})
}),
)
2 changes: 2 additions & 0 deletions examples/auth/cypress/integration/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe("index page", () => {
cy.contains("button", "Logout").click()

cy.location("pathname").should("equal", "/")
cy.wait(1000)
cy.contains("a", /login/i)
})

Expand All @@ -62,6 +63,7 @@ describe("index page", () => {
const user = createRandomUser()

cy.contains("button", "Track view").click()
cy.wait(500)
cy.contains("button", "Track view").click()
cy.wait(1000)
cy.contains('"views": 2')
Expand Down
Loading