Repository navigation
feat: remove @astrojs/db
#17010
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
feat: remove @astrojs/db
#17010
Changes from all commits
c68f649
bcaa406
6eb4700
7b0794b
d93af06
f1375e3
e173e16
94df546
eb79124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
| '@astrojs/mdx': major | ||
| '@astrojs/vue': major | ||
| 'astro': major | ||
| '@astrojs/db': major | ||
| --- | ||
|
|
||
| Upgrade to Vite v8 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'astro': major | ||
| --- | ||
|
|
||
| Removes the `astro db`, `astro login`, `astro logout`, `astro link`, and `astro init` CLI commands. | ||
|
|
||
| The `@astrojs/db` package is now deprecated. We recommend using a database client (Drizzle, Kysely, etc.) directly instead. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,6 @@ | |
| "@flue/runtime": "^0.8.0", | ||
| "@types/node": "^22.10.6", | ||
| "bgproc": "^0.2.0", | ||
| "esbuild": "0.25.5", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "eslint": "^10.4.0", | ||
| "eslint-plugin-regexp": "^3.1.0", | ||
| "knip": "5.82.1", | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Tiny file-backed store for the demo actions. State is read from and written to a | ||
| // JSON file on disk, so it is shared across every module instance the dev server | ||
| // evaluates (the page render and the action handler run in separate module graphs), | ||
| // the same way the previous SQLite-backed store was. The e2e tests reset it between | ||
| // runs by deleting `./temp/` (see the `afterEach` in actions-blog.test.ts). | ||
| import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; | ||
|
|
||
| export interface Comment { | ||
| postId: string; | ||
| author: string; | ||
| body: string; | ||
| } | ||
|
|
||
| interface Data { | ||
| likes: Record<string, number>; | ||
| comments: Comment[]; | ||
| } | ||
|
|
||
| const file = new URL('./temp/store.json', import.meta.url); | ||
|
|
||
| function read(): Data { | ||
| if (!existsSync(file)) { | ||
| return { | ||
| likes: { 'first-post': 10 }, | ||
| comments: [{ postId: 'first-post', author: 'Alice', body: 'Great post!' }], | ||
| }; | ||
| } | ||
| return JSON.parse(readFileSync(file, 'utf-8')); | ||
| } | ||
|
|
||
| function write(data: Data): void { | ||
| mkdirSync(new URL('./temp/', import.meta.url), { recursive: true }); | ||
| writeFileSync(file, JSON.stringify(data)); | ||
| } | ||
|
|
||
| export function getLikes(postId: string): number { | ||
| return read().likes[postId] ?? 0; | ||
| } | ||
|
|
||
| export function incrementLikes(postId: string): number { | ||
| const data = read(); | ||
| data.likes[postId] = (data.likes[postId] ?? 0) + 1; | ||
| write(data); | ||
| return data.likes[postId]; | ||
| } | ||
|
|
||
| export function getComments(postId: string): Comment[] { | ||
| return read().comments.filter((comment) => comment.postId === postId); | ||
| } | ||
|
|
||
| export function addComment(comment: Comment): Comment { | ||
| const data = read(); | ||
| data.comments.push(comment); | ||
| write(data); | ||
| return comment; | ||
| } |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd say first that
@astrojs/dbis removed: the CLI commands are only a consequence. When scanning, people might pay more attention to the first line.And because this is a breaking change that can affect a lot of people, I would have been a bit more verbose to bring attention this is something big.
Something like: