@batijs/cli 0.0.276 → 0.0.277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,16 @@ interface TodoItem {
2
2
  text: string;
3
3
  }
4
4
 
5
- const todos = {
6
- todo: [{ text: "Buy milk" }, { text: "Buy strawberries" }],
7
- };
5
+ const todosDefault = [{ text: "Buy milk" }, { text: "Buy strawberries" }];
6
+
7
+ const database =
8
+ // We create an in-memory database.
9
+ // - We use globalThis so that the database isn't reset upon HMR.
10
+ // - The database is reset when restarting the server, use a proper database (SQLite/PostgreSQL/...) if you want persistent data.
11
+ // biome-ignore lint:
12
+ ((globalThis as unknown as { __database: { todos: TodoItem[] } }).__database ??= { todos: todosDefault });
13
+
14
+ const { todos } = database;
8
15
 
9
16
  export { todos };
10
17
  export type { TodoItem };
@@ -1,10 +1,6 @@
1
1
  interface TodoItem {
2
2
  text: string;
3
3
  }
4
- declare const todos: {
5
- todo: {
6
- text: string;
7
- }[];
8
- };
4
+ declare const todos: TodoItem[];
9
5
  export { todos };
10
6
  export type { TodoItem };
@@ -1,5 +1,3 @@
1
- // Put global types here
2
-
3
1
  import { dbD1, dbSqlite } from "@batijs/drizzle/database/drizzle/db";
4
2
  import { db as sqliteDb } from "@batijs/sqlite/database/sqlite/db";
5
3
  import { D1Database } from "@cloudflare/workers-types";
@@ -23,6 +23,6 @@ export default async function data(_pageContext: PageContextServer): Promise<Dat
23
23
 
24
24
  return { todo };
25
25
  } else {
26
- return todos;
26
+ return { todo: todos };
27
27
  }
28
28
  }
@@ -17,6 +17,6 @@ export async function onNewTodo({ text }: { text: string }) {
17
17
  const context = getContext();
18
18
  await d1Queries.insertTodo(context.db, text);
19
19
  } else {
20
- todos.todo.push({ text });
20
+ todos.push({ text });
21
21
  }
22
22
  }
package/dist/index.js CHANGED
@@ -1677,7 +1677,7 @@ var createDefaultQueryTester = function(query, options) {
1677
1677
  // package.json
1678
1678
  var package_default = {
1679
1679
  name: "@batijs/cli",
1680
- version: "0.0.276",
1680
+ version: "0.0.277",
1681
1681
  type: "module",
1682
1682
  scripts: {
1683
1683
  "check-types": "tsc --noEmit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.276",
3
+ "version": "0.0.277",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -20,12 +20,12 @@
20
20
  "typescript": "^5.6.2",
21
21
  "unplugin-purge-polyfills": "^0.0.5",
22
22
  "vite": "^5.4.5",
23
- "@batijs/build": "0.0.276",
24
- "@batijs/compile": "0.0.276"
23
+ "@batijs/compile": "0.0.277",
24
+ "@batijs/build": "0.0.277"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/core": "0.0.276",
28
- "@batijs/features": "0.0.276"
27
+ "@batijs/features": "0.0.277",
28
+ "@batijs/core": "0.0.277"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {