Compare commits
118 Commits
use-author
...
v0.30.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2178f11210 | ||
|
|
3565c57fca | ||
|
|
e41401c744 | ||
|
|
63387ab2ee | ||
|
|
e4a8a8b5b2 | ||
|
|
b347a7d999 | ||
|
|
b34368c690 | ||
|
|
fe87534109 | ||
|
|
328035bf22 | ||
|
|
e8551a0991 | ||
|
|
50c50097aa | ||
|
|
d2e5368b5c | ||
|
|
2fcd6d88b6 | ||
|
|
ec6455920c | ||
|
|
2880fbba30 | ||
|
|
cf6a906fc1 | ||
|
|
4203d94169 | ||
|
|
34f249d259 | ||
|
|
d3254d11f8 | ||
|
|
14ac3d9f3f | ||
|
|
4c85bce781 | ||
|
|
1a078c54d4 | ||
|
|
47438c8ccf | ||
|
|
13b8f1239d | ||
|
|
5ed0f11734 | ||
|
|
48383ef363 | ||
|
|
11fc19fee2 | ||
|
|
fb4a63acba | ||
|
|
c3f8c7d07d | ||
|
|
51519166ef | ||
|
|
113a3a04f3 | ||
|
|
eba2a8081d | ||
|
|
16d2cae5b8 | ||
|
|
c2bd242d46 | ||
|
|
99966ab192 | ||
|
|
387e6e420b | ||
|
|
d39b461ddd | ||
|
|
0b7d463e7f | ||
|
|
87c4ee058c | ||
|
|
177c2b0519 | ||
|
|
31411baff5 | ||
|
|
2c4b803e7b | ||
|
|
117f0fda74 | ||
|
|
f613e08866 | ||
|
|
b696831e9f | ||
|
|
bd1781b99e | ||
|
|
9077397abe | ||
|
|
8e8fcffa2a | ||
|
|
364fb5e618 | ||
|
|
7678181bcf | ||
|
|
180d4cc4a1 | ||
|
|
2484b3a692 | ||
|
|
f1e223cd47 | ||
|
|
1a4dd4a2fe | ||
|
|
7f3fcf1489 | ||
|
|
219f069dba | ||
|
|
09bd6751fa | ||
|
|
f03fe566e5 | ||
|
|
4ed750a8f7 | ||
|
|
39eb1cef9b | ||
|
|
0a3c975b98 | ||
|
|
1b4119bb50 | ||
|
|
f0d880a4f2 | ||
|
|
11a11be20b | ||
|
|
0273e58749 | ||
|
|
75c3dc635e | ||
|
|
00e54948f2 | ||
|
|
ffcd0b4243 | ||
|
|
6bc26128ee | ||
|
|
f8b599aff4 | ||
|
|
fa09904d3a | ||
|
|
7c6c7dfdb5 | ||
|
|
ca850480ae | ||
|
|
f9006974bf | ||
|
|
5f6d296e37 | ||
|
|
5697173d5a | ||
|
|
69e5da6794 | ||
|
|
66e521e14b | ||
|
|
2a25bab41c | ||
|
|
c2fa1486df | ||
|
|
19cc7a1510 | ||
|
|
b1ed61f96d | ||
|
|
a101964603 | ||
|
|
eeeab00f1b | ||
|
|
42bf665f44 | ||
|
|
abf4795395 | ||
|
|
d48891a144 | ||
|
|
57f1e7d703 | ||
|
|
2d3e46fd79 | ||
|
|
984de2cab1 | ||
|
|
fca7791c47 | ||
|
|
c389a7ad6b | ||
|
|
a4320fd974 | ||
|
|
157c397959 | ||
|
|
d7804089e1 | ||
|
|
04b0cd356c | ||
|
|
cd615f58bd | ||
|
|
c49da040b5 | ||
|
|
da6685cd2d | ||
|
|
0f4de7761e | ||
|
|
3114e8bc4a | ||
|
|
e2383fbb5f | ||
|
|
a4ea513a76 | ||
|
|
9e1860d8b3 | ||
|
|
05673fbdb5 | ||
|
|
a2cdcf4a74 | ||
|
|
9ff56beebf | ||
|
|
b238bae52c | ||
|
|
caf3d260c8 | ||
|
|
b108c5720f | ||
|
|
8ccc744c5f | ||
|
|
b0ed47e1b8 | ||
|
|
ae43a07b4d | ||
|
|
0ba81b6474 | ||
|
|
190bc65c53 | ||
|
|
85bd4ec286 | ||
|
|
1792cc6788 | ||
|
|
dc88bc68d2 |
@@ -1587,7 +1587,8 @@
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/43112535?v=4",
|
||||
"profile": "http://Dal.Design",
|
||||
"contributions": [
|
||||
"code"
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1975,6 +1976,215 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "LBrian",
|
||||
"name": "Brian Liu",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/3888780?v=4",
|
||||
"profile": "https://brianypliu.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "beerose",
|
||||
"name": "Aleksandra Sikora",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/9019397?v=4",
|
||||
"profile": "http://aleksandra.codes",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "JuanM04",
|
||||
"name": "JuanM04",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/16712703?v=4",
|
||||
"profile": "https://juanm04.com",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "arenddeboer",
|
||||
"name": "Arend de Boer",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7022204?v=4",
|
||||
"profile": "https://github.com/arenddeboer",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "fmilani",
|
||||
"name": "Felipe Milani",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1580375?v=4",
|
||||
"profile": "https://github.com/fmilani",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jxe",
|
||||
"name": "Joe Edelman",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/13018?v=4",
|
||||
"profile": "http://nxhx.org",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "garytube",
|
||||
"name": "Gary",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/3823504?v=4",
|
||||
"profile": "https://github.com/garytube",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "oliverloops",
|
||||
"name": "Oliver Lopez ",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/33361399?v=4",
|
||||
"profile": "http://oliverloops.com",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "DecadentIpsum",
|
||||
"name": "Andreas Zaralis",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/32861532?v=4",
|
||||
"profile": "https://decadentIpsum.me",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "davetorbeck",
|
||||
"name": "David Torbeck",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5829885?v=4",
|
||||
"profile": "https://github.com/davetorbeck",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "gusgard",
|
||||
"name": "Gustavo Gard",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/2577356?v=4",
|
||||
"profile": "https://github.com/gusgard",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Immortalin",
|
||||
"name": "Immortalin",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7126128?v=4",
|
||||
"profile": "https://narrationbox.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "cristianbgp",
|
||||
"name": "Cristian Granda",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8507974?v=4",
|
||||
"profile": "https://cristianbgp.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "deniseyu",
|
||||
"name": "Denise Yu",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8420094?v=4",
|
||||
"profile": "https://deniseyu.io",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "andreadellacorte",
|
||||
"name": "Andrea Della Corte",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/295683?v=4",
|
||||
"profile": "http://dellacorte.me",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "aditsachde",
|
||||
"name": "Adit Sachde",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/23707194?v=4",
|
||||
"profile": "http://aditsachde.com",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "hirenchauhan2",
|
||||
"name": "Hiren Chauhan",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8999668?v=4",
|
||||
"profile": "https://github.com/hirenchauhan2",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "remjx",
|
||||
"name": "Mark Jackson",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/35121685?v=4",
|
||||
"profile": "http://remjx.com/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lewisblackburn",
|
||||
"name": "Lewis Blackburn",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/51877955?v=4",
|
||||
"profile": "https://lewisb.cloud/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "FDiskas",
|
||||
"name": "Vytenis",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/468006?v=4",
|
||||
"profile": "https://github.com/FDiskas",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "matthieu994",
|
||||
"name": "Matthieu",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/12969089?v=4",
|
||||
"profile": "https://portfolio.matthieupetit.com",
|
||||
"contributions": [
|
||||
"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"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -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"],
|
||||
|
||||
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,23 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Something is not working right. Or error messages are unclear.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
### What is the problem?
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
1.
|
||||
|
||||
### Versions
|
||||
|
||||
```
|
||||
output of `blitz --version --verbose`
|
||||
```
|
||||
|
||||
### Other
|
||||
|
||||
Please include applicable logs and screenshots that show your problem.
|
||||
31
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
31
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Bug Report
|
||||
about: Something is not working right. Or error messages are unclear.
|
||||
labels: "kind/bug, status/triage"
|
||||
issue_body: true
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What is the problem?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What are detailed steps to reproduce this?
|
||||
value: "1."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Run `blitz -v` and paste the output here:"
|
||||
value: |
|
||||
```
|
||||
PASTE_HERE
|
||||
```
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Please include below any other applicable logs and screenshots that show your problem:"
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -2,7 +2,7 @@
|
||||
name: Feature/change request
|
||||
about: Something new or better!
|
||||
title: ""
|
||||
labels: ""
|
||||
labels: "status/triage"
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
|
||||
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ canary, master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ canary ]
|
||||
schedule:
|
||||
- cron: '31 19 * * 5'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
@@ -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:
|
||||
@@ -48,7 +52,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
node_version: [12, 14]
|
||||
node_version: [12, 15]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -91,7 +95,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
node_version: [12, 14]
|
||||
node_version: [12, 15]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -25,3 +25,6 @@ dist
|
||||
.tsbuildinfo
|
||||
.nvmrc
|
||||
**/.test*
|
||||
examples/auth2
|
||||
.idea
|
||||
.ultra.cache.json
|
||||
|
||||
1
.husky/.gitignore
vendored
Normal file
1
.husky/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
_
|
||||
3
.husky/pre-commit
Executable file
3
.husky/pre-commit
Executable file
@@ -0,0 +1,3 @@
|
||||
yarn manypkg fix
|
||||
yarn lint-staged
|
||||
yarn pretty-quick --staged
|
||||
@@ -1,11 +0,0 @@
|
||||
# Blitz.js Governance
|
||||
|
||||
_From Brandon Bayer (@flybayer), the creator:_
|
||||
|
||||
Currently at this very early stage it's basically a [BDFL situation](https://opensource.guide/leadership-and-governance/#what-are-some-of-the-common-governance-structures-for-open-source-projects), with me having the final say in decisions.
|
||||
|
||||
However we will move away from BDFL to something that looks more like Ember.js. It's extremely important to me (Brandon) that Blitz.js is a long-term, sustainable, and community-run project.
|
||||
|
||||
I would love some mentorship from people with experience in large open-source projects on making this transition.
|
||||
|
||||
Also, it's possible I will create one or more business around Blitz, perhaps similar to how Taylor Otwell has around Laravel, but Blitz itself will always remain a separate community-run project.
|
||||
@@ -1 +0,0 @@
|
||||
This document has moved here: https://blitzjs.com/docs/maintainers
|
||||
@@ -1,3 +0,0 @@
|
||||
# Manifesto
|
||||
|
||||
[The Manifesto has been moved to Blitzjs.com](https://blitzjs.com/docs/manifesto)
|
||||
86
README.md
86
README.md
@@ -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-209-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-232-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">
|
||||
@@ -22,15 +22,15 @@
|
||||
<h1 align="center">The Fullstack React Framework</h1>
|
||||
|
||||
<h5 align="center">"Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails</h3>
|
||||
<h3 align="center">Makes you far more productive than you ever dreamed was possible 😉</h3>
|
||||
<h3 align="center"><a href="https://blitzjs.com" target="_blank">Read the Documentation</a></h3>
|
||||
<br>
|
||||
|
||||
“Zero-API” data layer **lets you import server code directly into your React components** instead of having to manually add API endpoints and do client-side fetching and caching.
|
||||
|
||||
Includes everything you need for production apps. **Everything end-to-end from the database to the frontend.**
|
||||
New Blitz apps come with **all the boring stuff already set up for you!** Like ESLint, Prettier, Jest, user sign up, log in, and password reset.
|
||||
|
||||
Provides **helpful defaults and conventions** for things like routing, file structure, and authentication while also being extremely flexible.
|
||||
|
||||
Blitz brings back the **simplicity and conventions** of server-rendered frameworks like Ruby on Rails while preserving everything we love about React and client-side rendering!
|
||||
|
||||
<br>
|
||||
|
||||
@@ -49,7 +49,7 @@ _You can alternatively use [`npx`](https://www.npmjs.com/package/npx)_
|
||||
1. `blitz new myAppName`
|
||||
2. `cd myAppName`
|
||||
3. `blitz dev`
|
||||
4. View your baby app at http://localhost:3000
|
||||
4. View your brand new app at http://localhost:3000
|
||||
|
||||
<br><br>
|
||||
|
||||
@@ -57,32 +57,10 @@ _You can alternatively use [`npx`](https://www.npmjs.com/package/npx)_
|
||||
<img alt="Bytes Newsletter" src="https://files-8wtskjofb.vercel.app/smarter-16x1.jpg">
|
||||
</a>
|
||||
|
||||
<br><br>
|
||||
|
||||

|
||||
|
||||
<br><br>
|
||||
|
||||
**Features:**<br>
|
||||
⚡️ Built on Next.js<br>
|
||||
⚡️ Don't have to build an API for client-side rendering<br>
|
||||
⚡️ Client-side rendering, Server-side rendering, and fully static pages all in the same app<br>
|
||||
⚡️ Full TypeScript support with static, end-to-end typing (no code generation step needed like with GraphQL)<br>
|
||||
⚡️ React Concurrent Mode enabled<br>
|
||||
⚡️ Database/ORM agnostic, but Prisma 2 is default<br>
|
||||
⚡️ CLI with code scaffolding, Rails-style console REPL, etc<br>
|
||||
⚡️ GraphQL Ready<br>
|
||||
⚡️ Deploy serverless or serverful<br>
|
||||
⚡️ Highly secure authentication <br>
|
||||
⚡️ Authorization you can use on both server and client<br>
|
||||
⚡️ Recipes for easily adding libraries like Tailwind, CSS-in-JS, etc.<br>
|
||||
|
||||
**Other key features coming:**<br>
|
||||
⚡️ Model validation you can use on both server and client<br>
|
||||
⚡️ React native support<br>
|
||||
⚡️ GUI so you don't have to use the CLI<br>
|
||||
|
||||
<br>
|
||||
|
||||
### The Foundational Principles
|
||||
|
||||
@@ -128,35 +106,38 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
### 🌱 Seedling Sponsors
|
||||
|
||||
<a aria-label="React Bricks" href="https://reactbricks.com/?utm_source=blitzjs&utm_medium=sponsorship&utm_campaign=blitzjs_sponsorship">
|
||||
<img alt="" src="https://reactbricks.com/reactbricks_icon.svg" width="30px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/reactbricks_icon.svg" width="40px"/>
|
||||
</a>
|
||||
<a aria-label="Andreas Asprou" href="https://andreas.fyi">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/andreas.jpg" width="30px"/>
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/andreas.jpg" width="40px"/>
|
||||
</a>
|
||||
<a aria-label="Robert Malko" href="https://github.com/malkomalko">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/rob_blitz.jpg" width="40px"/>
|
||||
</a>
|
||||
|
||||
|
||||
### 🥉 Bronze Sponsors
|
||||
|
||||
<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="110px">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/render-logo-color2.png" width="200px">
|
||||
</a>
|
||||
|
||||
### 🥈 Silver Sponsors
|
||||
|
||||
<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="200px">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/canary/assets/Fauna_Logo_Blue.png" width="300px">
|
||||
</a>
|
||||
|
||||
### 🏆 Gold Sponsors
|
||||
|
||||
<a aria-label="Your Company" href="#">
|
||||
<img alt="" src="https://dummyimage.com/1000x330/efe8ff/000000.png&text=Your+Logo+Here" width="300px">
|
||||
<img alt="" src="https://dummyimage.com/1000x330/efe8ff/000000.png&text=Your+Logo+Here" width="400px">
|
||||
</a>
|
||||
|
||||
### 💎 Diamond Sponsors
|
||||
|
||||
<a aria-label="Your Company" href="#">
|
||||
<img alt="" src="https://dummyimage.com/1000x330/efe8ff/000000.png&text=Your+Logo+Here" width="400px">
|
||||
<img alt="" src="https://dummyimage.com/1000x330/efe8ff/000000.png&text=Your+Logo+Here" width="500px">
|
||||
</a>
|
||||
|
||||
<br>
|
||||
@@ -177,7 +158,7 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
|
||||
## Maintainers (Level 2) ✨
|
||||
|
||||
_Code ownership, pull request approvals and merging, etc_ (see [MAINTAINERS.md](./MAINTAINERS.md))
|
||||
_Code ownership, pull request approvals and merging, etc_ (see [Maintainers L2](https://blitzjs.com/docs/maintainers#level-2-maintainers))
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
@@ -186,6 +167,7 @@ _Code ownership, pull request approvals and merging, etc_ (see [MAINTAINERS.md](
|
||||
<td align="center"><a href="https://github.com/aem"><img src="https://avatars0.githubusercontent.com/u/1909883?v=4" width="100px;" alt=""/><br /><sub><b>Adam Markon</b></sub></a><br />CLI</td>
|
||||
<td align="center"><a href="http://robdrosenberg.com"><img src="https://avatars0.githubusercontent.com/u/20813991?v=4" width="100px;" alt=""/><br /><sub><b>Robert Rosenberg</b></sub></a><br />Website/Docs</td>
|
||||
<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="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>
|
||||
<!-- markdownlint-enable -->
|
||||
@@ -195,7 +177,7 @@ _Code ownership, pull request approvals and merging, etc_ (see [MAINTAINERS.md](
|
||||
|
||||
## Maintainers (Level 1) ✨
|
||||
|
||||
_Issue triage, pull request triage, community encouragement and moderation, etc_ (see [MAINTAINERS.md](./MAINTAINERS.md))
|
||||
_Issue triage, pull request triage, community encouragement and moderation, etc_ (see [Maintainers L1](https://blitzjs.com/docs/maintainers#level-1-maintainers))
|
||||
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
@@ -212,7 +194,6 @@ _Issue triage, pull request triage, community encouragement and moderation, etc_
|
||||
<tr>
|
||||
<td align="center"><a href="https://twitter.com/jdavenport97"><img src="https://avatars2.githubusercontent.com/u/1329874?v=4" width="100px;" alt=""/><br /><sub><b>Jamie Davenport</b></sub></a></td>
|
||||
<td align="center"><a href="https://twitter.com/myrondavis"><img src="https://avatars2.githubusercontent.com/u/1430136?v=4" width="100px;" alt=""/><br /><sub><b>Myron Davis</b></sub></a></td>
|
||||
<td align="center"><a href="https://flavioander.com/"><img src="https://avatars2.githubusercontent.com/u/14948074?s=460&u=31d7ea58b5c5cd9f724d684ed578f68896c4af71&v=4" width="100px;" alt=""/><br /><sub><b>Flavio Andrade</b></sub></a></td>
|
||||
<td align="center"><a href="https://twitter.com/NaReto1125_"><img src="https://avatars.githubusercontent.com/reo777" width="100px;" alt=""/><br /><sub><b>Reo Ishiyama</b></sub></a></td>
|
||||
<td align="center"><a href="https://github.com/malkomalko"><img src="https://avatars.githubusercontent.com/malkomalko" width="100px;" alt=""/><br /><sub><b>Robert Malko</b></sub></a></td>
|
||||
</tr>
|
||||
@@ -444,7 +425,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<td align="center"><a href="http://kattcorp.com"><img src="https://avatars1.githubusercontent.com/u/459267?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex Johansson</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=KATT" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://davidmazza.com"><img src="https://avatars0.githubusercontent.com/u/120893?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Mazza</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=dmzza" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/rayandrews"><img src="https://avatars1.githubusercontent.com/u/4437323?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ray Andrew</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=rayandrews" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=rayandrews" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://Dal.Design"><img src="https://avatars3.githubusercontent.com/u/43112535?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abdullah Mzaien</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Mzaien" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://Dal.Design"><img src="https://avatars3.githubusercontent.com/u/43112535?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abdullah Mzaien</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Mzaien" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=Mzaien" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://kwao.io"><img src="https://avatars2.githubusercontent.com/u/8839514?v=4?s=100" width="100px;" alt=""/><br /><sub><b>William Kwao</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=williamkwao" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -499,6 +480,37 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<td align="center"><a href="https://alistair.cloud"><img src="https://avatars.githubusercontent.com/u/25351731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alistair Smith</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=alii" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://rodrigoehlers.com"><img src="https://avatars.githubusercontent.com/u/19683042?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rodrigo Ehlers</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=rodrigoehlers" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://www.builtopen.com/"><img src="https://avatars.githubusercontent.com/u/1734057?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michael Ford</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=mtford90" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://brianypliu.com"><img src="https://avatars.githubusercontent.com/u/3888780?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brian Liu</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=LBrian" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://aleksandra.codes"><img src="https://avatars.githubusercontent.com/u/9019397?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aleksandra Sikora</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=beerose" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://juanm04.com"><img src="https://avatars.githubusercontent.com/u/16712703?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JuanM04</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=JuanM04" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=JuanM04" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/arenddeboer"><img src="https://avatars.githubusercontent.com/u/7022204?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arend de Boer</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=arenddeboer" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/fmilani"><img src="https://avatars.githubusercontent.com/u/1580375?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Felipe Milani</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=fmilani" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://nxhx.org"><img src="https://avatars.githubusercontent.com/u/13018?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joe Edelman</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jxe" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/garytube"><img src="https://avatars.githubusercontent.com/u/3823504?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gary</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=garytube" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://oliverloops.com"><img src="https://avatars.githubusercontent.com/u/33361399?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Oliver Lopez </b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=oliverloops" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://decadentIpsum.me"><img src="https://avatars.githubusercontent.com/u/32861532?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andreas Zaralis</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=DecadentIpsum" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/davetorbeck"><img src="https://avatars.githubusercontent.com/u/5829885?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Torbeck</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=davetorbeck" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/gusgard"><img src="https://avatars.githubusercontent.com/u/2577356?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gustavo Gard</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=gusgard" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://narrationbox.com"><img src="https://avatars.githubusercontent.com/u/7126128?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Immortalin</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Immortalin" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://cristianbgp.com"><img src="https://avatars.githubusercontent.com/u/8507974?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cristian Granda</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=cristianbgp" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://deniseyu.io"><img src="https://avatars.githubusercontent.com/u/8420094?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Denise Yu</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=deniseyu" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://dellacorte.me"><img src="https://avatars.githubusercontent.com/u/295683?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrea Della Corte</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=andreadellacorte" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://aditsachde.com"><img src="https://avatars.githubusercontent.com/u/23707194?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Adit Sachde</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=aditsachde" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/hirenchauhan2"><img src="https://avatars.githubusercontent.com/u/8999668?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hiren Chauhan</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=hirenchauhan2" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://remjx.com/"><img src="https://avatars.githubusercontent.com/u/35121685?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mark Jackson</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=remjx" title="Documentation">📖</a></td>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
10
SECURITY.md
Normal file
10
SECURITY.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
TODO
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Email Brandon Bayer at b@bayer.ws to report a vulnerablity, and he will follow up with you asap.
|
||||
|
||||
1
assets/reactbricks_icon.svg
Normal file
1
assets/reactbricks_icon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 980 979.97"><path d="M139.38,0c-185.82-3.54-185.82,277,0,273.46H251.44C437.25,277,437.25-3.5,251.44,0ZM729.25,353.24c-184.92-2.62-184.92,276.1,0,273.48H841.31c184.92,2.62,184.92-276.1,0-273.48ZM138.69,706.46c-184.92-2.61-184.92,276.1,0,273.49H250.75c184.91,2.61,184.91-276.1,0-273.49Z" fill="#b43278"/><path d="M583.47,0c-185.82-3.54-185.82,277,0,273.46H840.61c185.81,3.54,185.81-277,0-273.46ZM138.7,353.24c-184.92-2.62-184.92,276.1,0,273.48H395.85c184.92,2.62,184.92-276.1,0-273.48ZM584.13,706.46c-184.91-2.61-184.91,276.1,0,273.49H841.3c184.92,2.61,184.92-276.1,0-273.49Z" fill="#f65a8e"/></svg>
|
||||
|
After Width: | Height: | Size: 650 B |
BIN
assets/rob_blitz.jpg
Normal file
BIN
assets/rob_blitz.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
29
babel.config.js
Normal file
29
babel.config.js
Normal file
@@ -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"],
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export default passportAuth({
|
||||
update: {email},
|
||||
})
|
||||
|
||||
const publicData = {userId: user.id, roles: [user.role], source: "twitter"}
|
||||
const publicData = {userId: user.id, role: user.role, source: "twitter"}
|
||||
done(null, {publicData})
|
||||
},
|
||||
),
|
||||
@@ -92,7 +92,7 @@ export default passportAuth({
|
||||
|
||||
const publicData = {
|
||||
userId: user.id,
|
||||
roles: [user.role as Role],
|
||||
role: user.role as Role,
|
||||
source: "github",
|
||||
githubUsername: profile.username,
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export default passportAuth({
|
||||
|
||||
const publicData = {
|
||||
userId: user.id,
|
||||
roles: [user.role],
|
||||
role: user.role,
|
||||
source: "auth0",
|
||||
githubUsername: profile.username,
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default resolver.pipe(resolver.zod(Login), async ({email, password}, ctx)
|
||||
// This throws an error if credentials are invalid
|
||||
const user = await authenticateUser(email, password)
|
||||
|
||||
await ctx.session.$create({userId: user.id, roles: [user.role as Role]})
|
||||
await ctx.session.$create({userId: user.id, role: user.role as Role})
|
||||
|
||||
return user
|
||||
})
|
||||
|
||||
@@ -10,6 +10,6 @@ export default resolver.pipe(resolver.zod(Signup), async ({email, password}, ctx
|
||||
select: {id: true, name: true, email: true, role: true},
|
||||
})
|
||||
|
||||
await ctx.session.$create({userId: user.id, roles: [user.role as Role]})
|
||||
await ctx.session.$create({userId: user.id, role: user.role as Role})
|
||||
return user
|
||||
})
|
||||
|
||||
@@ -8,11 +8,17 @@ const LoginPage: BlitzPage = () => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<LoginForm onSuccess={() => router.push("/")} />
|
||||
<LoginForm
|
||||
onSuccess={() => {
|
||||
const next = (router.query.next as string) ?? "/"
|
||||
router.push(next)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
LoginPage.redirectAuthenticatedTo = "/"
|
||||
LoginPage.getLayout = (page) => <Layout title="Log In">{page}</Layout>
|
||||
|
||||
export default LoginPage
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {Head, useRouter, BlitzPage, useMutation} from "blitz"
|
||||
import {useRouter, BlitzPage} from "blitz"
|
||||
import Layout from "app/core/layouts/Layout"
|
||||
import {Form, FORM_ERROR} from "app/core/components/Form"
|
||||
import {LabeledTextField} from "app/core/components/LabeledTextField"
|
||||
import {SignupForm} from "app/auth/components/SignupForm"
|
||||
|
||||
const SignupPage: BlitzPage = () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {useSession, useRouter, useMutation, Head} from "blitz"
|
||||
import logout from "app/auth/mutations/logout"
|
||||
|
||||
export default function Layout({title, children}: {title?: string; children: React.ReactNode}) {
|
||||
const session = useSession()
|
||||
const session = useSession({suspense: false})
|
||||
const router = useRouter()
|
||||
const [logoutMutation] = useMutation(logout)
|
||||
return (
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import {resolver} from "blitz"
|
||||
import db from "db"
|
||||
import * as z from "zod"
|
||||
|
||||
const __Name__ = z
|
||||
.object({
|
||||
id: z.number(),
|
||||
})
|
||||
.nonstrict()
|
||||
|
||||
export default resolver.pipe(resolver.zod(__Name__), resolver.authorize(), async (input) => {
|
||||
// Do your stuff :)
|
||||
})
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
withBlitzAppRoot,
|
||||
AppProps,
|
||||
ErrorComponent,
|
||||
useRouter,
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import {render} from "test/utils"
|
||||
|
||||
import Home from "./index"
|
||||
import {useCurrentUser} from "app/core/hooks/useCurrentUser"
|
||||
|
||||
jest.mock("app/core/hooks/useCurrentUser")
|
||||
const mockUseCurrentUser = useCurrentUser as jest.MockedFunction<typeof useCurrentUser>
|
||||
jest.mock("blitz", () => ({
|
||||
...jest.requireActual("blitz")!,
|
||||
useQuery: () => [
|
||||
{
|
||||
id: 1,
|
||||
name: "User",
|
||||
email: "user@email.com",
|
||||
role: "user",
|
||||
},
|
||||
],
|
||||
}))
|
||||
|
||||
test("renders blitz documentation link", () => {
|
||||
// This is an example of how to ensure a specific item is in the document
|
||||
@@ -12,12 +19,6 @@ test("renders blitz documentation link", () => {
|
||||
// when you remove the the default content from the page
|
||||
|
||||
// This is an example on how to mock api hooks when testing
|
||||
mockUseCurrentUser.mockReturnValue({
|
||||
id: 1,
|
||||
name: "User",
|
||||
email: "user@email.com",
|
||||
role: "user",
|
||||
})
|
||||
|
||||
const {getByText} = render(<Home />)
|
||||
const element = getByText(/powered by blitz/i)
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import {Suspense} from "react"
|
||||
import {Head, Link, useSession, useRouterQuery, useMutation, invoke} from "blitz"
|
||||
import {
|
||||
Head,
|
||||
Link,
|
||||
useSession,
|
||||
useRouterQuery,
|
||||
useMutation,
|
||||
invoke,
|
||||
useQuery,
|
||||
BlitzPage,
|
||||
} from "blitz"
|
||||
import getUser from "app/users/queries/getUser"
|
||||
import trackView from "app/users/mutations/trackView"
|
||||
import Layout from "app/core/layouts/Layout"
|
||||
import {useCurrentUser} from "app/core/hooks/useCurrentUser"
|
||||
// import getUsers from "app/users/queries/getUsers"
|
||||
|
||||
const CurrentUserInfo = () => {
|
||||
const currentUser = useCurrentUser()
|
||||
const session = useSession()
|
||||
const [currentUser] = useQuery(getUser, {where: {id: session.userId!}})
|
||||
|
||||
return <pre>{JSON.stringify(currentUser, null, 2)}</pre>
|
||||
}
|
||||
|
||||
// const Users = () => {
|
||||
// const [users] = useQuery(getUsers, {})
|
||||
//
|
||||
// return <pre style={{maxWidth: "30rem"}}>{JSON.stringify(users, null, 2)}</pre>
|
||||
// }
|
||||
|
||||
const UserStuff = () => {
|
||||
const session = useSession()
|
||||
const query = useRouterQuery()
|
||||
const [trackViewMutation] = useMutation(trackView)
|
||||
|
||||
if (session.isLoading) return <div>Loading...</div>
|
||||
|
||||
return (
|
||||
<div>
|
||||
{!session.userId && (
|
||||
@@ -48,11 +48,6 @@ const UserStuff = () => {
|
||||
<Suspense fallback="Loading...">
|
||||
<CurrentUserInfo />
|
||||
</Suspense>
|
||||
{/*
|
||||
<Suspense fallback="Loading...">
|
||||
<Users />
|
||||
</Suspense>
|
||||
*/}
|
||||
<button
|
||||
onClick={async () => {
|
||||
try {
|
||||
@@ -81,7 +76,7 @@ const UserStuff = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const Home = () => (
|
||||
const Home: BlitzPage = () => (
|
||||
<Layout>
|
||||
<div className="container">
|
||||
<Head>
|
||||
@@ -94,7 +89,9 @@ const Home = () => (
|
||||
<img src="/logo.png" alt="blitz.js" />
|
||||
</div>
|
||||
|
||||
<UserStuff />
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<UserStuff />
|
||||
</Suspense>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
@@ -238,4 +235,6 @@ const Home = () => (
|
||||
</Layout>
|
||||
)
|
||||
|
||||
Home.suppressFirstRenderFlicker = true
|
||||
|
||||
export default Home
|
||||
|
||||
@@ -10,6 +10,8 @@ export const Project = () => {
|
||||
const [deleteProjectMutation, {isSuccess}] = useMutation(deleteProject)
|
||||
const [project] = useQuery(getProject, {id: projectId}, {enabled: !isSuccess})
|
||||
|
||||
if (!project) return null
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
@@ -57,6 +59,7 @@ const ShowProjectPage: BlitzPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
ShowProjectPage.authenticate = true
|
||||
ShowProjectPage.getLayout = (page) => <Layout>{page}</Layout>
|
||||
|
||||
export default ShowProjectPage
|
||||
|
||||
@@ -65,6 +65,7 @@ const EditProjectPage: BlitzPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
EditProjectPage.authenticate = true
|
||||
EditProjectPage.getLayout = (page) => <Layout>{page}</Layout>
|
||||
|
||||
export default EditProjectPage
|
||||
|
||||
@@ -61,6 +61,7 @@ const ProjectsPage: BlitzPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
ProjectsPage.authenticate = {redirectTo: "/login"}
|
||||
ProjectsPage.getLayout = (page) => <Layout>{page}</Layout>
|
||||
|
||||
export default ProjectsPage
|
||||
|
||||
@@ -40,6 +40,7 @@ const NewProjectPage: BlitzPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
NewProjectPage.authenticate = true
|
||||
NewProjectPage.getLayout = (page) => <Layout title={"Create New Project"}>{page}</Layout>
|
||||
|
||||
export default NewProjectPage
|
||||
|
||||
@@ -6,7 +6,7 @@ type GetUserInput = {
|
||||
}
|
||||
|
||||
export default async function getUser({where}: GetUserInput, ctx: Ctx) {
|
||||
ctx.session.$authorize()
|
||||
if (!ctx.session.userId) return null
|
||||
|
||||
const user = await db.user.findFirst({where})
|
||||
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
const {sessionMiddleware, simpleRolesIsAuthorized} = require("@blitzjs/server")
|
||||
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
|
||||
@@ -29,4 +31,5 @@ module.exports = withBundleAnalyzer({
|
||||
return config
|
||||
},
|
||||
*/
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ describe("index page", () => {
|
||||
const user = createRandomUser()
|
||||
|
||||
cy.signup(user)
|
||||
cy.wait(1000)
|
||||
|
||||
cy.location("pathname").should("equal", "/")
|
||||
cy.contains("button", "Logout")
|
||||
@@ -28,9 +29,10 @@ describe("index page", () => {
|
||||
const user = createRandomUser()
|
||||
|
||||
cy.signup(user)
|
||||
cy.wait(1000)
|
||||
|
||||
cy.wait(500)
|
||||
cy.contains("button", "Logout").click()
|
||||
cy.wait(1000)
|
||||
cy.contains("a", /login/i).click()
|
||||
|
||||
cy.contains("Email").find("input").type(user.email)
|
||||
@@ -38,7 +40,7 @@ describe("index page", () => {
|
||||
cy.contains("button", /login/i).click()
|
||||
|
||||
cy.location("pathname").should("equal", "/")
|
||||
cy.wait(500)
|
||||
cy.wait(1000)
|
||||
cy.contains("button", "Logout")
|
||||
})
|
||||
|
||||
@@ -46,6 +48,7 @@ describe("index page", () => {
|
||||
const user = createRandomUser()
|
||||
|
||||
cy.signup(user)
|
||||
cy.wait(1000)
|
||||
|
||||
cy.contains("button", "Logout").click()
|
||||
|
||||
@@ -60,9 +63,11 @@ describe("index page", () => {
|
||||
|
||||
cy.contains("button", "Track view").click()
|
||||
cy.contains("button", "Track view").click()
|
||||
cy.wait(1000)
|
||||
cy.contains('"views": 2')
|
||||
|
||||
cy.signup(user)
|
||||
cy.wait(1000)
|
||||
|
||||
cy.contains('"views": 2')
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@examples/auth",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"scripts": {
|
||||
"dev": "blitz dev",
|
||||
"build": "blitz build",
|
||||
@@ -12,7 +12,7 @@
|
||||
"cy:run": "cypress run || cypress run",
|
||||
"test": "prisma generate && yarn test:jest && yarn test:e2e",
|
||||
"test:jest": "jest",
|
||||
"test:server": "blitz prisma migrate deploy --preview-feature && blitz build && blitz start -p 3099",
|
||||
"test:server": "cross-env NODE_ENV=test blitz prisma migrate deploy --preview-feature && blitz build && cross-env NODE_ENV=test blitz start -p 3099",
|
||||
"test:e2e": "cross-env NODE_ENV=test start-server-and-test test:server http://localhost:3099 cy:run"
|
||||
},
|
||||
"browserslist": [
|
||||
@@ -27,25 +27,14 @@
|
||||
"bracketSpacing": false,
|
||||
"trailingComma": "all"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && pretty-quick --staged",
|
||||
"pre-push": "blitz test"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "2.16.0",
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"@prisma/client": "2.17.0",
|
||||
"blitz": "0.30.7",
|
||||
"final-form": "4.20.1",
|
||||
"passport-auth0": "1.4.0",
|
||||
"passport-github2": "0.1.12",
|
||||
"passport-twitter": "1.0.4",
|
||||
"prisma": "2.16.0",
|
||||
"prisma": "2.17.0",
|
||||
"react": "0.0.0-experimental-3310209d0",
|
||||
"react-dom": "0.0.0-experimental-3310209d0",
|
||||
"react-error-boundary": "3.1.0",
|
||||
@@ -55,8 +44,8 @@
|
||||
"devDependencies": {
|
||||
"@cypress/skip-test": "2.6.0",
|
||||
"@next/bundle-analyzer": "^10.0.6",
|
||||
"@testing-library/react": "11.2.3",
|
||||
"@testing-library/react-hooks": "4.0.1",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/passport-auth0": "1.0.4",
|
||||
"@types/passport-github2": "1.2.4",
|
||||
"@types/passport-twitter": "1.0.36",
|
||||
@@ -65,7 +54,7 @@
|
||||
"cross-env": "7.0.3",
|
||||
"cypress": "6.2.1",
|
||||
"eslint": "7.18.0",
|
||||
"husky": "4.3.8",
|
||||
"husky": "5.1.2",
|
||||
"lint-staged": "10.5.3",
|
||||
"prettier": "2.2.1",
|
||||
"pretty-quick": "3.1.0",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from "react"
|
||||
import {RouterContext, BlitzRouter} from "blitz"
|
||||
import {render as defaultRender} from "@testing-library/react"
|
||||
import {renderHook as defaultRenderHook} from "@testing-library/react-hooks"
|
||||
@@ -67,6 +66,7 @@ export const mockRouter: BlitzRouter = {
|
||||
params: {},
|
||||
query: {},
|
||||
isReady: true,
|
||||
isLocaleDomain: false,
|
||||
push: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
reload: jest.fn(),
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
"jsx": "preserve"
|
||||
},
|
||||
"exclude": ["node_modules", "cypress"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
"include": ["**/*.ts", "**/*.tsx"]
|
||||
}
|
||||
|
||||
1
examples/auth/types
Symbolic link
1
examples/auth/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -12,7 +12,7 @@ declare module "blitz" {
|
||||
isAuthorized: SimpleRolesIsAuthorized<Role>
|
||||
PublicData: {
|
||||
userId: User["id"]
|
||||
roles: Role[]
|
||||
role: Role
|
||||
views?: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export default async function login(input: LoginInputType, {session}: Ctx) {
|
||||
// This throws an error if credentials are invalid
|
||||
const user = await authenticateUser(email, password)
|
||||
|
||||
await session.$create({userId: user.id, roles: [user.role]})
|
||||
await session.$create({userId: user.id})
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default async function signup(input: SignupInputType, {session}: Ctx) {
|
||||
select: {id: true, name: true, email: true, role: true},
|
||||
})
|
||||
|
||||
await session.$create({userId: user.id, roles: [user.role]})
|
||||
await session.$create({userId: user.id})
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import React from "react"
|
||||
import {render} from "test/utils"
|
||||
|
||||
import Home from "./index"
|
||||
import {useCurrentUser} from "app/hooks/useCurrentUser"
|
||||
|
||||
jest.mock("app/hooks/useCurrentUser")
|
||||
const mockUseCurrentUser = useCurrentUser as jest.MockedFunction<typeof useCurrentUser>
|
||||
|
||||
test.skip("renders blitz documentation link", () => {
|
||||
// This is an example of how to ensure a specific item is in the document
|
||||
// But it's disabled by default (by test.skip) so the test doesn't fail
|
||||
// when you remove the the default content from the page
|
||||
|
||||
// This is an example on how to mock api hooks when testing
|
||||
mockUseCurrentUser.mockReturnValue({
|
||||
id: 1,
|
||||
name: "User",
|
||||
email: "user@email.com",
|
||||
role: "user",
|
||||
})
|
||||
|
||||
const {getByText} = render(<Home />)
|
||||
const linkElement = getByText(/Documentation/i)
|
||||
expect(linkElement).toBeInTheDocument()
|
||||
})
|
||||
@@ -1,6 +1,7 @@
|
||||
const {sessionMiddleware, simpleRolesIsAuthorized} = require("@blitzjs/server")
|
||||
const withMonorepoBuildTooling = require("@preconstruct/next")
|
||||
|
||||
module.exports = {
|
||||
module.exports = withMonorepoBuildTooling({
|
||||
middleware: [
|
||||
sessionMiddleware({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
@@ -14,4 +15,4 @@ module.exports = {
|
||||
return config
|
||||
},
|
||||
*/
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@examples/custom-server",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"scripts": {
|
||||
"dev": "nodemon --watch server.js --exec 'blitz dev'",
|
||||
"build": "blitz build",
|
||||
@@ -11,7 +11,7 @@
|
||||
"cy-open": "cypress open",
|
||||
"cy-run": "cypress run",
|
||||
"test:migrate": "prisma generate && blitz prisma migrate deploy --preview-feature",
|
||||
"test:jest": "jest",
|
||||
"test:jest": "jest --passWithNoTests",
|
||||
"test-server": "blitz build && blitz start",
|
||||
"test:e2e": "cross-env NODE_ENV=test PORT=3099 start-server-and-test test-server http://localhost:3099 cy-run",
|
||||
"test": "run-s test:*"
|
||||
@@ -28,25 +28,14 @@
|
||||
"bracketSpacing": false,
|
||||
"trailingComma": "all"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && pretty-quick --staged",
|
||||
"pre-push": "tsc && npm run lint && npm run test"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "2.16.0",
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"@prisma/client": "2.17.0",
|
||||
"blitz": "0.30.7",
|
||||
"final-form": "4.20.1",
|
||||
"prisma": "2.16.0",
|
||||
"prisma": "2.17.0",
|
||||
"react": "0.0.0-experimental-3310209d0",
|
||||
"react-dom": "0.0.0-experimental-3310209d0",
|
||||
"react-error-boundary": "2.3.2",
|
||||
"react-error-boundary": "3.1.0",
|
||||
"react-final-form": "6.5.2",
|
||||
"secure-password": "4.0.0",
|
||||
"typescript": "4.1.3",
|
||||
@@ -54,36 +43,19 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/skip-test": "2.6.0",
|
||||
"@testing-library/jest-dom": "5.11.9",
|
||||
"@testing-library/react": "11.2.3",
|
||||
"@testing-library/react-hooks": "4.0.1",
|
||||
"@types/jest": "26.0.20",
|
||||
"@types/react": "16.14.1",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/react": "17.0.0",
|
||||
"@types/secure-password": "3.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "4.12.0",
|
||||
"@typescript-eslint/parser": "4.12.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"cypress": "6.2.1",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-react-app": "5.2.1",
|
||||
"eslint-plugin-cypress": "2.11.1",
|
||||
"eslint-plugin-flowtype": "5.2.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.21.5",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"husky": "4.3.8",
|
||||
"jest": "26.6.3",
|
||||
"jest-environment-jsdom-fourteen": "1.0.1",
|
||||
"jest-watch-typeahead": "0.6.1",
|
||||
"lint-staged": "10.5.1",
|
||||
"husky": "5.1.2",
|
||||
"lint-staged": "10.5.3",
|
||||
"nodemon": "2.0.7",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.2.0",
|
||||
"prettier": "2.2.1",
|
||||
"pretty-quick": "3.1.0",
|
||||
"react-test-renderer": "16.14.0",
|
||||
"start-server-and-test": "1.11.2",
|
||||
"ts-jest": "26.5.0"
|
||||
"start-server-and-test": "1.11.7"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ export const mockRouter: BlitzRouter = {
|
||||
params: {},
|
||||
query: {},
|
||||
isReady: true,
|
||||
isLocaleDomain: false,
|
||||
push: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
reload: jest.fn(),
|
||||
|
||||
1
examples/custom-server/types
Symbolic link
1
examples/custom-server/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -10,7 +10,6 @@ declare module "blitz" {
|
||||
isAuthorized: typeof simpleRolesIsAuthorized
|
||||
PublicData: {
|
||||
userId: number
|
||||
roles: string[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
save-exact=true
|
||||
legacy-peer-deps=true
|
||||
|
||||
@@ -9,7 +9,7 @@ export default async function login(input: LoginInputType, { session }: Ctx) {
|
||||
// This throws an error if credentials are invalid
|
||||
const user = await authenticateUser(email, password)
|
||||
|
||||
await session.$create({ userId: user.id, roles: [user.role] })
|
||||
await session.$create({ userId: user.id })
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default async function signup(input: SignupInputType, { session }: Ctx) {
|
||||
)
|
||||
console.log("Create user result:", user)
|
||||
|
||||
await session.$create({ userId: user.id, roles: [user.role] })
|
||||
await session.$create({ userId: user.id })
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { sessionMiddleware, simpleRolesIsAuthorized } = require("@blitzjs/server")
|
||||
const withMonorepoBuildTooling = require("@preconstruct/next")
|
||||
const { GraphQLClient, gql } = require("graphql-request")
|
||||
|
||||
const graphQLClient = new GraphQLClient("https://graphql.fauna.com/graphql", {
|
||||
@@ -17,7 +18,7 @@ const normalizeSession = (faunaSession) => {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
module.exports = withMonorepoBuildTooling({
|
||||
middleware: [
|
||||
sessionMiddleware({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
@@ -158,4 +159,4 @@ module.exports = {
|
||||
return config
|
||||
},
|
||||
*/
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@examples/fauna",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"scripts": {
|
||||
"dev": "blitz dev",
|
||||
"build": "blitz build",
|
||||
@@ -28,7 +28,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"blitz": "0.30.7",
|
||||
"final-form": "4.20.1",
|
||||
"graphql": "15.5.0",
|
||||
"graphql-request": "3.4.0",
|
||||
@@ -41,25 +41,25 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "5.11.9",
|
||||
"@testing-library/react": "11.2.3",
|
||||
"@testing-library/react-hooks": "4.0.1",
|
||||
"@types/jest": "26.0.20",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/react": "17.0.0",
|
||||
"@types/secure-password": "3.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "4.12.0",
|
||||
"@typescript-eslint/parser": "4.12.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "~4.14.0",
|
||||
"@typescript-eslint/parser": "~4.14.0",
|
||||
"babel-eslint": "~10.1.0",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-react-app": "6.0.0",
|
||||
"eslint-plugin-flowtype": "5.2.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"husky": "4.3.8",
|
||||
"jest": "26.6.3",
|
||||
"jest-environment-jsdom-fourteen": "1.0.1",
|
||||
"jest-watch-typeahead": "0.6.1",
|
||||
"eslint-config-react-app": "~6.0.0",
|
||||
"eslint-plugin-flowtype": "~5.2.0",
|
||||
"eslint-plugin-import": "~2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "~6.4.1",
|
||||
"eslint-plugin-react": "~7.22.0",
|
||||
"eslint-plugin-react-hooks": "~4.2.0",
|
||||
"husky": "5.1.2",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-jsdom-fourteen": "^1.0.1",
|
||||
"jest-watch-typeahead": "^0.6.1",
|
||||
"lint-staged": "10.5.3",
|
||||
"prettier": "2.2.1",
|
||||
"pretty-quick": "3.1.0",
|
||||
|
||||
@@ -78,6 +78,7 @@ export const mockRouter: BlitzRouter = {
|
||||
params: {},
|
||||
query: {},
|
||||
isReady: true,
|
||||
isLocaleDomain: false,
|
||||
push: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
reload: jest.fn(),
|
||||
|
||||
1
examples/fauna/types
Symbolic link
1
examples/fauna/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -9,7 +9,6 @@ declare module "blitz" {
|
||||
isAuthorized: typeof simpleRolesIsAuthorized
|
||||
PublicData: {
|
||||
userId: string
|
||||
roles: string[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module.exports = {
|
||||
const withMonorepoBuildTooling = require("@preconstruct/next")
|
||||
|
||||
module.exports = withMonorepoBuildTooling({
|
||||
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
|
||||
// Note: we provide webpack above so you should not `require` it
|
||||
// Perform customizations to webpack config
|
||||
@@ -10,4 +12,4 @@ module.exports = {
|
||||
// Important: return the modified config
|
||||
return config
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "no-prisma",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"scripts": {
|
||||
"dev": "blitz dev",
|
||||
"build": "blitz build",
|
||||
@@ -27,7 +27,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"blitz": "0.30.7",
|
||||
"knex": "0.21.16",
|
||||
"react": "0.0.0-experimental-3310209d0",
|
||||
"react-dom": "0.0.0-experimental-3310209d0",
|
||||
@@ -35,17 +35,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "17.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "4.12.0",
|
||||
"@typescript-eslint/parser": "4.12.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "~4.14.0",
|
||||
"@typescript-eslint/parser": "~4.14.0",
|
||||
"babel-eslint": "~10.1.0",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-react-app": "6.0.0",
|
||||
"eslint-plugin-flowtype": "5.2.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"husky": "4.3.8",
|
||||
"eslint-config-react-app": "~6.0.0",
|
||||
"eslint-plugin-flowtype": "~5.2.0",
|
||||
"eslint-plugin-import": "~2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "~6.4.1",
|
||||
"eslint-plugin-react": "~7.22.0",
|
||||
"eslint-plugin-react-hooks": "~4.2.0",
|
||||
"husky": "5.1.2",
|
||||
"lint-staged": "10.5.3",
|
||||
"prettier": "2.2.1",
|
||||
"pretty-quick": "3.1.0",
|
||||
|
||||
1
examples/no-prisma/types
Symbolic link
1
examples/no-prisma/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@examples/plain-js",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"scripts": {
|
||||
"dev": "blitz dev",
|
||||
"build": "blitz prisma migrate deploy --preview-feature && blitz build",
|
||||
@@ -30,24 +30,24 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "2.16.0",
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"prisma": "2.16.0",
|
||||
"@prisma/client": "2.17.0",
|
||||
"blitz": "0.30.7",
|
||||
"prisma": "2.17.0",
|
||||
"react": "0.0.0-experimental-3310209d0",
|
||||
"react-dom": "0.0.0-experimental-3310209d0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "4.12.0",
|
||||
"@typescript-eslint/parser": "4.12.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "~4.14.0",
|
||||
"@typescript-eslint/parser": "~4.14.0",
|
||||
"babel-eslint": "~10.1.0",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-react-app": "6.0.0",
|
||||
"eslint-plugin-flowtype": "5.2.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"husky": "4.3.8",
|
||||
"eslint-config-react-app": "~6.0.0",
|
||||
"eslint-plugin-flowtype": "~5.2.0",
|
||||
"eslint-plugin-import": "~2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "~6.4.1",
|
||||
"eslint-plugin-react": "~7.22.0",
|
||||
"eslint-plugin-react-hooks": "~4.2.0",
|
||||
"husky": "5.1.2",
|
||||
"lint-staged": "10.5.3",
|
||||
"prettier": "2.2.1",
|
||||
"pretty-quick": "3.1.0",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module.exports = {
|
||||
const withMonorepoBuildTooling = require("@preconstruct/next")
|
||||
|
||||
module.exports = withMonorepoBuildTooling({
|
||||
middleware: [
|
||||
(req, res, next) => {
|
||||
res.blitzCtx.referer = req.headers.referer
|
||||
@@ -22,4 +24,4 @@ module.exports = {
|
||||
// // Important: return the modified config
|
||||
// return config
|
||||
// },
|
||||
}
|
||||
})
|
||||
|
||||
@@ -17,33 +17,32 @@ generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------
|
||||
|
||||
model User {
|
||||
id Int @default(autoincrement()) @id
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
email String @unique
|
||||
name String?
|
||||
role String?
|
||||
storeId Int?
|
||||
email String @unique
|
||||
name String?
|
||||
role String?
|
||||
storeId Int?
|
||||
}
|
||||
|
||||
model Product {
|
||||
id Int @default(autoincrement()) @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
handle String @unique
|
||||
name String?
|
||||
description String?
|
||||
price Int?
|
||||
|
||||
variants Variant[]
|
||||
variants Variant[]
|
||||
}
|
||||
|
||||
model Variant {
|
||||
id Int @default(autoincrement()) @id
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@examples/store",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "blitz prisma migrate deploy --preview-feature && blitz build",
|
||||
@@ -20,10 +20,10 @@
|
||||
"trailingComma": "all"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "2.16.0",
|
||||
"blitz": "0.30.0-canary.6",
|
||||
"@prisma/client": "2.17.0",
|
||||
"blitz": "0.30.7",
|
||||
"final-form": "4.20.1",
|
||||
"prisma": "2.16.0",
|
||||
"prisma": "2.17.0",
|
||||
"react": "0.0.0-experimental-3310209d0",
|
||||
"react-dom": "0.0.0-experimental-3310209d0",
|
||||
"react-error-boundary": "3.1.0",
|
||||
@@ -33,7 +33,7 @@
|
||||
"devDependencies": {
|
||||
"@types/react": "17.0.0",
|
||||
"cypress": "6.2.1",
|
||||
"eslint-plugin-cypress": "2.11.2",
|
||||
"eslint-plugin-cypress": "~2.11.2",
|
||||
"sass": "1.32.5",
|
||||
"start-server-and-test": "1.11.7"
|
||||
}
|
||||
|
||||
1
examples/store/types
Symbolic link
1
examples/store/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -1,16 +1,24 @@
|
||||
const {resolveAliases} = require("@blitzjs/config")
|
||||
|
||||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "json"],
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/dist", "<rootDir>/templates"],
|
||||
moduleNameMapper: {
|
||||
...resolveAliases.node,
|
||||
moduleNameMapper: {},
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
||||
transform: {
|
||||
".(ts|tsx)$": require.resolve("ts-jest/dist"),
|
||||
".(js|jsx)$": require.resolve("babel-jest"), // jest's default
|
||||
},
|
||||
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"],
|
||||
testMatch: ["<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}"],
|
||||
testURL: "http://localhost",
|
||||
watchPlugins: [
|
||||
require.resolve("jest-watch-typeahead/filename"),
|
||||
require.resolve("jest-watch-typeahead/testname"),
|
||||
],
|
||||
coverageReporters: ["json", "lcov", "text", "clover"],
|
||||
// collectCoverage: !!`Boolean(process.env.CI)`,
|
||||
collectCoverageFrom: ["src/**/*.ts"],
|
||||
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
|
||||
coveragePathIgnorePatterns: ["/templates/"],
|
||||
// coverageThreshold: {
|
||||
// global: {
|
||||
@@ -20,4 +28,10 @@ module.exports = {
|
||||
// statements: 100,
|
||||
// },
|
||||
// },
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: __dirname + "/tsconfig.test.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"packages": ["packages/*"],
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
|
||||
121
package.json
121
package.json
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "root",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
@@ -12,43 +11,62 @@
|
||||
"**/@prisma/**"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"preconstruct": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"!packages/cli",
|
||||
"!packages/eslint-config"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "npm rebuild husky && patch-package",
|
||||
"predev": "lerna run clean --no-private --stream --parallel",
|
||||
"dev": "lerna run dev --no-private --stream --parallel",
|
||||
"postinstall": "husky install",
|
||||
"dev:tsc": "tsc --watch --pretty --preserveWatchOutput",
|
||||
"dev:cli": "yarn workspace @blitzjs/cli dev",
|
||||
"dev:templates": "yarn workspace @blitzjs/generator dev",
|
||||
"dev": "preconstruct dev && concurrently --names \"typecheck,cli,templates\" -c \"blue,green,yellow,magenta\" -p \"{name}\" \"npm:dev:tsc\" \"npm:dev:cli\" \"npm:dev:templates\"",
|
||||
"build": "cross-env BLITZ_PROD_BUILD=true preconstruct build && ultra -r --filter 'packages/*' buildpkg && tsc",
|
||||
"lint": "eslint --ignore-path .gitignore --ignore-pattern types --ext \".js,.ts,.tsx\" .",
|
||||
"link-cli": "yarn workspace blitz link",
|
||||
"unlink-cli": "yarn workspace blitz unlink",
|
||||
"build": "lerna run build --no-private --stream",
|
||||
"lint": "eslint --ignore-path .gitignore --ext \".js,.ts,.tsx\" .",
|
||||
"test": "yarn run lint && yarn run build && lerna run test --stream",
|
||||
"test": "yarn run lint && yarn run build && ultra -r test",
|
||||
"test:packages": "yarn run build && yarn testonly:packages",
|
||||
"test:examples": "yarn run build && yarn testonly:examples",
|
||||
"testonly": "yarn test:packages && yarn test:examples",
|
||||
"testonly:packages": "lerna run test --scope blitz && lerna run test --stream --scope @blitzjs/*",
|
||||
"testonly:examples": "lerna run test --stream --scope @examples/* --concurrency 1",
|
||||
"testonly:packages": "ultra -r --filter 'packages/*' --concurrency 15 test",
|
||||
"testonly:examples": "ultra -r --filter 'examples/*' --concurrency 1 test",
|
||||
"reset": "rimraf node_modules && git clean -xfd packages && yarn",
|
||||
"publish-prep": "lerna run clean && yarn && yarn build",
|
||||
"prepack": "cpy README.md packages/blitz/",
|
||||
"publish-prep": "yarn && yarn build",
|
||||
"prepack": "cpx README.md packages/blitz/",
|
||||
"postpack": "rimraf packages/blitz/README.md",
|
||||
"publish-local": "yarn workspaces run yalc publish",
|
||||
"publish-canary": "yarn run publish-prep && lerna publish --force-publish --preid canary --pre-dist-tag canary",
|
||||
"publish-latest": "yarn run publish-prep && lerna publish --force-publish",
|
||||
"publish-danger": "lerna publish --canary --pre-dist-tag danger --preid danger.$(git rev-parse --short HEAD) --allow-branch * --force-publish",
|
||||
"danger:push-all": "git push --no-verify && git push --no-verify --tags"
|
||||
"prerelease": "patch-package",
|
||||
"release": "release"
|
||||
},
|
||||
"resolutions-NOTE1": "typescript and ts-jest pinned to here overside tsdx included versions",
|
||||
"resolutions": {
|
||||
"typescript": "4.1.3",
|
||||
"ts-jest": "26.5.0"
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "7.13.1",
|
||||
"@babel/plugin-proposal-class-properties": "7.13.0",
|
||||
"@babel/preset-env": "7.13.5",
|
||||
"@babel/preset-react": "7.12.13",
|
||||
"@babel/preset-typescript": "7.13.0",
|
||||
"@manypkg/cli": "0.17.0",
|
||||
"@preconstruct/cli": "2.0.5",
|
||||
"@preconstruct/next": "2.0.0",
|
||||
"@rollup/pluginutils": "4.1.0",
|
||||
"@size-limit/preset-small-lib": "4.9.2",
|
||||
"@testing-library/jest-dom": "5.11.9",
|
||||
"@testing-library/react": "11.2.3",
|
||||
"@testing-library/react-hooks": "4.0.1",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/b64-lite": "1.3.0",
|
||||
"@types/cookie": "0.4.0",
|
||||
"@types/cookie-session": "2.0.42",
|
||||
@@ -63,21 +81,21 @@
|
||||
"@types/fs-readdir-recursive": "1.0.0",
|
||||
"@types/gulp-if": "0.0.33",
|
||||
"@types/ink-spinner": "3.0.0",
|
||||
"@types/jest": "26.0.20",
|
||||
"@types/module-alias": "2.0.0",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/jsonwebtoken": "8.5.0",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/mem-fs": "1.1.2",
|
||||
"@types/mem-fs-editor": "7.0.0",
|
||||
"@types/merge-stream": "1.1.2",
|
||||
"@types/mock-fs": "4.13.0",
|
||||
"@types/module-alias": "2.0.0",
|
||||
"@types/node": "14.14.22",
|
||||
"@types/node-fetch": "2.5.8",
|
||||
"@types/parallel-transform": "1.1.0",
|
||||
"@types/passport": "1.0.5",
|
||||
"@types/pluralize": "0.0.29",
|
||||
"@types/prettier": "2.1.6",
|
||||
"@types/npm-run": "5.0.0",
|
||||
"@types/progress": "^2.0.3",
|
||||
"@types/pump": "1.1.0",
|
||||
"@types/pumpify": "1.4.1",
|
||||
"@types/react": "17.0.0",
|
||||
@@ -89,35 +107,38 @@
|
||||
"@types/through2": "2.0.36",
|
||||
"@types/vinyl": "2.0.4",
|
||||
"@types/vinyl-fs": "2.4.11",
|
||||
"@typescript-eslint/eslint-plugin": "4.12.0",
|
||||
"@typescript-eslint/parser": "4.12.0",
|
||||
"@typescript-eslint/eslint-plugin": "~4.14.0",
|
||||
"@typescript-eslint/parser": "~4.14.0",
|
||||
"@wessberg/cjs-to-esm-transformer": "0.0.22",
|
||||
"@wessberg/rollup-plugin-ts": "1.3.8",
|
||||
"babel-eslint": "10.x",
|
||||
"babel-eslint": "~10.1.0",
|
||||
"babel-jest": "26.6.3",
|
||||
"concurrently": "5.3.0",
|
||||
"cpy-cli": "3.1.1",
|
||||
"babel-plugin-annotate-pure-calls": "0.4.0",
|
||||
"babel-plugin-dev-expression": "0.2.2",
|
||||
"babel-plugin-macros": "3.0.1",
|
||||
"babel-plugin-transform-inline-environment-variables": "0.4.3",
|
||||
"concurrently": "6.0.0",
|
||||
"cpx": "1.5.0",
|
||||
"cross-env": "7.0.3",
|
||||
"cypress": "6.2.1",
|
||||
"debug": "4.3.1",
|
||||
"delay": "4.4.1",
|
||||
"directory-tree": "2.2.5",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-react-app": "6.0.0",
|
||||
"eslint-config-react-app": "~6.0.0",
|
||||
"eslint-plugin-es": "4.1.0",
|
||||
"eslint-plugin-es5": "1.5.0",
|
||||
"eslint-plugin-flowtype": "5.2.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-flowtype": "~5.2.0",
|
||||
"eslint-plugin-import": "~2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "~6.4.1",
|
||||
"eslint-plugin-prettier": "3.3.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"eslint-plugin-react": "~7.22.0",
|
||||
"eslint-plugin-react-hooks": "~4.2.0",
|
||||
"eslint-plugin-simple-import-sort": "7.0.0",
|
||||
"eslint-plugin-unicorn": "26.0.1",
|
||||
"husky": "4.3.8",
|
||||
"@size-limit/preset-small-lib": "4.9.2",
|
||||
"size-limit": "4.9.2",
|
||||
"jest": "26.6.3",
|
||||
"eslint_d": "10.0.0",
|
||||
"husky": "5.1.2",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-jsdom-sixteen": "1.0.3",
|
||||
"lerna": "3.22.1",
|
||||
"lint-staged": "10.5.3",
|
||||
@@ -132,7 +153,7 @@
|
||||
"prompt": "1.1.0",
|
||||
"react-test-renderer": "17.0.1",
|
||||
"release": "6.3.0",
|
||||
"rimraf": "3.0.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "2.36.1",
|
||||
"rollup-plugin-commonjs": "10.1.0",
|
||||
"rollup-plugin-json": "4.0.0",
|
||||
@@ -140,27 +161,17 @@
|
||||
"rollup-plugin-node-resolve": "5.2.0",
|
||||
"rollup-plugin-peer-deps-external": "2.2.4",
|
||||
"semver": "7.3.4",
|
||||
"size-limit": "4.9.2",
|
||||
"stdout-stderr": "0.1.13",
|
||||
"strip-ansi": "6.0.0",
|
||||
"test-listen": "1.1.0",
|
||||
"ts-jest": "26.5.0",
|
||||
"tsdx": "0.14.1",
|
||||
"tslib": "2.1.0",
|
||||
"typescript": "4.1.3",
|
||||
"ultra-runner": "3.10.5",
|
||||
"wait-on": "5.2.1",
|
||||
"yalc": "1.0.0-pre.49",
|
||||
"eslint_d": "10.0.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && pretty-quick --staged",
|
||||
"pre-push": "yarn lint",
|
||||
"post-rebase": "yarn install"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
"yalc": "1.0.0-pre.49"
|
||||
},
|
||||
"private": true,
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
||||
@@ -1,30 +1,22 @@
|
||||
{
|
||||
"name": "@blitzjs/babel-preset",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {},
|
||||
"module": "dist/blitzjs-babel-preset.esm.js",
|
||||
"main": "dist/blitzjs-babel-preset.cjs.js",
|
||||
"typings": "dist/blitzjs-babel-preset.cjs.d.ts",
|
||||
"author": "Brandon Bayer",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --passWithNoTests",
|
||||
"test:watch": "tsdx test --watch --passWithNoTests",
|
||||
"size": "size-limit",
|
||||
"analyze": "size-limit --why"
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"author": "Brandon Bayer",
|
||||
"module": "dist/babel-preset.esm.js",
|
||||
"size-limit": [
|
||||
{
|
||||
"path": "dist/babel-preset.cjs.production.min.js",
|
||||
@@ -36,6 +28,13 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-plugin-superjson-next": "0.2.1"
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"babel-plugin-superjson-next": "0.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.13.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ if (process.env.INSPECT_BRK === 'true') {
|
||||
}
|
||||
|
||||
try {
|
||||
const cliBin = require.resolve('../dist/cli')
|
||||
const cliBin = require.resolve('../cli/dist/blitz-cli.cjs')
|
||||
const binArgs = process.argv.slice(2)
|
||||
const result = spawn.sync('node', [...nodeOpts, cliBin, ...binArgs], { stdio: 'inherit' })
|
||||
process.exit(result.status)
|
||||
|
||||
4
packages/blitz/cli/package.json
Normal file
4
packages/blitz/cli/package.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "dist/blitz-cli.cjs.js",
|
||||
"module": "dist/blitz-cli.esm.js"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require("path")
|
||||
const {pathsToModuleNameMapper} = require("ts-jest/utils")
|
||||
const {getProjectRoot, resolveAliases} = require("@blitzjs/config")
|
||||
const {getProjectRoot} = require("@blitzjs/config")
|
||||
const projectRoot = getProjectRoot()
|
||||
const {compilerOptions} = require(path.join(projectRoot, "tsconfig"))
|
||||
|
||||
@@ -27,7 +27,6 @@ const common = {
|
||||
// Ignore the build directories
|
||||
modulePathIgnorePatterns: ["<rootDir>/.blitz", "<rootDir>/.next"],
|
||||
moduleNameMapper: {
|
||||
...resolveAliases.node,
|
||||
// This ensures any path aliases in tsconfig also work in jest
|
||||
...pathsToModuleNameMapper(compilerOptions.paths || {}),
|
||||
"\\.(css|less|sass|scss)$": path.resolve(__dirname, "./jest-preset/identity-obj-proxy.js"),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
require("@testing-library/jest-dom")
|
||||
|
||||
jest.setTimeout(10000)
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await global._blitz_prismaClient.$disconnect()
|
||||
|
||||
3
packages/blitz/jest.config.js
Normal file
3
packages/blitz/jest.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
}
|
||||
@@ -1,28 +1,32 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"description": "Blitz is a Rails-like framework for monolithic, full-stack React apps — built on Next.js",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"predev": "wait-on ../core/dist/packages/core/src/index.d.ts && wait-on ../server/dist/packages/server/src/index.d.ts && wait-on ../generator/dist/packages/generator/src/index.d.ts && wait-on ../cli/lib/src/index.js",
|
||||
"dev": "rollup -c rollup.config.js --watch",
|
||||
"build": "rollup -c rollup.config.js",
|
||||
"test": "tsdx test"
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"preconstruct": {
|
||||
"entrypoints": [
|
||||
"index.ts",
|
||||
"cli.ts"
|
||||
]
|
||||
},
|
||||
"bin": {
|
||||
"blitz": "./bin/blitz"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"main": "dist/blitz.cjs.js",
|
||||
"module": "dist/blitz.esm.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"types": "dist/blitz.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"cli",
|
||||
"jest-preset.js",
|
||||
"jest-preset",
|
||||
"babel.js"
|
||||
@@ -43,28 +47,29 @@
|
||||
"url": "https://github.com/blitz-js/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/babel-preset": "0.30.0-canary.6",
|
||||
"@blitzjs/cli": "0.30.0-canary.6",
|
||||
"@blitzjs/config": "0.30.0-canary.6",
|
||||
"@blitzjs/core": "0.30.0-canary.6",
|
||||
"@blitzjs/display": "0.30.0-canary.6",
|
||||
"@blitzjs/generator": "0.30.0-canary.6",
|
||||
"@blitzjs/installer": "0.30.0-canary.6",
|
||||
"@blitzjs/server": "0.30.0-canary.6",
|
||||
"@blitzjs/babel-preset": "0.30.7",
|
||||
"@blitzjs/cli": "0.30.7",
|
||||
"@blitzjs/config": "0.30.7",
|
||||
"@blitzjs/core": "0.30.7",
|
||||
"@blitzjs/display": "0.30.7",
|
||||
"@blitzjs/generator": "0.30.7",
|
||||
"@blitzjs/installer": "0.30.7",
|
||||
"@blitzjs/server": "0.30.7",
|
||||
"@testing-library/jest-dom": "5.11.9",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/jest": "^26.0.20",
|
||||
"chalk": "^4.1.0",
|
||||
"envinfo": "^7.7.3",
|
||||
"eslint-config-blitz": "0.30.0-canary.6",
|
||||
"eslint-config-blitz": "0.30.7",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-jsdom-fourteen": "^1.0.1",
|
||||
"jest-watch-typeahead": "^0.6.1",
|
||||
"os-name": "^4.0.0",
|
||||
"pkg-dir": "^5.0.0",
|
||||
"react-test-renderer": "0.0.0-experimental-3310209d0",
|
||||
"react-test-renderer": "17.0.1",
|
||||
"resolve-from": "^5.0.0",
|
||||
"ts-jest": "^26.4.4"
|
||||
"ts-jest": "26.5.0"
|
||||
},
|
||||
"keywords": [
|
||||
"blitz",
|
||||
|
||||
@@ -2,7 +2,7 @@ import chalk from "chalk"
|
||||
import * as path from "path"
|
||||
import pkgDir from "pkg-dir"
|
||||
import resolveFrom from "resolve-from"
|
||||
import {parseSemver} from "../utils/parse-semver"
|
||||
import {parseSemver} from "./utils/parse-semver"
|
||||
|
||||
async function main() {
|
||||
const options = require("minimist")(process.argv.slice(2))
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
// collectCoverage: !!`Boolean(process.env.CI)`,
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/lib"],
|
||||
testPathIgnorePatterns: ["src/commands/test.ts"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/lib", "<rootDir>/commands/.test"],
|
||||
testPathIgnorePatterns: ["src/commands/test.ts", "test/commands/.test"],
|
||||
testTimeout: 30000,
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "test/tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
{
|
||||
"name": "@blitzjs/cli",
|
||||
"description": "Blitz.js CLI",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"b": "./bin/run",
|
||||
"clean": "rimraf lib",
|
||||
"predev": "yarn wait:installer && yarn wait:server && yarn wait:generator && yarn wait:repl",
|
||||
"wait:generator": "wait-on ../generator/dist/packages/generator/src/index.d.ts",
|
||||
"wait:server": "wait-on ../server/dist/packages/server/src/index.d.ts",
|
||||
"wait:installer": "wait-on ../installer/dist/packages/installer/src/index.d.ts",
|
||||
"wait:repl": "wait-on ../repl/dist/packages/repl/src/index.d.ts",
|
||||
"dev": "rimraf lib && tsc --watch --preserveWatchOutput",
|
||||
"build": "rimraf lib && tsc",
|
||||
"test": "tsdx test",
|
||||
"dev": "rimraf lib && tsc --watch --pretty --preserveWatchOutput",
|
||||
"buildpkg": "rimraf lib && tsc",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"cypress:open": "cypress open",
|
||||
"cypress:run": "cypress run"
|
||||
@@ -32,17 +25,17 @@
|
||||
"/lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/display": "0.30.0-canary.6",
|
||||
"@blitzjs/repl": "0.30.0-canary.6",
|
||||
"@blitzjs/display": "0.30.7",
|
||||
"@blitzjs/repl": "0.30.7",
|
||||
"@oclif/command": "1.8.0",
|
||||
"@oclif/config": "1.17.0",
|
||||
"@oclif/plugin-autocomplete": "0.3.0",
|
||||
"@oclif/plugin-help": "3.2.1",
|
||||
"@oclif/plugin-not-found": "1.2.4",
|
||||
"@prisma/sdk": "2.16.0",
|
||||
"@prisma/sdk": "2.17.0",
|
||||
"@salesforce/lazy-require": "0.4.0",
|
||||
"camelcase": "^6.2.0",
|
||||
"chalk": "4.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"dotenv-flow": "^3.2.0",
|
||||
@@ -64,13 +57,13 @@
|
||||
"v8-compile-cache": "2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/generator": "0.30.0-canary.6",
|
||||
"@blitzjs/installer": "0.30.0-canary.6",
|
||||
"@blitzjs/server": "0.30.0-canary.6",
|
||||
"@blitzjs/generator": "0.30.7",
|
||||
"@blitzjs/installer": "0.30.7",
|
||||
"@blitzjs/server": "0.30.7",
|
||||
"@oclif/dev-cli": "1.26.0",
|
||||
"@oclif/test": "1.2.8",
|
||||
"nock": "13.0.6",
|
||||
"prisma": "2.16.0",
|
||||
"prisma": "2.17.0",
|
||||
"stdout-stderr": "0.1.13"
|
||||
},
|
||||
"jest": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Command, flags} from "@oclif/command"
|
||||
import {build as ServerBuild, ServerConfig} from "@blitzjs/server"
|
||||
import {ServerConfig} from "@blitzjs/server"
|
||||
|
||||
export class Build extends Command {
|
||||
static description = "Creates a production build"
|
||||
@@ -17,7 +17,7 @@ export class Build extends Command {
|
||||
this.parse(Build)
|
||||
|
||||
try {
|
||||
const build: typeof ServerBuild = require("@blitzjs/server").build
|
||||
const {build} = await import("@blitzjs/server")
|
||||
await build(config)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
||||
@@ -37,6 +37,14 @@ export class Dev extends Command {
|
||||
|
||||
try {
|
||||
const dev = (await import("@blitzjs/server")).dev
|
||||
const {getConfig} = await import("@blitzjs/config")
|
||||
|
||||
const blitzConfig = getConfig()
|
||||
if (blitzConfig.cli?.clearConsoleOnBlitzDev !== false) {
|
||||
const {log} = await import("@blitzjs/display")
|
||||
log.clearConsole()
|
||||
}
|
||||
|
||||
await dev(config)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
||||
@@ -140,11 +140,11 @@ export class Generate extends Command {
|
||||
# will generate the proper database model for a Task.`)}
|
||||
> blitz generate model task \\
|
||||
name:string \\
|
||||
completed:boolean:default[false] \\
|
||||
completed:boolean:default=false \\
|
||||
belongsTo:project?
|
||||
> blitz generate all tasks \\
|
||||
name:string \\
|
||||
completed:boolean:default[false] \\
|
||||
completed:boolean:default=false \\
|
||||
belongsTo:project?
|
||||
`,
|
||||
`${chalk.dim(`# Sometimes you want just a single query with no generated
|
||||
|
||||
@@ -84,10 +84,13 @@ export class New extends Command {
|
||||
})
|
||||
|
||||
if (promptUpgrade.upgrade === "yes") {
|
||||
const checkYarn = spawn.sync("yarn", ["global", "list"], {stdio: "pipe"})
|
||||
const useYarn = checkYarn.stdout.toString().includes("blitz@")
|
||||
const upgradeOpts = useYarn ? ["global", "add", "blitz"] : ["i", "-g", "blitz@latest"]
|
||||
var useYarn: boolean = false
|
||||
|
||||
const checkYarn = spawn.sync("yarn", ["global", "list"], {stdio: "pipe"})
|
||||
if (checkYarn && checkYarn.stdout) {
|
||||
useYarn = checkYarn.stdout.toString().includes("blitz@")
|
||||
}
|
||||
const upgradeOpts = useYarn ? ["global", "add", "blitz"] : ["i", "-g", "blitz@latest"]
|
||||
spawn.sync(useYarn ? "yarn" : "npm", upgradeOpts, {stdio: "inherit"})
|
||||
|
||||
const versionResult = spawn.sync("blitz", ["--version"], {stdio: "pipe"})
|
||||
@@ -142,8 +145,9 @@ export class New extends Command {
|
||||
const {"dry-run": dryRun, "skip-install": skipInstall, npm} = flags
|
||||
const needsInstall = dryRun || skipInstall
|
||||
const postInstallSteps = [`cd ${args.name}`]
|
||||
const AppGenerator = require("@blitzjs/generator").AppGenerator
|
||||
|
||||
const generator = new (require("@blitzjs/generator").AppGenerator)({
|
||||
const generator = new AppGenerator({
|
||||
destinationRoot,
|
||||
appName,
|
||||
dryRun,
|
||||
|
||||
@@ -3,10 +3,6 @@ const cacheFile = require("path").join(__dirname, ".blitzjs-cli-cache")
|
||||
const lazyLoad = require("@salesforce/lazy-require").default.create(cacheFile)
|
||||
lazyLoad.start()
|
||||
import {run as oclifRun} from "@oclif/command"
|
||||
import moduleAlias from "module-alias"
|
||||
import {resolveAliases} from "@blitzjs/config"
|
||||
|
||||
moduleAlias.addAliases(resolveAliases.node)
|
||||
|
||||
// Load the .env environment variable so it's available for all commands
|
||||
require("dotenv-expand")(require("dotenv-flow").config({silent: true}))
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"types": ["jest"],
|
||||
"target": "es6"
|
||||
},
|
||||
"references": [{"path": ".."}]
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2015",
|
||||
"lib": ["dom", "dom.iterable", "ES2018"],
|
||||
"rootDir": ".",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"rootDir": ".",
|
||||
"outDir": "lib",
|
||||
"declaration": false,
|
||||
"sourceMap": false,
|
||||
"esModuleInterop": true,
|
||||
"types": [],
|
||||
"isolatedModules": false,
|
||||
"noEmit": false,
|
||||
"lib": ["dom", "dom.iterable", "ES2018"]
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["src/**/*", "types"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": ["src/**/*", "types", "../../types"]
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = {}
|
||||
@@ -1,28 +1,18 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"description": "Loads the blitz app config",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --env=jest-environment-jsdom-sixteen --passWithNoTests",
|
||||
"test:watch": "tsdx test --watch --env=jest-environment-jsdom-sixteen"
|
||||
"test": "jest --passWithNoTests",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"browser": "index-browser.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/config.esm.js",
|
||||
"types": "dist/packages/config/src/index.d.ts",
|
||||
"main": "dist/blitzjs-config.cjs.js",
|
||||
"module": "dist/blitzjs-config.esm.js",
|
||||
"types": "dist/blitzjs-config.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"index-browser.js"
|
||||
"dist"
|
||||
],
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest.setup.js"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"next.config.js",
|
||||
"blitz.config.js",
|
||||
@@ -35,6 +25,8 @@
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922",
|
||||
"dependencies": {
|
||||
"module-alias": "2.2.2"
|
||||
"fs-extra": "^9.1.0",
|
||||
"module-alias": "2.2.2",
|
||||
"pkg-dir": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {readJSONSync} from "fs-extra"
|
||||
import {existsSync, readJSONSync} from "fs-extra"
|
||||
import {join} from "path"
|
||||
import path from "path"
|
||||
import pkgDir from "pkg-dir"
|
||||
@@ -7,26 +7,27 @@ export function getProjectRoot() {
|
||||
return pkgDir.sync() || process.cwd()
|
||||
}
|
||||
|
||||
const projectRoot = getProjectRoot()
|
||||
export function getConfigFilePath() {
|
||||
const projectRoot = getProjectRoot()
|
||||
const bConfig = path.join(projectRoot, "blitz.config.js")
|
||||
const nConfig = path.join(projectRoot, "next.config.js")
|
||||
|
||||
export const resolveAliases = {
|
||||
node: {
|
||||
"__blitz__/config-file": path.join(projectRoot, "blitz.config.js"),
|
||||
},
|
||||
webpack: {
|
||||
// In webpack build, next.config.js is always present which wraps blitz.config.js
|
||||
"__blitz__/config-file": path.join(projectRoot, "next.config.js"),
|
||||
},
|
||||
if (existsSync(nConfig)) {
|
||||
return nConfig
|
||||
} else {
|
||||
return bConfig
|
||||
}
|
||||
}
|
||||
|
||||
require("module-alias").addAliases(resolveAliases.node)
|
||||
|
||||
export interface BlitzConfig extends Record<string, unknown> {
|
||||
target?: string
|
||||
experimental?: {
|
||||
isomorphicResolverImports?: boolean
|
||||
reactMode?: string
|
||||
}
|
||||
cli?: {
|
||||
clearConsoleOnBlitzDev?: boolean
|
||||
}
|
||||
_meta: {
|
||||
packageName: string
|
||||
}
|
||||
@@ -62,7 +63,7 @@ export const getConfig = (reload?: boolean): BlitzConfig => {
|
||||
let loadedConfig = {}
|
||||
try {
|
||||
// eslint-disable-next-line no-eval -- block webpack from following this module path
|
||||
file = eval("require")("__blitz__/config-file")
|
||||
file = eval("require")(getConfigFilePath())
|
||||
if (typeof file === "function") {
|
||||
const phase =
|
||||
process.env.NODE_ENV === "production" ? PHASE_PRODUCTION_SERVER : PHASE_DEVELOPMENT_SERVER
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
module.exports = {
|
||||
rollup(config, options) {
|
||||
config.onwarn = (warning, warn) => {
|
||||
if (warning.code === "EVAL" && /[/\\](index.ts)$/.test(warning.loc.file)) {
|
||||
return
|
||||
}
|
||||
warn(warning)
|
||||
}
|
||||
return config
|
||||
},
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
testEnvironment: "jest-environment-jsdom-sixteen",
|
||||
}
|
||||
|
||||
@@ -1,60 +1,53 @@
|
||||
{
|
||||
"name": "@blitzjs/core",
|
||||
"description": "Blitz.js core functionality",
|
||||
"version": "0.30.0-canary.6",
|
||||
"version": "0.30.7",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"wait:display": "wait-on ../display/dist/packages/display/src/index.d.ts",
|
||||
"predev": "yarn wait:display",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --env=jest-environment-jsdom-sixteen",
|
||||
"test:watch": "tsdx test --watch --env=jest-environment-jsdom-sixteen"
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Michael Edelman",
|
||||
"email": "michael@fabulas.io",
|
||||
"url": "https://twitter.com/edelman215"
|
||||
}
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/core.esm.js",
|
||||
"types": "dist/packages/core/src/index.d.ts",
|
||||
"main": "dist/blitzjs-core.cjs.js",
|
||||
"module": "dist/blitzjs-core.esm.js",
|
||||
"types": "dist/blitzjs-core.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest.setup.js"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/blitz-js/blitz"
|
||||
},
|
||||
"repository": "https://github.com/blitz-js/blitz",
|
||||
"dependencies": {
|
||||
"@blitzjs/display": "0.30.0-canary.6",
|
||||
"@types/htmlescape": "^1.1.1",
|
||||
"@types/secure-password": "3.1.0",
|
||||
"b64-lite": "^1.4.0",
|
||||
"bad-behavior": "^1.0.1",
|
||||
"cookie-session": "^1.4.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"htmlescape": "^1.1.1",
|
||||
"lodash": "^4.17.20",
|
||||
"lodash-es": "^4.17.20",
|
||||
"npm-run": "^5.0.1",
|
||||
"lodash.frompairs": "4.0.1",
|
||||
"npm-which": "^3.0.1",
|
||||
"passport": "0.4.1",
|
||||
"react-query": "2.5.12",
|
||||
"secure-password": "4.0.0",
|
||||
"superjson": "1.6.0",
|
||||
"zod": ">=1.0.0"
|
||||
"superjson": "1.7.2",
|
||||
"zod": "1.11.11"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
|
||||
"peerDependencies": {
|
||||
"@blitzjs/config": "0.30.6",
|
||||
"@blitzjs/display": "0.30.6",
|
||||
"nanoid": "*",
|
||||
"next": "*",
|
||||
"react": ">=0.0.0 || >=0.0.0-experimental"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922",
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "0.30.7",
|
||||
"@blitzjs/display": "0.30.7",
|
||||
"nanoid": "^3.1.20",
|
||||
"next": "10.0.7",
|
||||
"react": "0.0.0-experimental-3310209d0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,97 @@
|
||||
import React from "react"
|
||||
import {AppProps} from "."
|
||||
import React, {ComponentPropsWithoutRef, useEffect} from "react"
|
||||
import {Head} from "./nextjs"
|
||||
import {publicDataStore} from "./public-data-store"
|
||||
import {useAuthorizeIf} from "./supertokens"
|
||||
import {AppProps, BlitzPage} from "./types"
|
||||
|
||||
export function withBlitzAppRoot(WrappedComponent: React.ComponentType<any>) {
|
||||
const BlitzAppRoot = (props: AppProps) => {
|
||||
// props comes afterwards so the can override the default ones.
|
||||
return <WrappedComponent {...(props as any)} />
|
||||
const customCSS = `
|
||||
body::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99999;
|
||||
background-color: white;
|
||||
}
|
||||
BlitzAppRoot.displayName = `BlitzAppRoot`
|
||||
return BlitzAppRoot
|
||||
|
||||
.blitz-first-render-complete body::before {
|
||||
display: none;
|
||||
}
|
||||
`
|
||||
const noscriptCSS = `
|
||||
body::before {
|
||||
content: none
|
||||
}
|
||||
`
|
||||
|
||||
const NoPageFlicker = () => {
|
||||
return (
|
||||
<Head>
|
||||
<style dangerouslySetInnerHTML={{__html: customCSS}} />
|
||||
<noscript>
|
||||
<style dangerouslySetInnerHTML={{__html: noscriptCSS}} />
|
||||
</noscript>
|
||||
</Head>
|
||||
)
|
||||
}
|
||||
|
||||
export function withBlitzInnerWrapper(Page: BlitzPage) {
|
||||
const BlitzInnerRoot = (props: ComponentPropsWithoutRef<BlitzPage>) => {
|
||||
useAuthorizeIf(Page.authenticate === true)
|
||||
|
||||
return <Page {...props} />
|
||||
}
|
||||
for (let [key, value] of Object.entries(Page)) {
|
||||
;(BlitzInnerRoot as any)[key] = value
|
||||
}
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
BlitzInnerRoot.displayName = `BlitzInnerRoot`
|
||||
}
|
||||
return BlitzInnerRoot
|
||||
}
|
||||
|
||||
export function withBlitzAppRoot(UserAppRoot: React.ComponentType<any>) {
|
||||
const BlitzOuterRoot = (props: AppProps) => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (publicDataStore.getData().userId) {
|
||||
if (props.Component.redirectAuthenticatedTo) {
|
||||
window.location.replace(props.Component.redirectAuthenticatedTo)
|
||||
}
|
||||
} else {
|
||||
const authenticate = props.Component.authenticate
|
||||
if (
|
||||
authenticate &&
|
||||
typeof authenticate === "object" &&
|
||||
typeof authenticate.redirectTo === "string"
|
||||
) {
|
||||
const url = new URL(authenticate.redirectTo, window.location.href)
|
||||
url.searchParams.append("next", window.location.pathname)
|
||||
window.location.replace(url.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const noPageFlicker =
|
||||
props.Component.suppressFirstRenderFlicker ||
|
||||
props.Component.authenticate !== undefined ||
|
||||
props.Component.redirectAuthenticatedTo
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.classList.add("blitz-first-render-complete")
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
{noPageFlicker && <NoPageFlicker />}
|
||||
<UserAppRoot {...props} Component={withBlitzInnerWrapper(props.Component)} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
BlitzOuterRoot.displayName = `BlitzOuterRoot`
|
||||
}
|
||||
return BlitzOuterRoot
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ export type BlitzRuntimeData = {
|
||||
export function _getBlitzRuntimeData(): BlitzRuntimeData {
|
||||
const config = getConfig()
|
||||
return {
|
||||
sessionCookiePrefix: config._meta.packageName.replace(/[^a-zA-Z0-9-_]/g, "_"),
|
||||
sessionCookiePrefix: (config._meta.packageName || "blitz").replace(/[^a-zA-Z0-9-_]/g, "_"),
|
||||
suspenseEnabled: config.experimental?.reactMode !== "legacy",
|
||||
}
|
||||
}
|
||||
|
||||
export function getBlitzRuntimeData() {
|
||||
if (isClient && process.env.JEST_WORKER_ID === "undefined") {
|
||||
if (isClient && !process.env.JEST_WORKER_ID) {
|
||||
return window.__BLITZ_DATA__
|
||||
} else {
|
||||
if (!global.__BLITZ_DATA__) {
|
||||
@@ -28,10 +28,8 @@ export function getBlitzRuntimeData() {
|
||||
}
|
||||
|
||||
// Automatically deserialize __BLITZ_DATA__ in a browser environment
|
||||
if (isClient) {
|
||||
if (document.getElementById("__BLITZ_DATA__")) {
|
||||
deserializeAndSetBlitzDataOnWindow()
|
||||
}
|
||||
if (isClient && !process.env.JEST_WORKER_ID) {
|
||||
deserializeAndSetBlitzDataOnWindow()
|
||||
}
|
||||
|
||||
export function deserializeAndSetBlitzDataOnWindow() {
|
||||
@@ -41,7 +39,10 @@ export function deserializeAndSetBlitzDataOnWindow() {
|
||||
)
|
||||
window.__BLITZ_DATA__ = data
|
||||
} catch (e) {
|
||||
console.error("Error deserializing __BLITZ__DATA__", e)
|
||||
console.error(
|
||||
"Error deserializing __BLITZ__DATA__. Make sure you have a custom _document.js/tsx page that uses <BlitzScript/>",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ export const COOKIE_SESSION_TOKEN = () =>
|
||||
export const COOKIE_REFRESH_TOKEN = () =>
|
||||
`${getBlitzRuntimeData().sessionCookiePrefix}_sIdRefreshToken`
|
||||
export const COOKIE_CSRF_TOKEN = () => `${getBlitzRuntimeData().sessionCookiePrefix}_sAntiCsrfToken`
|
||||
// TODO remove before 1.0 -
|
||||
// This is here for legacy compatability (misspelling)
|
||||
export const COOKIE_LEGACY_CSRF_TOKEN = () =>
|
||||
`${getBlitzRuntimeData().sessionCookiePrefix}_sAntiCrfToken`
|
||||
export const COOKIE_PUBLIC_DATA_TOKEN = () =>
|
||||
`${getBlitzRuntimeData().sessionCookiePrefix}_sPublicDataToken`
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SuperJson from "superjson"
|
||||
|
||||
const errorProps = ["message", "code", "meta"]
|
||||
const errorProps = ["name", "message", "code", "statusCode", "meta"]
|
||||
if (process.env.JEST_WORKER_ID === undefined) {
|
||||
SuperJson.allowErrorProps(...errorProps)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {NextComponentType, NextPage, NextPageContext} from "next"
|
||||
import {AppProps as NextAppProps} from "next/app"
|
||||
|
||||
export * from "./nextjs"
|
||||
export * from "./types"
|
||||
export * from "./errors"
|
||||
export * from "./constants"
|
||||
@@ -9,7 +7,8 @@ export {withBlitzAppRoot} from "./blitz-app-root"
|
||||
export {useQuery, usePaginatedQuery, useInfiniteQuery} from "./use-query-hooks"
|
||||
export {getQueryKey, invalidateQuery, setQueryData} from "./utils/react-query-utils"
|
||||
export {useParam, useParams} from "./use-params"
|
||||
export {withRouter, RouterContext, BlitzRouter} from "./with-router"
|
||||
export {withRouter, RouterContext} from "./with-router"
|
||||
export type {BlitzRouter} from "./with-router"
|
||||
export {useRouter} from "./use-router"
|
||||
export {useRouterQuery} from "./use-router-query"
|
||||
export {passportAuth} from "./passport-adapter"
|
||||
@@ -17,62 +16,33 @@ export {getIsomorphicEnhancedResolver} from "./rpc"
|
||||
export {useMutation} from "./use-mutation"
|
||||
export {invoke, invokeWithMiddleware} from "./invoke"
|
||||
export {getBlitzRuntimeData} from "./blitz-data"
|
||||
export {resolver, AuthenticatedMiddlewareCtx} from "./resolver"
|
||||
export {resolver} from "./resolver"
|
||||
export type {AuthenticatedMiddlewareCtx} from "./resolver"
|
||||
export {paginate} from "./server-utils"
|
||||
|
||||
export {
|
||||
getAllMiddlewareForModule,
|
||||
handleRequestWithMiddleware,
|
||||
connectMiddleware,
|
||||
Ctx,
|
||||
DefaultCtx,
|
||||
} from "./middleware"
|
||||
export type {Ctx, DefaultCtx} from "./middleware"
|
||||
export {
|
||||
getAntiCSRFToken,
|
||||
useSession,
|
||||
SessionConfig, // new
|
||||
useAuthenticatedSession,
|
||||
useAuthorize,
|
||||
useRedirectAuthenticated,
|
||||
} from "./supertokens"
|
||||
export type {
|
||||
SessionConfig,
|
||||
SessionContext,
|
||||
AuthenticatedSessionContext,
|
||||
ClientSession,
|
||||
AuthenticatedClientSession,
|
||||
} from "./supertokens"
|
||||
|
||||
export {SecurePassword, hash256, generateToken} from "./auth-utils"
|
||||
|
||||
// --------------------
|
||||
// Exports from Next.js
|
||||
// --------------------
|
||||
export {default as Head} from "next/head"
|
||||
|
||||
export {default as Link, LinkProps} from "next/link"
|
||||
|
||||
export {default as Router} from "next/router"
|
||||
|
||||
export {default as Image, ImageProps} from "next/image"
|
||||
|
||||
export {
|
||||
default as Document,
|
||||
Html,
|
||||
Head as DocumentHead,
|
||||
Main,
|
||||
DocumentContext,
|
||||
DocumentInitialProps,
|
||||
} from "next/document"
|
||||
|
||||
export {default as dynamic} from "next/dynamic"
|
||||
|
||||
export {default as ErrorComponent, ErrorProps} from "next/error"
|
||||
|
||||
export {default as getConfig} from "next/config"
|
||||
|
||||
export type BlitzComponentType<C = NextPageContext, IP = {}, P = {}> = NextComponentType<C, IP, P>
|
||||
|
||||
export interface AppProps<P = {}> extends NextAppProps<P> {
|
||||
Component: BlitzComponentType<NextPageContext, any, P> & {
|
||||
getLayout?: (component: JSX.Element) => JSX.Element
|
||||
}
|
||||
}
|
||||
export type BlitzPage<P = {}, IP = P> = NextPage<P, IP> & {
|
||||
getLayout?: (component: JSX.Element) => JSX.Element
|
||||
}
|
||||
export {isLocalhost} from "./utils/index"
|
||||
export {prettyMs} from "./utils/pretty-ms"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {baseLogger, chalk, log as displayLog} from "@blitzjs/display"
|
||||
import {getAllMiddlewareForModule, handleRequestWithMiddleware} from "./middleware"
|
||||
import {
|
||||
CancellablePromise,
|
||||
EnhancedResolver,
|
||||
EnhancedResolverRpcClient,
|
||||
FirstParam,
|
||||
@@ -13,10 +14,10 @@ import {
|
||||
import {isClient} from "./utils"
|
||||
import {prettyMs} from "./utils/pretty-ms"
|
||||
|
||||
export function invoke<T extends QueryFn, TInput = FirstParam<T>, TResult = PromiseReturnType<T>>(
|
||||
export function invoke<T extends QueryFn, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
) {
|
||||
): CancellablePromise<PromiseReturnType<T>> {
|
||||
if (typeof queryFn === "undefined") {
|
||||
throw new Error(
|
||||
"invoke is missing the first argument - it must be a query or mutation function",
|
||||
@@ -24,10 +25,10 @@ export function invoke<T extends QueryFn, TInput = FirstParam<T>, TResult = Prom
|
||||
}
|
||||
|
||||
if (isClient) {
|
||||
const fn = (queryFn as unknown) as EnhancedResolverRpcClient<TInput, TResult>
|
||||
const fn = (queryFn as unknown) as EnhancedResolverRpcClient<TInput, PromiseReturnType<T>>
|
||||
return fn(params, {fromInvoke: true})
|
||||
} else {
|
||||
const fn = (queryFn as unknown) as EnhancedResolver<TInput, TResult>
|
||||
const fn = (queryFn as unknown) as EnhancedResolver<TInput, PromiseReturnType<T>>
|
||||
return fn(params) as ReturnType<T>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function handleRequestWithMiddleware(
|
||||
} = {},
|
||||
) {
|
||||
if (!(res as MiddlewareResponse).blitzCtx) {
|
||||
;(res as MiddlewareResponse).blitzCtx = {}
|
||||
;(res as MiddlewareResponse).blitzCtx = {} as Ctx
|
||||
}
|
||||
if (!(res as any)._blitz) {
|
||||
;(res as any)._blitz = {}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user