create-guren-app 1.6.2 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-guren-app",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,13 +18,13 @@
18
18
  "test": "bun test"
19
19
  },
20
20
  "dependencies": {
21
- "@guren/cli": "^2.2.0",
22
- "@guren/core": "^1.5.1",
23
- "@guren/orm": "^2.2.0",
21
+ "@guren/cli": "^2.3.0",
22
+ "@guren/core": "^1.5.2",
23
+ "@guren/orm": "^2.2.1",
24
24
  "drizzle-orm": "1.0.0-rc.4"
25
25
  },
26
26
  "devDependencies": {
27
- "@guren/testing": "^1.3.0",
27
+ "@guren/testing": "^1.4.0",
28
28
  "bun-types": "^1.3.1",
29
29
  "drizzle-kit": "1.0.0-rc.4",
30
30
  "typescript": "^5.4.0"
@@ -19,7 +19,7 @@ setInertiaDocument({
19
19
  // and stopping the app from booting at all. Emailed links do not depend on this
20
20
  // — app/Auth/AppUrl.ts resolves those per request and fails closed there.
21
21
  function hostAuthorization() {
22
- const exclude = ['/healthcheck', '/up']
22
+ const exclude = ['/health']
23
23
 
24
24
  if (process.env.NODE_ENV !== 'production') {
25
25
  return { allowedHosts: ['localhost:*', '127.0.0.1:*'], exclude }
@@ -40,6 +40,10 @@ const app = createApp({
40
40
  auth: {},
41
41
  routes: registerWebRoutes,
42
42
  providers: [DatabaseProvider, AuthProvider, AuthorizationProvider],
43
+ // Translations live in lang/<locale>/*.json. Add locales to `supported`
44
+ // and the request locale is detected from ?locale=, a locale cookie, or
45
+ // Accept-Language. `guren codegen` types the keys for t()/useTranslation().
46
+ i18n: { supported: ['en'] },
43
47
  hostAuthorization: hostAuthorization(),
44
48
  })
45
49
 
@@ -1,19 +1,21 @@
1
- import { describe, it } from 'bun:test'
1
+ import { beforeAll, describe, it } from 'bun:test'
2
2
  import { TestApp } from '@guren/testing'
3
- import DatabaseProvider from '../app/Providers/DatabaseProvider.js'
4
- import { registerWebRoutes } from '../routes/web.js'
3
+ import app from '../src/app.js'
5
4
 
6
- // The blog home page reads posts from the database, so exercising it here
7
- // would need migrations and fixtures — the golden-path flow already covers
8
- // it end to end. This starter test keeps `bun test` green out of the box;
5
+ // Boots the real src/app.ts so tests share its configuration. The blog
6
+ // home page reads posts from the database, so exercising it here would
7
+ // need migrations and fixtures — the golden-path flow already covers it
8
+ // end to end. This starter test keeps `bun test` green out of the box;
9
9
  // replace it with real feature tests as you build.
10
10
  describe('app', () => {
11
- it('answers the health check', async () => {
12
- const app = await TestApp.create({
13
- routes: registerWebRoutes,
14
- providers: [DatabaseProvider],
15
- })
11
+ let http: TestApp
12
+
13
+ beforeAll(async () => {
14
+ await app.boot()
15
+ http = TestApp.fromFetch((request) => app.fetch(request))
16
+ })
16
17
 
17
- await app.get('/health').assertOk()
18
+ it('answers the health check', async () => {
19
+ await http.get('/health').assertOk()
18
20
  })
19
21
  })
@@ -4,7 +4,8 @@ import { pages } from '@/.guren/pages.gen'
4
4
  export default class HomeController extends Controller {
5
5
  async index(): Promise<Response> {
6
6
  const props = {
7
- message: 'Welcome to __APP_TITLE__!',
7
+ // Message text lives in lang/en/messages.json (key typed by codegen).
8
+ message: this.t('messages.welcome', { name: '__APP_TITLE__' }),
8
9
  }
9
10
 
10
11
  return this.inertia(pages.Home, props, { url: this.request.path, title: '__APP_TITLE__' })
@@ -0,0 +1,3 @@
1
+ {
2
+ "welcome": "Welcome to :name!"
3
+ }
@@ -19,10 +19,10 @@
19
19
  "db:seed": "bunx guren db:seed"
20
20
  },
21
21
  "dependencies": {
22
- "@guren/cli": "^2.2.0",
23
- "@guren/core": "^1.5.1",
22
+ "@guren/cli": "^2.3.0",
23
+ "@guren/core": "^1.5.2",
24
24
  "@guren/inertia-client": "^1.1.0",
25
- "@guren/orm": "^2.2.0",
25
+ "@guren/orm": "^2.2.1",
26
26
  "@inertiajs/react": "^3.6.1",
27
27
  "drizzle-orm": "1.0.0-rc.4",
28
28
  "react": "^19.0.0",
@@ -30,7 +30,7 @@
30
30
  "zod": "^4.4.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@guren/testing": "^1.3.0",
33
+ "@guren/testing": "^1.4.0",
34
34
  "@tailwindcss/vite": "^4.2.2",
35
35
  "@types/react": "^19.0.0",
36
36
  "@types/react-dom": "^19.0.0",
@@ -18,7 +18,7 @@ setInertiaDocument({
18
18
  // and stopping the app from booting at all. Emailed links do not depend on this
19
19
  // — app/Auth/AppUrl.ts resolves those per request and fails closed there.
20
20
  function hostAuthorization() {
21
- const exclude = ['/healthcheck', '/up']
21
+ const exclude = ['/health']
22
22
 
23
23
  if (process.env.NODE_ENV !== 'production') {
24
24
  return { allowedHosts: ['localhost:*', '127.0.0.1:*'], exclude }
@@ -38,6 +38,10 @@ function hostAuthorization() {
38
38
  const app = createApp({
39
39
  routes: registerWebRoutes,
40
40
  providers: [DatabaseProvider],
41
+ // Translations live in lang/<locale>/*.json. Add locales to `supported`
42
+ // and the request locale is detected from ?locale=, a locale cookie, or
43
+ // Accept-Language. `guren codegen` types the keys for t()/useTranslation().
44
+ i18n: { supported: ['en'] },
41
45
  hostAuthorization: hostAuthorization(),
42
46
  })
43
47
 
@@ -1,24 +1,22 @@
1
- import { describe, it } from 'bun:test'
1
+ import { beforeAll, describe, it } from 'bun:test'
2
2
  import { TestApp } from '@guren/testing'
3
- import DatabaseProvider from '../app/Providers/DatabaseProvider.js'
4
- import { registerWebRoutes } from '../routes/web.js'
3
+ import app from '../src/app.js'
5
4
 
5
+ // Boots the real src/app.ts so tests share its configuration.
6
6
  describe('app', () => {
7
- it('serves the home page', async () => {
8
- const app = await TestApp.create({
9
- routes: registerWebRoutes,
10
- providers: [DatabaseProvider],
11
- })
7
+ let http: TestApp
12
8
 
13
- await app.get('/').assertOk()
9
+ beforeAll(async () => {
10
+ await app.boot()
11
+ http = TestApp.fromFetch((request) => app.fetch(request))
14
12
  })
15
13
 
16
- it('answers the health check', async () => {
17
- const app = await TestApp.create({
18
- routes: registerWebRoutes,
19
- providers: [DatabaseProvider],
20
- })
14
+ it('serves the translated home page', async () => {
15
+ const response = await http.get('/').assertOk()
16
+ await response.assertBodyContains('Welcome to')
17
+ })
21
18
 
22
- await app.get('/health').assertOk()
19
+ it('answers the health check', async () => {
20
+ await http.get('/health').assertOk()
23
21
  })
24
22
  })