@forinda/kickjs-cli 8.14.0 → 8.14.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/{agent-docs-DR1PRHV4.mjs → agent-docs-ClLUdXi9.mjs} +3 -3
- package/dist/{agent-docs-DR1PRHV4.mjs.map → agent-docs-ClLUdXi9.mjs.map} +1 -1
- package/dist/{agent-docs-BBIVix8s.mjs → agent-docs-DA1ICOUV.mjs} +2 -2
- package/dist/{build-DvcK_Feg.mjs → build-B1SVlQMj.mjs} +3 -3
- package/dist/{build-DvcK_Feg.mjs.map → build-B1SVlQMj.mjs.map} +1 -1
- package/dist/{build-CA0uDYP4.mjs → build-BNarDoas.mjs} +2 -2
- package/dist/{builtins-DWzysfuk.mjs → builtins-C8CUXR7y.mjs} +2 -2
- package/dist/{builtins-QqgoF4jk.mjs → builtins-DIdRQfIZ.mjs} +4 -4
- package/dist/cli.mjs +2 -2
- package/dist/{config-ChYZE_ER.mjs → config-BZ_DgqAb.mjs} +2 -2
- package/dist/{config-Cz2-AJbR.mjs → config-D3vAudYh.mjs} +3 -3
- package/dist/{config-Cz2-AJbR.mjs.map → config-D3vAudYh.mjs.map} +1 -1
- package/dist/{doctor-CNra8Yf_.mjs → doctor-BYvatDDh.mjs} +4 -4
- package/dist/{doctor-CNra8Yf_.mjs.map → doctor-BYvatDDh.mjs.map} +1 -1
- package/dist/{fullstack-B6QDnu27.mjs → fullstack-BqwHqBWK.mjs} +4 -4
- package/dist/{fullstack-B6QDnu27.mjs.map → fullstack-BqwHqBWK.mjs.map} +1 -1
- package/dist/{fullstack-en-ECevz.mjs → fullstack-NAgRR7Dj.mjs} +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{package-manager-D8W1-xh-.mjs → package-manager-BIKlWb_z.mjs} +3 -3
- package/dist/{package-manager-D8W1-xh-.mjs.map → package-manager-BIKlWb_z.mjs.map} +1 -1
- package/dist/{package-manager-vl66Np0J.mjs → package-manager-vtILOPAv.mjs} +2 -2
- package/dist/{plugin-C22PThnC.mjs → plugin-BOpVRMKa.mjs} +2 -2
- package/dist/{plugin-C4ZvjEuo.mjs → plugin-DkhJMphG.mjs} +2 -2
- package/dist/{project-BxGXkPHR.mjs → project-BGfW_cup.mjs} +4 -4
- package/dist/{project-BO5joAFY.mjs → project-BMojPey-.mjs} +5 -5
- package/dist/{project-BO5joAFY.mjs.map → project-BMojPey-.mjs.map} +1 -1
- package/dist/{project-root-DVa7AoaZ.mjs → project-root-BQKspC3k.mjs} +3 -3
- package/dist/{project-root-DVa7AoaZ.mjs.map → project-root-BQKspC3k.mjs.map} +1 -1
- package/dist/{project-root-CH1Dy_HW.mjs → project-root-DvXJgSgx.mjs} +2 -2
- package/dist/{rolldown-runtime-V3xbKk8u.mjs → rolldown-runtime-C_ICmTLf.mjs} +1 -1
- package/dist/{run-plugins-9IDaa4U7.mjs → run-plugins-PuTINHKr.mjs} +4 -4
- package/dist/{run-plugins-9IDaa4U7.mjs.map → run-plugins-PuTINHKr.mjs.map} +1 -1
- package/dist/{typegen-BKa7OeBf.mjs → typegen-BDdaN5Se.mjs} +4 -4
- package/dist/{typegen-CiKLo3iV.mjs → typegen-DCJ5718N.mjs} +5 -5
- package/dist/{typegen-CiKLo3iV.mjs.map → typegen-DCJ5718N.mjs.map} +1 -1
- package/dist/{types-Zu0gh9vO.mjs → types-DOfGMqCL.mjs} +1 -1
- package/package.json +3 -3
- package/templates/template-inertia/feature.json +1 -1
- package/templates/template-inertia/files/src/client/Seo.tsx +8 -0
- package/templates/template-inertia/files/src/index.ts +6 -0
- package/templates/template-inertia/files/src/modules/pages/pages.controller.ts +24 -3
- package/templates/template-inertia/files/src/modules/seo/seo.controller.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-cli",
|
|
3
|
-
"version": "8.14.
|
|
3
|
+
"version": "8.14.1",
|
|
4
4
|
"description": "CLI for KickJS — project scaffolding, DDD module generation, dev/build/start",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"picocolors": "^1.1.1",
|
|
43
43
|
"pluralize": "^8.0.0",
|
|
44
44
|
"@forinda/kickjs-cli-kit": "0.1.3",
|
|
45
|
-
"@forinda/kickjs": "
|
|
46
|
-
"@forinda/kickjs
|
|
45
|
+
"@forinda/kickjs-db": "8.9.0",
|
|
46
|
+
"@forinda/kickjs": "10.8.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@swc/core": "^1.16.13",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Head, usePage } from '@inertiajs/react'
|
|
2
|
+
import { createElement, useEffect } from 'react'
|
|
2
3
|
import type { PageMeta } from '@forinda/kickjs-inertia'
|
|
3
4
|
|
|
4
5
|
// Renders the meta a controller passes to inertia(..., { meta }), merged with
|
|
@@ -8,6 +9,10 @@ import type { PageMeta } from '@forinda/kickjs-inertia'
|
|
|
8
9
|
// duplicated.
|
|
9
10
|
export function Seo() {
|
|
10
11
|
const meta = (usePage() as { meta?: PageMeta }).meta
|
|
12
|
+
// <html lang> sits outside the app; the first visit's HTML has it already.
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (meta?.lang) document.documentElement.lang = meta.lang
|
|
15
|
+
}, [meta?.lang])
|
|
11
16
|
if (!meta) return null
|
|
12
17
|
return (
|
|
13
18
|
<Head title={meta.title}>
|
|
@@ -30,6 +35,9 @@ export function Seo() {
|
|
|
30
35
|
dangerouslySetInnerHTML={{ __html: JSON.stringify(meta.jsonLd).replace(/</g, '\\u003c') }}
|
|
31
36
|
/>
|
|
32
37
|
)}
|
|
38
|
+
{meta.head?.map(({ tag, attrs, key }) =>
|
|
39
|
+
createElement(tag, { key, 'head-key': key, ...attrs }),
|
|
40
|
+
)}
|
|
33
41
|
</Head>
|
|
34
42
|
)
|
|
35
43
|
}
|
|
@@ -30,9 +30,15 @@ export const app = await bootstrap({
|
|
|
30
30
|
// inertia(component, props, { meta }), and src/client/Seo.tsx keeps the
|
|
31
31
|
// browser's <head> in sync on client-side visits.
|
|
32
32
|
meta: {
|
|
33
|
+
lang: 'en',
|
|
33
34
|
titleTemplate: '%s · {{name}}',
|
|
34
35
|
description: '{{name}}, built with KickJS and Inertia.',
|
|
36
|
+
// Link previews: add `image: '/og.png'` (1200×630, in public/) and
|
|
37
|
+
// switch the card to 'summary_large_image'.
|
|
35
38
|
og: { site_name: '{{name}}', type: 'website' },
|
|
39
|
+
twitter: { card: 'summary' },
|
|
40
|
+
// Any other <meta> / <link>: hreflang alternates, preloads.
|
|
41
|
+
head: [h('meta', { name: 'theme-color', content: '#ffffff' })],
|
|
36
42
|
},
|
|
37
43
|
// Props every page receives.
|
|
38
44
|
share: () => ({ appName: '{{name}}' }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Controller, Get, Post, type RequestContext } from '@forinda/kickjs'
|
|
1
|
+
import { ConfigService, Controller, Get, Post, type RequestContext } from '@forinda/kickjs'
|
|
2
2
|
import { defer, flash, inertia, redirect } from '@forinda/kickjs-inertia'
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
|
|
@@ -11,6 +11,8 @@ export const createPostSchema = z.object({
|
|
|
11
11
|
|
|
12
12
|
@Controller()
|
|
13
13
|
export class PagesController {
|
|
14
|
+
constructor(private readonly config: ConfigService) {}
|
|
15
|
+
|
|
14
16
|
@Get('/')
|
|
15
17
|
home() {
|
|
16
18
|
// Renders src/client/pages/Home.tsx with these props.
|
|
@@ -18,7 +20,20 @@ export class PagesController {
|
|
|
18
20
|
'Home',
|
|
19
21
|
{ greeting: 'Welcome to {{name}}' },
|
|
20
22
|
// In the first HTML response, for search engines and link previews.
|
|
21
|
-
{
|
|
23
|
+
{
|
|
24
|
+
meta: {
|
|
25
|
+
title: 'Home',
|
|
26
|
+
// 120–160 characters reads best in search results.
|
|
27
|
+
description:
|
|
28
|
+
'Welcome to {{name}}: a KickJS and Inertia app with server-rendered pages, typed forms and posts you can browse and add to.',
|
|
29
|
+
jsonLd: {
|
|
30
|
+
'@context': 'https://schema.org',
|
|
31
|
+
'@type': 'WebSite',
|
|
32
|
+
name: '{{name}}',
|
|
33
|
+
url: this.config.get('APP_URL'),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
22
37
|
)
|
|
23
38
|
}
|
|
24
39
|
|
|
@@ -34,7 +49,13 @@ export class PagesController {
|
|
|
34
49
|
// in the HTML a crawler reads.
|
|
35
50
|
stats: defer(() => ({ total: posts.length })),
|
|
36
51
|
},
|
|
37
|
-
{
|
|
52
|
+
{
|
|
53
|
+
meta: {
|
|
54
|
+
title: 'Posts',
|
|
55
|
+
description:
|
|
56
|
+
'Every post on {{name}}, newest last. Read what has been written so far, or add a post of your own with the form on this page.',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
38
59
|
)
|
|
39
60
|
}
|
|
40
61
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { Controller, Get
|
|
1
|
+
import { ConfigService, Controller, Get } from '@forinda/kickjs'
|
|
2
2
|
import { robots, sitemap } from '@forinda/kickjs-inertia'
|
|
3
3
|
|
|
4
4
|
@Controller()
|
|
5
5
|
export class SeoController {
|
|
6
|
+
constructor(private readonly config: ConfigService) {}
|
|
7
|
+
|
|
6
8
|
// List every page search engines should find — add rows from your
|
|
7
9
|
// repositories (`{ loc: `/posts/${id}`, lastmod: post.updatedAt }`).
|
|
8
10
|
@Get('/sitemap.xml')
|
|
9
11
|
sitemap() {
|
|
10
12
|
return sitemap([{ loc: '/', changefreq: 'weekly', priority: 1 }, { loc: '/posts' }], {
|
|
11
|
-
baseUrl:
|
|
13
|
+
baseUrl: this.config.get('APP_URL'),
|
|
12
14
|
})
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
@Get('/robots.txt')
|
|
16
18
|
robots() {
|
|
17
|
-
return robots({ sitemap: '/sitemap.xml', baseUrl:
|
|
19
|
+
return robots({ sitemap: '/sitemap.xml', baseUrl: this.config.get('APP_URL') })
|
|
18
20
|
}
|
|
19
21
|
}
|