create-sonicjs 3.0.0-beta.5 → 3.0.0-beta.6
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
package/src/cli.js
CHANGED
|
@@ -409,7 +409,7 @@ async function copyTemplate(templateName, targetDir, options) {
|
|
|
409
409
|
|
|
410
410
|
// Add @sonicjs-cms/core dependency
|
|
411
411
|
packageJson.dependencies = {
|
|
412
|
-
'@sonicjs-cms/core': '^3.0.0-beta.
|
|
412
|
+
'@sonicjs-cms/core': '^3.0.0-beta.6',
|
|
413
413
|
...packageJson.dependencies
|
|
414
414
|
}
|
|
415
415
|
|
|
@@ -589,11 +589,19 @@ Or they should be automatically available after installation.
|
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
async function createCloudflareResources(databaseName, bucketName, targetDir) {
|
|
592
|
-
//
|
|
592
|
+
// Resolve wrangler binary — prefer global, fall back to npx
|
|
593
|
+
let wranglerCmd = 'wrangler'
|
|
594
|
+
let wranglerArgs = []
|
|
593
595
|
try {
|
|
594
596
|
await execa('wrangler', ['--version'], { cwd: targetDir })
|
|
595
597
|
} catch {
|
|
596
|
-
|
|
598
|
+
try {
|
|
599
|
+
await execa('npx', ['--yes', 'wrangler', '--version'], { cwd: targetDir })
|
|
600
|
+
wranglerCmd = 'npx'
|
|
601
|
+
wranglerArgs = ['wrangler']
|
|
602
|
+
} catch {
|
|
603
|
+
throw new Error('wrangler is not installed. Install with: npm install -g wrangler')
|
|
604
|
+
}
|
|
597
605
|
}
|
|
598
606
|
|
|
599
607
|
let databaseId
|
|
@@ -602,7 +610,7 @@ async function createCloudflareResources(databaseName, bucketName, targetDir) {
|
|
|
602
610
|
|
|
603
611
|
// Create D1 database
|
|
604
612
|
try {
|
|
605
|
-
const { stdout, stderr } = await execa(
|
|
613
|
+
const { stdout, stderr } = await execa(wranglerCmd, [...wranglerArgs, 'd1', 'create', databaseName], {
|
|
606
614
|
cwd: targetDir
|
|
607
615
|
})
|
|
608
616
|
|
|
@@ -630,7 +638,7 @@ async function createCloudflareResources(databaseName, bucketName, targetDir) {
|
|
|
630
638
|
|
|
631
639
|
// Create R2 bucket
|
|
632
640
|
try {
|
|
633
|
-
await execa(
|
|
641
|
+
await execa(wranglerCmd, [...wranglerArgs, 'r2', 'bucket', 'create', bucketName], {
|
|
634
642
|
cwd: targetDir
|
|
635
643
|
})
|
|
636
644
|
bucketCreated = true
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Example collection configuration for blog posts
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { CollectionConfig } from '@sonicjs-cms/core'
|
|
7
|
+
import type { CollectionConfig } from '@sonicjs-cms/core';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
name: '
|
|
11
|
-
displayName: 'Blog
|
|
10
|
+
name: 'blog_post',
|
|
11
|
+
displayName: 'Blog Post',
|
|
12
|
+
slug: 'blog-posts',
|
|
12
13
|
description: 'Manage your blog posts',
|
|
13
14
|
icon: '📝',
|
|
14
15
|
|
|
@@ -19,57 +20,46 @@ export default {
|
|
|
19
20
|
type: 'string',
|
|
20
21
|
title: 'Title',
|
|
21
22
|
required: true,
|
|
22
|
-
maxLength: 200
|
|
23
|
+
maxLength: 200,
|
|
23
24
|
},
|
|
24
25
|
slug: {
|
|
25
26
|
type: 'slug',
|
|
26
27
|
title: 'URL Slug',
|
|
27
28
|
required: true,
|
|
28
|
-
maxLength: 200
|
|
29
|
-
},
|
|
30
|
-
excerpt: {
|
|
31
|
-
type: 'textarea',
|
|
32
|
-
title: 'Excerpt',
|
|
33
|
-
maxLength: 500,
|
|
34
|
-
helpText: 'A short summary of the post'
|
|
29
|
+
maxLength: 200,
|
|
35
30
|
},
|
|
36
31
|
content: {
|
|
37
|
-
type: '
|
|
32
|
+
type: 'lexical',
|
|
38
33
|
title: 'Content',
|
|
39
|
-
required: true
|
|
40
|
-
},
|
|
41
|
-
featuredImage: {
|
|
42
|
-
type: 'media',
|
|
43
|
-
title: 'Featured Image'
|
|
34
|
+
required: true,
|
|
44
35
|
},
|
|
45
36
|
author: {
|
|
46
|
-
type: '
|
|
37
|
+
type: 'user',
|
|
47
38
|
title: 'Author',
|
|
48
|
-
required: true
|
|
39
|
+
required: true,
|
|
49
40
|
},
|
|
50
41
|
publishedAt: {
|
|
51
42
|
type: 'datetime',
|
|
52
|
-
title: 'Published Date'
|
|
43
|
+
title: 'Published Date',
|
|
53
44
|
},
|
|
54
|
-
status: {
|
|
55
|
-
type: 'select',
|
|
56
|
-
title: 'Status',
|
|
57
|
-
enum: ['draft', 'published', 'archived'],
|
|
58
|
-
enumLabels: ['Draft', 'Published', 'Archived'],
|
|
59
|
-
default: 'draft'
|
|
60
|
-
},
|
|
61
|
-
tags: {
|
|
62
|
-
type: 'string',
|
|
63
|
-
title: 'Tags',
|
|
64
|
-
helpText: 'Comma-separated tags'
|
|
65
|
-
}
|
|
66
45
|
},
|
|
67
|
-
required: ['title', 'slug', 'content', 'author']
|
|
46
|
+
required: ['title', 'slug', 'content', 'author'],
|
|
68
47
|
},
|
|
69
48
|
|
|
70
49
|
// List view configuration
|
|
71
50
|
listFields: ['title', 'author', 'status', 'publishedAt'],
|
|
72
|
-
searchFields: ['title', '
|
|
51
|
+
searchFields: ['title', 'content', 'author'],
|
|
73
52
|
defaultSort: 'createdAt',
|
|
74
|
-
defaultSortOrder: 'desc'
|
|
75
|
-
|
|
53
|
+
defaultSortOrder: 'desc',
|
|
54
|
+
|
|
55
|
+
// Mark as config-managed (code-based) collection
|
|
56
|
+
managed: true,
|
|
57
|
+
isActive: true,
|
|
58
|
+
|
|
59
|
+
// Per-collection cache override. TTL in seconds; falls back to the cache plugin
|
|
60
|
+
// default (CACHE_CONFIGS.api.ttl, currently 300s) if unset.
|
|
61
|
+
cache: {
|
|
62
|
+
enabled: true,
|
|
63
|
+
ttl: 5,
|
|
64
|
+
},
|
|
65
|
+
} satisfies CollectionConfig;
|