Skip to content

Commit

Permalink
Merge branch 'canary' into 04-29-fix_redirect_to_url_with_semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored May 1, 2024
2 parents 219d674 + 9a5b971 commit 346b86c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/dist/issues/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/dist/prs/index.mjs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions .github/actions/next-repo-info/src/popular-issues.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function generateBlocks(issues) {
type: 'section',
text: {
type: 'mrkdwn',
text: '*A list of the top 15 issues sorted by most :+1: reactions over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-issues.mjs|action> will run every Monday at 10AM UTC (6AM EST)._',
text: '*A list of the top 15 issues sorted by the most reactions over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-issues.mjs|action> will run every Monday at 10AM UTC (6AM EST)._',
},
},
{
Expand All @@ -21,9 +21,9 @@ function generateBlocks(issues) {
let text = ''

issues.forEach((issue, i) => {
text += `${i + 1}. [<${issue.html_url}|#${issue.number}>, :+1: ${
issue.reactions['+1']
}, ${formattedDate(issue.created_at)}]: ${issue.title}\n`
text += `${i + 1}. [<${issue.html_url}|#${issue.number}>, ${
issue.reactions.total_count
} reactions, ${formattedDate(issue.created_at)}]: ${issue.title}\n`
})

blocks.push({
Expand All @@ -50,7 +50,7 @@ async function run() {
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} is:issue is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions-+1',
sort: 'reactions',
})

if (data.items.length > 0) {
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/next-repo-info/src/popular-prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ function generateBlocks(prs) {
]

prs.forEach((pr, i) => {
if (pr.reactions['+1'] > 1) {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, :+1: ${
pr.reactions['+1']
}, ${formattedDate(pr.created_at)}]: ${pr.title}\n`
if (pr.reactions.total_count > 1) {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, ${
pr.reactions.total_count
} reactions, ${formattedDate(pr.created_at)}]: ${pr.title}\n`
count++
}
})
Expand All @@ -27,7 +27,7 @@ function generateBlocks(prs) {
type: 'section',
text: {
type: 'mrkdwn',
text: `*A list of the top ${count} PRs sorted by most :+1: reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-prs.mjs|action> will run every Monday at 10AM UTC (6AM EST)._`,
text: `*A list of the top ${count} PRs sorted by the most reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-prs.mjs|action> will run every Monday at 10AM UTC (6AM EST)._`,
},
})

Expand Down Expand Up @@ -55,7 +55,7 @@ async function run() {
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} -is:draft is:pr is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions-+1',
sort: 'reactions',
})

if (data.items.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Since `usePathname()` is a client hook, you need to extract the nav links into a
import { usePathname } from 'next/navigation'
import Link from 'next/link'

export function Links() {
export function NavLinks() {
const pathname = usePathname()

return (
Expand Down
64 changes: 32 additions & 32 deletions examples/with-turso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

[Turso](https://turso.tech) is a SQLite-compatible database built on libSQL, the Open Contribution fork of SQLite. It enables scaling to hundreds of thousands of databases per organization and supports replication to any location, including your own servers, for microsecond-latency access.

* [Turso Documentation](https://docs.turso.tech)
* [Turso Support](https://discord.com/invite/4B5D7hYwub)
- [Turso Documentation](https://docs.turso.tech)
- [Turso Support](https://discord.com/invite/4B5D7hYwub)

## Features

* Uses SQLite `dev.db` locally
* App Router
* Server Actions
- Uses SQLite `dev.db` locally
- App Router
- Server Actions

## How to use

Expand Down Expand Up @@ -54,52 +54,52 @@ You can deploy this app to Vercel in a few simple steps:

1. **Signup to Turso**

Install the Turso CLI and login using GitHub:
Install the Turso CLI and login using GitHub:

```bash
# macOS
brew install tursodatabase/tap/turso
```bash
# macOS
brew install tursodatabase/tap/turso

# Windows (WSL) & Linux:
# curl -sSfL https://get.tur.so/install.sh | bash
```
# Windows (WSL) & Linux:
# curl -sSfL https://get.tur.so/install.sh | bash
```

2. **Create a database**

Begin by creating your first database:
Begin by creating your first database:

```bash
turso db create [database-name]
```
```bash
turso db create [database-name]
```

3. **Create a table**

Connect to the turso shell and create your first table:
Connect to the turso shell and create your first table:

```bash
turso db shell <database-name>
```
```bash
turso db shell <database-name>
```

```bash
CREATE TABLE todos(id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT NOT NULL)
```
```bash
CREATE TABLE todos(id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT NOT NULL)
```

4. **Retrieve database URL**

You'll need to fetch your database URL and assign it to `TURSO_DB_URL` on deployment:
You'll need to fetch your database URL and assign it to `TURSO_DB_URL` on deployment:

```bash
turso db show <database-name> --url
```
```bash
turso db show <database-name> --url
```

5. **Create database auth token**

Now create an access token and assign it to `TURSO_DB_TOKEN` on deployment:
Now create an access token and assign it to `TURSO_DB_TOKEN` on deployment:

```bash
turso db tokens create <database-name>
```
```bash
turso db tokens create <database-name>
```

6. **Deploy to Vercel**

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgh.neting.cc%2Fvercel%2Fnext.js%2Ftree%2Fcanary%2Fexamples%2Fwith-turso&env=TURSO_DB_URL,TURSO_DB_TOKEN)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgh.neting.cc%2Fvercel%2Fnext.js%2Ftree%2Fcanary%2Fexamples%2Fwith-turso&env=TURSO_DB_URL,TURSO_DB_TOKEN)
5 changes: 2 additions & 3 deletions examples/with-turso/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { TodoList } from './todo-list'
import { TodoList } from "./todo-list";
import { Form } from "./form";

export default function Home() {
return (
<main className="max-w-2xl mx-auto space-y-12 px-6 py-32">

<div className="space-y-3 text-center">
<h1 className="text-3xl font-medium">Turso</h1>
<p className="text-gray-500">Local SQLite with libSQL and Turso</p>
Expand All @@ -14,6 +13,6 @@ export default function Home() {
<TodoList />
<Form />
</div>
</main >
</main>
);
}
10 changes: 7 additions & 3 deletions examples/with-turso/app/todo-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ import { db } from "@/lib/turso";
// The code below can be removed in production apps
// Useful for getting started locally with SQLite
async function findOrCreateTodosTable() {
const result = await db.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='todos'")
const result = await db.execute(
"SELECT name FROM sqlite_master WHERE type='table' AND name='todos'",
);

if (!result || result?.rows?.length === 0) {
await db.execute("CREATE TABLE todos(id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT NOT NULL)")
await db.execute(
"CREATE TABLE todos(id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT NOT NULL)",
);
}
}

export async function TodoList() {
await findOrCreateTodosTable()
await findOrCreateTodosTable();
const result = await db.execute("SELECT * FROM todos");
const rows = result.rows as unknown as TodoItem[];

Expand Down

0 comments on commit 346b86c

Please sign in to comment.