create-guren-app 1.1.0 → 1.2.0

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.
package/dist/cli.js CHANGED
@@ -1847,10 +1847,22 @@ export const { getDatabase, migrateDatabase, closeDatabase, configureOrm, seedDa
1847
1847
  }
1848
1848
  return `import { createSqliteDatabase } from '@guren/orm'
1849
1849
 
1850
+ // \`bun test\` sets NODE_ENV=test automatically, so the test suite reads and
1851
+ // writes a separate SQLite file and never touches the development database \u2014
1852
+ // this takes priority over DATABASE_URL, which .env sets unconditionally.
1853
+ // Override the test DB path itself with TEST_DATABASE_URL if needed (e.g. to
1854
+ // shard parallel CI runs); DATABASE_URL is still authoritative outside tests.
1855
+ function resolveDatabaseFilename(): string {
1856
+ if (process.env.NODE_ENV === 'test') {
1857
+ return process.env.TEST_DATABASE_URL ?? './data/guren.test.db'
1858
+ }
1859
+ return process.env.DATABASE_URL ?? '${url}'
1860
+ }
1861
+
1850
1862
  const database = createSqliteDatabase({
1851
1863
  migrationsFolder: new URL('../db/migrations', import.meta.url),
1852
1864
  seedersFolder: new URL('../db/seeders', import.meta.url),
1853
- filename: () => process.env.DATABASE_URL ?? '${url}',
1865
+ filename: resolveDatabaseFilename,
1854
1866
  })
1855
1867
 
1856
1868
  export const { getDatabase, migrateDatabase, closeDatabase, configureOrm, seedDatabase, resetDatabase, migrationStatus } = database
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-guren-app",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,6 +7,9 @@ APP_URL=http://localhost:3333
7
7
  PORT=3333
8
8
  HOST=0.0.0.0
9
9
 
10
+ # bun test automatically sets NODE_ENV=test, which points the app at
11
+ # ./data/guren.test.db instead — this line is only used outside tests.
12
+ # Override the test DB path itself with TEST_DATABASE_URL if you need to.
10
13
  DATABASE_URL=./data/guren.db
11
14
 
12
15
  REDIS_URL=
@@ -1,9 +1,21 @@
1
1
  import { createSqliteDatabase } from '@guren/orm'
2
2
 
3
+ // `bun test` sets NODE_ENV=test automatically, so the test suite reads and
4
+ // writes a separate SQLite file and never touches the development database —
5
+ // this takes priority over DATABASE_URL, which .env sets unconditionally.
6
+ // Override the test DB path itself with TEST_DATABASE_URL if needed (e.g. to
7
+ // shard parallel CI runs); DATABASE_URL is still authoritative outside tests.
8
+ function resolveDatabaseFilename(): string {
9
+ if (process.env.NODE_ENV === 'test') {
10
+ return process.env.TEST_DATABASE_URL ?? './data/guren.test.db'
11
+ }
12
+ return process.env.DATABASE_URL ?? './data/guren.db'
13
+ }
14
+
3
15
  const database = createSqliteDatabase({
4
16
  migrationsFolder: new URL('../db/migrations', import.meta.url),
5
17
  seedersFolder: new URL('../db/seeders', import.meta.url),
6
- filename: () => process.env.DATABASE_URL ?? './data/guren.db',
18
+ filename: resolveDatabaseFilename,
7
19
  })
8
20
 
9
21
  export const { getDatabase, migrateDatabase, closeDatabase, configureOrm, seedDatabase, resetDatabase, migrationStatus } = database
@@ -23,6 +23,7 @@
23
23
  "drizzle-orm": "1.0.0-rc.4"
24
24
  },
25
25
  "devDependencies": {
26
+ "@guren/testing": "^1.0.0",
26
27
  "bun-types": "^1.3.1",
27
28
  "drizzle-kit": "1.0.0-rc.4",
28
29
  "mysql2": "^3.11.3",
@@ -7,6 +7,9 @@ APP_URL=http://localhost:3333
7
7
  PORT=3333
8
8
  HOST=0.0.0.0
9
9
 
10
+ # bun test automatically sets NODE_ENV=test, which points the app at
11
+ # ./data/guren.test.db instead — this line is only used outside tests.
12
+ # Override the test DB path itself with TEST_DATABASE_URL if you need to.
10
13
  DATABASE_URL=./data/guren.db
11
14
 
12
15
  REDIS_URL=
@@ -1,9 +1,21 @@
1
1
  import { createSqliteDatabase } from '@guren/orm'
2
2
 
3
+ // `bun test` sets NODE_ENV=test automatically, so the test suite reads and
4
+ // writes a separate SQLite file and never touches the development database —
5
+ // this takes priority over DATABASE_URL, which .env sets unconditionally.
6
+ // Override the test DB path itself with TEST_DATABASE_URL if needed (e.g. to
7
+ // shard parallel CI runs); DATABASE_URL is still authoritative outside tests.
8
+ function resolveDatabaseFilename(): string {
9
+ if (process.env.NODE_ENV === 'test') {
10
+ return process.env.TEST_DATABASE_URL ?? './data/guren.test.db'
11
+ }
12
+ return process.env.DATABASE_URL ?? './data/guren.db'
13
+ }
14
+
3
15
  const database = createSqliteDatabase({
4
16
  migrationsFolder: new URL('../db/migrations', import.meta.url),
5
17
  seedersFolder: new URL('../db/seeders', import.meta.url),
6
- filename: () => process.env.DATABASE_URL ?? './data/guren.db',
18
+ filename: resolveDatabaseFilename,
7
19
  })
8
20
 
9
21
  export const { getDatabase, migrateDatabase, closeDatabase, configureOrm, seedDatabase, resetDatabase, migrationStatus } = database
@@ -28,6 +28,7 @@
28
28
  "zod": "^4.4.3"
29
29
  },
30
30
  "devDependencies": {
31
+ "@guren/testing": "^1.0.0",
31
32
  "@types/react": "^19.0.0",
32
33
  "@types/react-dom": "^19.0.0",
33
34
  "bun-types": "^1.3.1",