Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix deploy button in with-xata example #43608

Merged
merged 3 commits into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions examples/with-xata/README.md
Expand Up @@ -14,7 +14,7 @@ With this template you get out-of-the-box:

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-xata)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-xata&project-name=with-xata&repository-name=with-xata)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-xata&project-name=with-xata&repository-name=with-xata&integration-ids=oac_IDpMECDuYqBvAtu3wXXMQe0J)

## Demo

Expand All @@ -36,15 +36,21 @@ yarn create next-app --example with-xata with-xata-app
pnpm create next-app --example with-xata with-xata-app
```

### Link Your Xata Workspace and Run Codegen
### Link With Your Xata Workspace And Update Types

> 💡 consider [installing the Xata CLI globally](https://xata.io/docs/cli/getting-started), it will likely improve your experience managing your databases
> 💡 We recommend installing the [Xata CLI](https://xata.io/docs/cli/getting-started) globally, but you can also use `npx @xata.io/cli` instead of `xata` in the commands below.

You can link your project with a Xata workspace by running the following command:

```sh
npm run start:xata
xata init
```

> ⚠️ once linked, you can just run `xata` to re-generate types.
To update your types, run the following command:

```sh
xata codegen
```

### Start Coding

Expand Down
18 changes: 8 additions & 10 deletions examples/with-xata/package.json
Expand Up @@ -4,21 +4,19 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"start:xata": "xata init --schema=schema.template.json --codegen=utils/xata.codegen.ts",
"poststart:xata": "xata codegen",
"xata": "xata codegen"
"xata": "xata codegen",
"postinstall": "npx @xata.io/cli@latest schema upload schema.template.json --branch main --create-only --yes"
},
"devDependencies": {
"@types/node": "18.6.5",
"@types/react": "18.0.17",
"@types/react-dom": "18.0.6",
"@xata.io/cli": "0.8.1",
"eslint": "8.21.0",
"@types/node": "18.11.10",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"eslint": "8.28.0",
"eslint-config-next": "latest",
"typescript": "4.7.4"
"typescript": "4.9.3"
},
"dependencies": {
"@xata.io/client": "^0.16.1",
"@xata.io/client": "^0.21.3",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/with-xata/pages/index.tsx
Expand Up @@ -31,7 +31,7 @@ export default function IndexPage({
return (
<main>
<header>
<Image src={xatafly} priority />
<Image src={xatafly} alt={'Xata'} priority />
<h1>
Next.js with<span aria-hidden>&#8209;</span>xata
</h1>
Expand Down
1 change: 0 additions & 1 deletion examples/with-xata/schema.template.json
@@ -1,5 +1,4 @@
{
"formatVersion": "",
"tables": [
{
"name": "nextjs_with_xata_example",
Expand Down
4 changes: 1 addition & 3 deletions examples/with-xata/utils/xata.codegen.ts
Expand Up @@ -24,9 +24,7 @@ export type NextjsWithXataExampleRecord = NextjsWithXataExample & XataRecord

const DatabaseClient = buildClient()

const defaultOptions = {
databaseURL: 'https://xata-uq2d57.xata.sh/db/examples',
}
const defaultOptions = {}

export class XataClient extends DatabaseClient<SchemaTables> {
constructor(options?: BaseClientOptions) {
Expand Down