Skip to content

Commit

Permalink
chore: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Dec 13, 2023
1 parent 50f00e5 commit ce44a33
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,21 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: "pnpm install"
- name: Build step
run: "pnpm i && npx nuxt build --preset=deno_deploy"
run: "npx nuxt build --preset=deno_deploy"
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
- name: Upload to Deno Deploy
Expand Down
2 changes: 2 additions & 0 deletions server/api/[listId]/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ async function listTodos(kv: Kv, listId: string) {
const iter = await kv.list({ prefix: ['list', listId] }, { consistency: 'strong' })
const todos = []
for await (const todo of iter) todos.push(todo.value)

todos.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt))
return todos
}

Expand Down
4 changes: 4 additions & 0 deletions server/utils/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ export const useKv = async () => {
const { openKv } = await OpenKV()
return openKv('kv.db')
}
throw createError({
statusCode: 500,
message: 'Could not find a Deno KV for production, make sure to deploy on Deno Deploy.'
})
}

0 comments on commit ce44a33

Please sign in to comment.