create-knit 0.3.1 → 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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-knit",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Create a Knit project: `pnpm create knit my-app` (Django-inspired, batteries-included TypeScript framework on Nuxt).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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.slug))
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
- description: created ? t('blog.thanksDescription') : undefined,
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
- flash(event, { type: 'error', title: 'Word count failed', description: task.error?.split('\n')[0] })
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 = value as Record<string, unknown>
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.id ?? ''),
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?.name,
22
+ ...(p.author ? { author: p.author.name } : {}),
23
23
  categories: p.category ? [p.category.name] : [],
24
24
  }))
25
25
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "knit": "0.3.1",
2
+ "knit": "0.3.2",
3
3
  "nuxt": "^4.7.0",
4
4
  "drizzleOrm": "^0.45.4",
5
5
  "typescript": "^6.0.3",