create-guren-app 1.7.0 → 1.7.1
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 +1 -1
- package/package.json +1 -1
- package/templates/api-only/bin/serve.ts +16 -3
- package/templates/api-only/package.json +3 -3
- package/templates/blog/app/Http/Controllers/Auth/LoginController.ts +1 -1
- package/templates/blog/app/Http/Controllers/Auth/RegisterController.ts +1 -1
- package/templates/blog/app/Http/Controllers/DashboardController.ts +1 -1
- package/templates/blog/app/Http/Controllers/HomeController.ts +1 -1
- package/templates/blog/app/Http/Controllers/ProfileController.ts +2 -2
- package/templates/blog/tests/HomeController.test.ts +1 -2
- package/templates/default/app/Http/Controllers/HomeController.ts +1 -1
- package/templates/default/bin/serve.ts +16 -3
- package/templates/default/package.json +3 -3
- package/templates/default/tests/HomeController.test.ts +1 -2
package/dist/cli.js
CHANGED
|
@@ -1562,7 +1562,7 @@ async function runMain(cmd, opts = {}) {
|
|
|
1562
1562
|
|
|
1563
1563
|
// src/blueprints.ts
|
|
1564
1564
|
import { randomBytes } from "crypto";
|
|
1565
|
-
import { cp, readFile, rename, rm, writeFile } from "fs/promises";
|
|
1565
|
+
import { cp, readdir as readdir2, readFile, rename, rm, writeFile } from "fs/promises";
|
|
1566
1566
|
import { basename, dirname, join, relative } from "path";
|
|
1567
1567
|
import process2 from "process";
|
|
1568
1568
|
import { fileURLToPath } from "url";
|
package/package.json
CHANGED
|
@@ -7,18 +7,31 @@ try {
|
|
|
7
7
|
process.exit(1)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// `PORT=0` means "any free port", so this tests for a number, not truthiness.
|
|
11
|
+
const parsedPort = Number.parseInt(process.env.PORT ?? '', 10)
|
|
12
|
+
const requestedPort = Number.isInteger(parsedPort) ? parsedPort : 3333
|
|
11
13
|
const hostname = process.env.HOST ?? '0.0.0.0'
|
|
14
|
+
|
|
15
|
+
// In development a busy port moves to the next one. Set GUREN_STRICT_PORT=1 to
|
|
16
|
+
// bind the requested port or fail — see the deployment guide.
|
|
12
17
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
18
|
+
const canWalkPorts =
|
|
19
|
+
isDevelopment && requestedPort !== 0 && process.env.GUREN_STRICT_PORT !== '1'
|
|
20
|
+
const attempts = canWalkPorts ? 20 : 1
|
|
21
|
+
|
|
22
|
+
// This file owns the retry, so the framework must not retry underneath it —
|
|
23
|
+
// newer framework versions walk inside listen() themselves, and the two loops
|
|
24
|
+
// would nest into a much wider search reported against the wrong ports.
|
|
25
|
+
process.env.GUREN_STRICT_PORT = '1'
|
|
13
26
|
|
|
14
|
-
for (let offset = 0; offset <
|
|
27
|
+
for (let offset = 0; offset < attempts; offset += 1) {
|
|
15
28
|
const port = requestedPort + offset
|
|
16
29
|
|
|
17
30
|
try {
|
|
18
31
|
await app.listen({ port, hostname })
|
|
19
32
|
break
|
|
20
33
|
} catch (error) {
|
|
21
|
-
if (!
|
|
34
|
+
if (!isAddressInUse(error) || offset === attempts - 1) {
|
|
22
35
|
throw error
|
|
23
36
|
}
|
|
24
37
|
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"test": "bun test"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@guren/cli": "^2.3.
|
|
21
|
+
"@guren/cli": "^2.3.1",
|
|
22
22
|
"@guren/core": "^1.5.2",
|
|
23
|
-
"@guren/orm": "^2.2.
|
|
23
|
+
"@guren/orm": "^2.2.2",
|
|
24
24
|
"drizzle-orm": "1.0.0-rc.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@guren/testing": "^1.4.
|
|
27
|
+
"@guren/testing": "^1.4.1",
|
|
28
28
|
"bun-types": "^1.3.1",
|
|
29
29
|
"drizzle-kit": "1.0.0-rc.4",
|
|
30
30
|
"typescript": "^5.4.0"
|
|
@@ -5,7 +5,7 @@ import { pages } from '@/.guren/pages.gen'
|
|
|
5
5
|
export default class LoginController extends Controller {
|
|
6
6
|
async show(): Promise<Response> {
|
|
7
7
|
const email = this.request.query('email') ?? ''
|
|
8
|
-
return this.inertia(pages.auth.Login, { email }, {
|
|
8
|
+
return this.inertia(pages.auth.Login, { email }, { title: 'Login' })
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
async store(): Promise<Response> {
|
|
@@ -5,7 +5,7 @@ import { pages } from '@/.guren/pages.gen'
|
|
|
5
5
|
|
|
6
6
|
export default class RegisterController extends Controller {
|
|
7
7
|
async show(): Promise<Response> {
|
|
8
|
-
return this.inertia(pages.auth.Register, {}, {
|
|
8
|
+
return this.inertia(pages.auth.Register, {}, { title: 'Register' })
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
async store(): Promise<Response> {
|
|
@@ -12,6 +12,6 @@ export default class DashboardController extends Controller {
|
|
|
12
12
|
email: currentUser.email,
|
|
13
13
|
}
|
|
14
14
|
: null
|
|
15
|
-
return this.inertia(pages.dashboard.Index, { user }, {
|
|
15
|
+
return this.inertia(pages.dashboard.Index, { user }, { title: 'Dashboard' })
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -16,7 +16,7 @@ export default class HomeController extends Controller {
|
|
|
16
16
|
return this.inertia(
|
|
17
17
|
pages.Home,
|
|
18
18
|
{ latest: latest.map((post) => new PostResource(post).toJSON()) },
|
|
19
|
-
{
|
|
19
|
+
{ title: '__APP_TITLE__' },
|
|
20
20
|
)
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -15,7 +15,7 @@ export default class ProfileController extends Controller {
|
|
|
15
15
|
name: user.name,
|
|
16
16
|
email: user.email,
|
|
17
17
|
},
|
|
18
|
-
}, {
|
|
18
|
+
}, { title: 'Profile' })
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async update(): Promise<Response> {
|
|
@@ -49,6 +49,6 @@ export default class ProfileController extends Controller {
|
|
|
49
49
|
return this.inertia(pages.profile.Edit, {
|
|
50
50
|
profile: { name, email },
|
|
51
51
|
status: 'Profile updated successfully.',
|
|
52
|
-
}, {
|
|
52
|
+
}, { title: 'Profile' })
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -8,6 +8,6 @@ export default class HomeController extends Controller {
|
|
|
8
8
|
message: this.t('messages.welcome', { name: '__APP_TITLE__' }),
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
return this.inertia(pages.Home, props, {
|
|
11
|
+
return this.inertia(pages.Home, props, { title: '__APP_TITLE__' })
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -7,18 +7,31 @@ try {
|
|
|
7
7
|
process.exit(1)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// `PORT=0` means "any free port", so this tests for a number, not truthiness.
|
|
11
|
+
const parsedPort = Number.parseInt(process.env.PORT ?? '', 10)
|
|
12
|
+
const requestedPort = Number.isInteger(parsedPort) ? parsedPort : 3333
|
|
11
13
|
const hostname = process.env.HOST ?? '0.0.0.0'
|
|
14
|
+
|
|
15
|
+
// In development a busy port moves to the next one. Set GUREN_STRICT_PORT=1 to
|
|
16
|
+
// bind the requested port or fail — see the deployment guide.
|
|
12
17
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
18
|
+
const canWalkPorts =
|
|
19
|
+
isDevelopment && requestedPort !== 0 && process.env.GUREN_STRICT_PORT !== '1'
|
|
20
|
+
const attempts = canWalkPorts ? 20 : 1
|
|
21
|
+
|
|
22
|
+
// This file owns the retry, so the framework must not retry underneath it —
|
|
23
|
+
// newer framework versions walk inside listen() themselves, and the two loops
|
|
24
|
+
// would nest into a much wider search reported against the wrong ports.
|
|
25
|
+
process.env.GUREN_STRICT_PORT = '1'
|
|
13
26
|
|
|
14
|
-
for (let offset = 0; offset <
|
|
27
|
+
for (let offset = 0; offset < attempts; offset += 1) {
|
|
15
28
|
const port = requestedPort + offset
|
|
16
29
|
|
|
17
30
|
try {
|
|
18
31
|
await app.listen({ port, hostname })
|
|
19
32
|
break
|
|
20
33
|
} catch (error) {
|
|
21
|
-
if (!
|
|
34
|
+
if (!isAddressInUse(error) || offset === attempts - 1) {
|
|
22
35
|
throw error
|
|
23
36
|
}
|
|
24
37
|
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"db:seed": "bunx guren db:seed"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@guren/cli": "^2.3.
|
|
22
|
+
"@guren/cli": "^2.3.1",
|
|
23
23
|
"@guren/core": "^1.5.2",
|
|
24
24
|
"@guren/inertia-client": "^1.1.0",
|
|
25
|
-
"@guren/orm": "^2.2.
|
|
25
|
+
"@guren/orm": "^2.2.2",
|
|
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.4.
|
|
33
|
+
"@guren/testing": "^1.4.1",
|
|
34
34
|
"@tailwindcss/vite": "^4.2.2",
|
|
35
35
|
"@types/react": "^19.0.0",
|
|
36
36
|
"@types/react-dom": "^19.0.0",
|