create-knit 0.3.0 → 0.3.2
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/index.mjs +1 -0
- package/package.json +1 -1
- package/template/examples/layers/example-blog/app/pages/blog/[slug].vue +2 -2
- package/template/examples/layers/example-blog/server/api/blog/word-count.post.ts +2 -1
- package/template/examples/layers/example-blog/server/channels/comments.ts +2 -2
- package/template/examples/layers/example-blog/server/feeds/blog.ts +1 -1
- package/template/versions.json +1 -1
- /package/template/base/docker/{.env.production.example → _env.production.example} +0 -0
package/index.mjs
CHANGED
|
@@ -68,6 +68,7 @@ const json = value => `${JSON.stringify(value, null, 2)}\n`
|
|
|
68
68
|
function writeProject(target, name, examples) {
|
|
69
69
|
cpSync(join(template, 'base'), target, { recursive: true })
|
|
70
70
|
renameSync(join(target, '_gitignore'), join(target, '.gitignore'))
|
|
71
|
+
renameSync(join(target, 'docker/_env.production.example'), join(target, 'docker/.env.production.example'))
|
|
71
72
|
if (examples) cpSync(join(template, 'examples'), target, { recursive: true })
|
|
72
73
|
|
|
73
74
|
const local = localPackages()
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import type { comment } from '../../../server/database/schema'
|
|
|
5
5
|
|
|
6
6
|
const route = useRoute()
|
|
7
7
|
const { t, locale } = useI18n()
|
|
8
|
-
const slug = computed(() => String(route.params
|
|
8
|
+
const slug = computed(() => String(route.params['slug']))
|
|
9
9
|
const { data: post, error } = await useFetch(() => `/api/blog/posts/${slug.value}`)
|
|
10
10
|
if (error.value) throw createError({ statusCode: 404, statusMessage: t('blog.notFound'), fatal: true })
|
|
11
11
|
|
|
@@ -37,7 +37,7 @@ async function onSaved(_row: Record<string, unknown>, created: boolean): Promise
|
|
|
37
37
|
await refresh()
|
|
38
38
|
toast.add({
|
|
39
39
|
title: created ? t('blog.thanks') : t('blog.updated'),
|
|
40
|
-
|
|
40
|
+
...(created ? { description: t('blog.thanksDescription') } : {}),
|
|
41
41
|
color: 'success',
|
|
42
42
|
icon: 'i-lucide-check',
|
|
43
43
|
})
|
|
@@ -14,7 +14,8 @@ export default defineEventHandler(async (event) => {
|
|
|
14
14
|
flash(event, { type: 'success', title: `${intcomma(words)} word${pluralize(words)}`, description: `in “${title}”` })
|
|
15
15
|
}
|
|
16
16
|
else if (task.status === 'failed') {
|
|
17
|
-
|
|
17
|
+
const description = task.error?.split('\n')[0]
|
|
18
|
+
flash(event, { type: 'error', title: 'Word count failed', ...(description !== undefined ? { description } : {}) })
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
21
|
flash(event, { type: 'info', title: 'Word count queued', description: `Task ${task.id}` })
|
|
@@ -20,13 +20,13 @@ interface CommentEvent {
|
|
|
20
20
|
|
|
21
21
|
function isCommentEvent(value: unknown): value is CommentEvent {
|
|
22
22
|
if (typeof value !== 'object' || value === null) return false
|
|
23
|
-
const v
|
|
23
|
+
const v: Partial<Record<keyof CommentEvent, unknown>> = value
|
|
24
24
|
return typeof v.id === 'number' && typeof v.authorId === 'string' && typeof v.approved === 'boolean'
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const postComments = defineChannel('comments:post:{id}', {
|
|
28
28
|
description: 'Comment created/updated/deleted events for one post',
|
|
29
|
-
authorize: ctx => /^\d+$/.test(ctx.params
|
|
29
|
+
authorize: ctx => /^\d+$/.test(ctx.params['id'] ?? ''),
|
|
30
30
|
filter(message, ctx) {
|
|
31
31
|
if (ctx.can(MODERATE)) return true
|
|
32
32
|
if (!isCommentEvent(message.data)) return false
|
|
@@ -19,7 +19,7 @@ export const blogFeed = {
|
|
|
19
19
|
description: truncatewords(p.body, 50),
|
|
20
20
|
date: p.publishedAt ?? p.createdAt,
|
|
21
21
|
updated: p.updatedAt,
|
|
22
|
-
author: p.author
|
|
22
|
+
...(p.author ? { author: p.author.name } : {}),
|
|
23
23
|
categories: p.category ? [p.category.name] : [],
|
|
24
24
|
}))
|
|
25
25
|
},
|
package/template/versions.json
CHANGED
|
File without changes
|