Skip to content

Commit

Permalink
Add the blitz package and proper global/local CLI handling (#128)
Browse files Browse the repository at this point in the history
* add the `blitz` package (but yarn blitz start not working)

* wip

* working

* updates

* cleanup

* adjustment

* chore: make 'blitz' work (#129)

* chore: make 'blitz' work

* fix: make example work in dev mode with blitz mono-package

* test: skip failing test re patched version of next

* fix: issues re bundling & store example

* fix blitz building in development and some other cleanup

* fixes for CLI usage from blitz

* more changes. blitz build still broken from child_process thing

* remove .yarnrc

* few DX fixes

* fix bug in store example

* fix the build and CLI!

* code comments

* delete vanilla-next

* fix tests

* fix tests

* fix CI tests

* remove server export from `blitz` since end-users don't use it

* move README into the Blitz package

* add link-cli script

* change prisma resolve to use resolveBinAsync

Co-authored-by: Michael Edelman <[email protected]>
  • Loading branch information
flybayer and Michael Edelman authored Apr 20, 2020
1 parent cf94dc8 commit e891273
Show file tree
Hide file tree
Showing 53 changed files with 1,987 additions and 782 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
"packages/blitz/README.md"
],
"badgeTemplate": "<a aria-label=\"All Contributors\" href=\"#contributors-\"><img alt=\"\" src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>-17BB8A.svg?style=for-the-badge&labelColor=000000\"></a>",
"imageSize": 100,
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
run: yarn install --frozen-lockfile --silent
env:
CI: true
- name: Build Blitz Packages
run: yarn build
env:
CI: true
- name: Test Blitz Packages
run: yarn test
env:
Expand Down
16 changes: 14 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The Blitzjs.com website and documentation repo also has issues with [`ready to w
- Improved logging (i.e. more clear, more beautiful)
- Educational content like blogs, videos, courses

If there's some other way you'd like to contribute, just ask us about it in slack!
If there's some other way you'd like to contribute, just ask us about it in slack!

After you contribute in any way, please add yourself as a contributor via the [@all-contributors bot](https://allcontributors.org/docs/en/bot/usage)!

Expand Down Expand Up @@ -69,6 +69,15 @@ yarn
yarn dev
```

#### Link the Blitz CLI (Optional)

The following will link the development CLI as a local binary so you can use it anywhere for testing.

```
yarn link-cli
// `yarn unlink-cli` will unlink
```

#### Develop a Blitz `package`

**1.** Change to a package directory
Expand All @@ -85,11 +94,14 @@ yarn test:watch

#### Develop a Blitz `example`


**1.** Change to an example directory

```
cd examples/store
```

**2.** Follow instructions in the example's README

## Troubleshooting

If you run into issues that should be documented here, please submit a PR! ❤️
149 changes: 0 additions & 149 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
1 change: 1 addition & 0 deletions examples/store/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/out/
/.blitz/
*.sqlite
.generated-prisma-client

# production
/build
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/admin/pages/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link} from '@blitzjs/core'
import {Link} from 'blitz'

export default function () {
return (
Expand Down
4 changes: 2 additions & 2 deletions examples/store/app/admin/pages/admin/products/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Suspense} from 'react'
import {Link, useRouter, useQuery} from '@blitzjs/core'
import {Link, useRouter, useQuery} from 'blitz'
import getProduct from 'app/products/queries/getProduct'
import ProductForm from 'app/products/components/ProductForm'

function Product() {
const router = useRouter()
const id = parseInt(router.query.id as string)
const id = parseInt(router?.query.id as string)
const [product] = useQuery(getProduct, {where: {id}})

return <ProductForm product={product} onSuccess={() => router.push('/admin/products')} />
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/admin/pages/admin/products/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Suspense} from 'react'
import {useQuery, Link} from '@blitzjs/core'
import {useQuery, Link} from 'blitz'
import getProducts from 'app/products/queries/getProducts'

function ProductsList() {
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/admin/pages/admin/products/new.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link, useRouter} from '@blitzjs/core'
import {Link, useRouter} from 'blitz'
import ProductForm from 'app/products/components/ProductForm'

export default function () {
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Head, Link} from '@blitzjs/core'
import {Head, Link} from 'blitz'

const Home = () => (
<div className="container">
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/products/pages/products/[handle].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link, BlitzPage, GetStaticProps, GetStaticPaths} from '@blitzjs/core'
import {Link, BlitzPage, GetStaticProps, GetStaticPaths} from 'blitz'
import getProduct from 'app/products/queries/getProduct'
import getProducts from 'app/products/queries/getProducts'
import {Product} from 'db'
Expand Down
2 changes: 1 addition & 1 deletion examples/store/app/products/pages/products/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link, BlitzPage, GetStaticProps} from '@blitzjs/core'
import {Link, BlitzPage, GetStaticProps} from 'blitz'
import getProducts from 'app/products/queries/getProducts'
import {Product} from 'db'

Expand Down
7 changes: 3 additions & 4 deletions examples/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"build": "blitz db migrate && blitz build"
},
"dependencies": {
"@blitzjs/cli": "0.0.2-canary.1.2",
"@blitzjs/core": "0.0.2-canary.1",
"@blitzjs/server": "0.0.2-canary.1.4",
"blitz": "0.0.2-canary.0",
"@prisma/cli": "2.0.0-beta.2",
"@prisma/client": "2.0.0-beta.2",
"final-form": "4.19.1",
Expand All @@ -17,8 +15,9 @@
"react-final-form": "6.4.0",
"typescript": "3.8.3"
},
"NOTE": "Next.js dependency is only required for deploying to zeit, for now",
"NOTE": "Next.js dependency is currently only required for deploying to zeit",
"devDependencies": {
"@types/react": "16.9.34",
"next": "9.3.4"
}
}
4 changes: 0 additions & 4 deletions examples/vanilla-next/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion examples/vanilla-next/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions examples/vanilla-next/app/posts/controller.ts

This file was deleted.

2 changes: 0 additions & 2 deletions examples/vanilla-next/next-env.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions examples/vanilla-next/next.config.js

This file was deleted.

20 changes: 0 additions & 20 deletions examples/vanilla-next/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions examples/vanilla-next/pages/index.tsx

This file was deleted.

Loading

0 comments on commit e891273

Please sign in to comment.