Skip to content

Commit ce44a33

Browse files
committed
chore: improvements
1 parent 50f00e5 commit ce44a33

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

‎.github/workflows/deploy.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ jobs:
2626
uses: pnpm/action-setup@v2
2727
with:
2828
version: 8
29+
- name: Get pnpm store directory
30+
shell: bash
31+
run: |
32+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33+
- uses: actions/cache@v3
34+
name: Setup pnpm cache
35+
with:
36+
path: ${{ env.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
40+
- name: Install dependencies
41+
run: "pnpm install"
2942
- name: Build step
30-
run: "pnpm i && npx nuxt build --preset=deno_deploy"
43+
run: "npx nuxt build --preset=deno_deploy"
3144
env:
3245
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
3346
- name: Upload to Deno Deploy

‎server/api/[listId]/index.get.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ async function listTodos(kv: Kv, listId: string) {
55
const iter = await kv.list({ prefix: ['list', listId] }, { consistency: 'strong' })
66
const todos = []
77
for await (const todo of iter) todos.push(todo.value)
8+
9+
todos.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt))
810
return todos
911
}
1012

‎server/utils/kv.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ export const useKv = async () => {
77
const { openKv } = await OpenKV()
88
return openKv('kv.db')
99
}
10+
throw createError({
11+
statusCode: 500,
12+
message: 'Could not find a Deno KV for production, make sure to deploy on Deno Deploy.'
13+
})
1014
}

0 commit comments

Comments
 (0)