@karaoke-cms/create 0.6.3 → 0.9.0
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/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @karaoke-cms/create
|
|
2
|
+
|
|
3
|
+
Scaffolding tool for karaoke-cms. Creates a complete new project from scratch with a single command.
|
|
4
|
+
|
|
5
|
+
## Where it belongs
|
|
6
|
+
|
|
7
|
+
`packages/create/` in the monorepo. Published to npm as `@karaoke-cms/create` and invoked via npm's `create` shorthand:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create @karaoke-cms@latest
|
|
11
|
+
# or
|
|
12
|
+
npm create @karaoke-cms@latest my-site
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This resolves to running `packages/create/src/index.js` via the `create-karaoke-cms` bin entry.
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
Runs an interactive CLI that prompts for project configuration, then generates a complete project directory:
|
|
20
|
+
|
|
21
|
+
**Prompts:**
|
|
22
|
+
1. Project directory name
|
|
23
|
+
2. Site title
|
|
24
|
+
3. Site URL (for sitemap and OG tags)
|
|
25
|
+
4. Description
|
|
26
|
+
5. Theme (`default`, `minimal`, or `blog`)
|
|
27
|
+
6. Enable Pagefind search? (y/n)
|
|
28
|
+
7. Enable Giscus comments? (y/n) — if yes, prompts for repo, repoId, category, categoryId
|
|
29
|
+
|
|
30
|
+
**Generated files:**
|
|
31
|
+
```
|
|
32
|
+
my-site/
|
|
33
|
+
package.json # deps pinned to same version as create package
|
|
34
|
+
astro.config.mjs # site URL, karaoke() integration
|
|
35
|
+
karaoke.config.ts # title, description, theme, modules, vault path
|
|
36
|
+
src/
|
|
37
|
+
content.config.ts # makeCollections() wired to vault/
|
|
38
|
+
env.d.ts # /// <reference types="@karaoke-cms/astro/client" />
|
|
39
|
+
tsconfig.json
|
|
40
|
+
.gitignore
|
|
41
|
+
.env.default # KARAOKE_VAULT=./vault/
|
|
42
|
+
public/
|
|
43
|
+
_redirects # Cloudflare Pages 404 config
|
|
44
|
+
vault/ # Obsidian vault with sample blog post and doc
|
|
45
|
+
blog/
|
|
46
|
+
docs/
|
|
47
|
+
karaoke-cms/
|
|
48
|
+
config/
|
|
49
|
+
collections.yaml
|
|
50
|
+
menus.yaml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
After scaffolding, `git init` + initial commit runs automatically if `git` is available.
|
|
54
|
+
|
|
55
|
+
## How to use
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm create @karaoke-cms@latest
|
|
59
|
+
|
|
60
|
+
cd my-site
|
|
61
|
+
npm install
|
|
62
|
+
npm run dev # → http://localhost:4321
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Open `my-site/vault/` in Obsidian to write content. Files with `publish: true` in frontmatter appear on the live site.
|
|
66
|
+
|
|
67
|
+
Zero runtime dependencies — the scaffolder uses Node.js built-ins only.
|
|
68
|
+
|
|
69
|
+
## How it changes the behavior of the system
|
|
70
|
+
|
|
71
|
+
The create package is not imported by running sites — it only runs once at project setup time. Its output determines:
|
|
72
|
+
|
|
73
|
+
- Which version of `@karaoke-cms/astro` and the theme packages are installed (pinned to the same version as the create package, since packages ship in lockstep)
|
|
74
|
+
- The initial `karaoke.config.ts` shape: which theme, which modules, vault location
|
|
75
|
+
- The initial vault structure: two sample posts so the site is not empty on first `dev`
|
|
76
|
+
- Whether search and comments infrastructure is included in `karaoke.config.ts`
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": {
|
|
3
|
+
"id": "bf48daa9b3525d37",
|
|
4
|
+
"type": "split",
|
|
5
|
+
"children": [
|
|
6
|
+
{
|
|
7
|
+
"id": "4d1b0940e2f6130e",
|
|
8
|
+
"type": "tabs",
|
|
9
|
+
"children": [
|
|
10
|
+
{
|
|
11
|
+
"id": "d663da17c7b12a45",
|
|
12
|
+
"type": "leaf",
|
|
13
|
+
"state": {
|
|
14
|
+
"type": "markdown",
|
|
15
|
+
"state": {
|
|
16
|
+
"file": "docs/getting-started.md",
|
|
17
|
+
"mode": "source",
|
|
18
|
+
"source": false
|
|
19
|
+
},
|
|
20
|
+
"icon": "lucide-file",
|
|
21
|
+
"title": "getting-started"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "52e565c48d7a7c39",
|
|
26
|
+
"type": "leaf",
|
|
27
|
+
"state": {
|
|
28
|
+
"type": "markdown",
|
|
29
|
+
"state": {
|
|
30
|
+
"file": "karaoke-cms/templates/docs-header.md",
|
|
31
|
+
"mode": "source",
|
|
32
|
+
"source": false
|
|
33
|
+
},
|
|
34
|
+
"icon": "lucide-file",
|
|
35
|
+
"title": "docs-header"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"currentTab": 1
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"direction": "vertical"
|
|
43
|
+
},
|
|
44
|
+
"left": {
|
|
45
|
+
"id": "f848878ad9626a8e",
|
|
46
|
+
"type": "split",
|
|
47
|
+
"children": [
|
|
48
|
+
{
|
|
49
|
+
"id": "ea3061d9ba4255be",
|
|
50
|
+
"type": "tabs",
|
|
51
|
+
"children": [
|
|
52
|
+
{
|
|
53
|
+
"id": "94f03deca1f3d6ef",
|
|
54
|
+
"type": "leaf",
|
|
55
|
+
"state": {
|
|
56
|
+
"type": "file-explorer",
|
|
57
|
+
"state": {
|
|
58
|
+
"sortOrder": "alphabetical",
|
|
59
|
+
"autoReveal": false
|
|
60
|
+
},
|
|
61
|
+
"icon": "lucide-folder-closed",
|
|
62
|
+
"title": "Files"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "b92a29ffd5bd2fcd",
|
|
67
|
+
"type": "leaf",
|
|
68
|
+
"state": {
|
|
69
|
+
"type": "search",
|
|
70
|
+
"state": {
|
|
71
|
+
"query": "",
|
|
72
|
+
"matchingCase": false,
|
|
73
|
+
"explainSearch": false,
|
|
74
|
+
"collapseAll": false,
|
|
75
|
+
"extraContext": false,
|
|
76
|
+
"sortOrder": "alphabetical"
|
|
77
|
+
},
|
|
78
|
+
"icon": "lucide-search",
|
|
79
|
+
"title": "Search"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "2fa9963b38cc204e",
|
|
84
|
+
"type": "leaf",
|
|
85
|
+
"state": {
|
|
86
|
+
"type": "bookmarks",
|
|
87
|
+
"state": {},
|
|
88
|
+
"icon": "lucide-bookmark",
|
|
89
|
+
"title": "Bookmarks"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"direction": "horizontal",
|
|
96
|
+
"width": 300
|
|
97
|
+
},
|
|
98
|
+
"right": {
|
|
99
|
+
"id": "068d5dd11487213f",
|
|
100
|
+
"type": "split",
|
|
101
|
+
"children": [
|
|
102
|
+
{
|
|
103
|
+
"id": "b36a87ef12a5b05e",
|
|
104
|
+
"type": "tabs",
|
|
105
|
+
"children": [
|
|
106
|
+
{
|
|
107
|
+
"id": "5040cbb52c2ed323",
|
|
108
|
+
"type": "leaf",
|
|
109
|
+
"state": {
|
|
110
|
+
"type": "backlink",
|
|
111
|
+
"state": {
|
|
112
|
+
"collapseAll": false,
|
|
113
|
+
"extraContext": false,
|
|
114
|
+
"sortOrder": "alphabetical",
|
|
115
|
+
"showSearch": false,
|
|
116
|
+
"searchQuery": "",
|
|
117
|
+
"backlinkCollapsed": false,
|
|
118
|
+
"unlinkedCollapsed": true
|
|
119
|
+
},
|
|
120
|
+
"icon": "links-coming-in",
|
|
121
|
+
"title": "Backlinks"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "262dc809ddada450",
|
|
126
|
+
"type": "leaf",
|
|
127
|
+
"state": {
|
|
128
|
+
"type": "outgoing-link",
|
|
129
|
+
"state": {
|
|
130
|
+
"linksCollapsed": false,
|
|
131
|
+
"unlinkedCollapsed": true
|
|
132
|
+
},
|
|
133
|
+
"icon": "links-going-out",
|
|
134
|
+
"title": "Outgoing links"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "27e78afa43f86c41",
|
|
139
|
+
"type": "leaf",
|
|
140
|
+
"state": {
|
|
141
|
+
"type": "tag",
|
|
142
|
+
"state": {
|
|
143
|
+
"sortOrder": "frequency",
|
|
144
|
+
"useHierarchy": true,
|
|
145
|
+
"showSearch": false,
|
|
146
|
+
"searchQuery": ""
|
|
147
|
+
},
|
|
148
|
+
"icon": "lucide-tags",
|
|
149
|
+
"title": "Tags"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "b25127a84b56f576",
|
|
154
|
+
"type": "leaf",
|
|
155
|
+
"state": {
|
|
156
|
+
"type": "all-properties",
|
|
157
|
+
"state": {
|
|
158
|
+
"sortOrder": "frequency",
|
|
159
|
+
"showSearch": false,
|
|
160
|
+
"searchQuery": ""
|
|
161
|
+
},
|
|
162
|
+
"icon": "lucide-archive",
|
|
163
|
+
"title": "All properties"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "9144cec5db6c0b0e",
|
|
168
|
+
"type": "leaf",
|
|
169
|
+
"state": {
|
|
170
|
+
"type": "outline",
|
|
171
|
+
"state": {
|
|
172
|
+
"followCursor": false,
|
|
173
|
+
"showSearch": false,
|
|
174
|
+
"searchQuery": ""
|
|
175
|
+
},
|
|
176
|
+
"icon": "lucide-list",
|
|
177
|
+
"title": "Outline"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"id": "d5b8fda7e074d1fc",
|
|
182
|
+
"type": "leaf",
|
|
183
|
+
"state": {
|
|
184
|
+
"type": "file-properties",
|
|
185
|
+
"state": {
|
|
186
|
+
"file": "karaoke-cms/templates/docs-header.md"
|
|
187
|
+
},
|
|
188
|
+
"icon": "lucide-info",
|
|
189
|
+
"title": "File properties for docs-header"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"currentTab": 5
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"direction": "horizontal",
|
|
197
|
+
"width": 300
|
|
198
|
+
},
|
|
199
|
+
"left-ribbon": {
|
|
200
|
+
"hiddenItems": {
|
|
201
|
+
"switcher:Open quick switcher": false,
|
|
202
|
+
"graph:Open graph view": false,
|
|
203
|
+
"canvas:Create new canvas": false,
|
|
204
|
+
"daily-notes:Open today's daily note": false,
|
|
205
|
+
"templates:Insert template": false,
|
|
206
|
+
"command-palette:Open command palette": false,
|
|
207
|
+
"bases:Create new base": false,
|
|
208
|
+
"templater-obsidian:Templater": false
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"active": "52e565c48d7a7c39",
|
|
212
|
+
"lastOpenFiles": [
|
|
213
|
+
"karaoke-cms/templates/blog-header.md",
|
|
214
|
+
"karaoke-cms/templates/docs-header.md",
|
|
215
|
+
"karaoke-cms/templates/index-by-foldernote.md",
|
|
216
|
+
"karaoke-cms/manual/content.md",
|
|
217
|
+
"karaoke-cms/manual/configuration.md",
|
|
218
|
+
"blog/hello-world.md",
|
|
219
|
+
"karaoke-cms/templates",
|
|
220
|
+
"karaoke-cms/index.md",
|
|
221
|
+
"blog/draft-post.md",
|
|
222
|
+
"docs/testing.md",
|
|
223
|
+
"docs/getting-started.md"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# menus.yaml — define named menus for your site.
|
|
2
|
+
#
|
|
3
|
+
# Each menu has an orientation (horizontal or vertical) and a list of entries.
|
|
4
|
+
# Entries are sorted by weight (ascending). Submenus are defined by nesting entries.
|
|
5
|
+
#
|
|
6
|
+
# when: collection:name — hide entry when the collection is disabled or has no
|
|
7
|
+
# published posts. Omit `when` to always show.
|
|
8
|
+
#
|
|
9
|
+
# If this file is absent, karaoke-cms generates a default main menu (Blog/Docs/Tags)
|
|
10
|
+
# and a default footer menu (RSS) from your active collections.
|
|
11
|
+
|
|
12
|
+
menus:
|
|
13
|
+
main:
|
|
14
|
+
orientation: horizontal
|
|
15
|
+
entries:
|
|
16
|
+
- text: Blog
|
|
17
|
+
href: /blog
|
|
18
|
+
weight: 10
|
|
19
|
+
when: collection:blog
|
|
20
|
+
- text: Docs
|
|
21
|
+
href: /docs
|
|
22
|
+
weight: 20
|
|
23
|
+
when: collection:docs
|
|
24
|
+
- text: Tags
|
|
25
|
+
href: /tags
|
|
26
|
+
weight: 30
|
|
27
|
+
|
|
28
|
+
footer:
|
|
29
|
+
orientation: horizontal
|
|
30
|
+
entries:
|
|
31
|
+
- text: RSS
|
|
32
|
+
href: /rss.xml
|
|
33
|
+
weight: 10
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -110,7 +110,10 @@ async function main() {
|
|
|
110
110
|
const title = await ask('Site title', defaultTitle);
|
|
111
111
|
const siteUrl = await ask('Site URL', 'https://my-site.pages.dev');
|
|
112
112
|
const description = await ask('Description', 'Our team knowledge base.');
|
|
113
|
-
const
|
|
113
|
+
const themeChoice = await askChoice('Theme', ['default', 'minimal', 'blog'], 0);
|
|
114
|
+
const theme = themeChoice === 'default' || themeChoice === 'minimal'
|
|
115
|
+
? themeChoice
|
|
116
|
+
: `@karaoke-cms/theme-${themeChoice}`;
|
|
114
117
|
const search = await askYesNo('Enable search? (Pagefind)', true);
|
|
115
118
|
const commentsEnabled = await askYesNo('Enable comments? (requires Giscus setup)', false);
|
|
116
119
|
|
|
@@ -134,7 +137,7 @@ async function main() {
|
|
|
134
137
|
|
|
135
138
|
// Config and project files from templates
|
|
136
139
|
const files = {
|
|
137
|
-
'package.json': packageJson({ name: dir, astroVersion }),
|
|
140
|
+
'package.json': packageJson({ name: dir, astroVersion, theme }),
|
|
138
141
|
'astro.config.mjs': astroConfig({ siteUrl }),
|
|
139
142
|
'karaoke.config.ts': karaokeConfig({ title, description, theme, search, comments }),
|
|
140
143
|
'src/content.config.ts': contentConfig(),
|
package/src/templates.js
CHANGED
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @param {{ name: string, astroVersion: string }} opts
|
|
8
|
+
* @param {{ name: string, astroVersion: string, theme?: string }} opts
|
|
9
9
|
*/
|
|
10
|
-
export function packageJson({ name, astroVersion }) {
|
|
10
|
+
export function packageJson({ name, astroVersion, theme }) {
|
|
11
|
+
const dependencies = {
|
|
12
|
+
'@karaoke-cms/astro': `^${astroVersion}`,
|
|
13
|
+
astro: '^6.0.0',
|
|
14
|
+
};
|
|
15
|
+
if (theme?.startsWith('@')) {
|
|
16
|
+
dependencies[theme] = `^${astroVersion}`;
|
|
17
|
+
}
|
|
11
18
|
return JSON.stringify({
|
|
12
19
|
name,
|
|
13
20
|
private: true,
|
|
@@ -18,10 +25,7 @@ export function packageJson({ name, astroVersion }) {
|
|
|
18
25
|
build: 'astro build',
|
|
19
26
|
preview: 'astro preview',
|
|
20
27
|
},
|
|
21
|
-
dependencies
|
|
22
|
-
'@karaoke-cms/astro': `^${astroVersion}`,
|
|
23
|
-
astro: '^6.0.0',
|
|
24
|
-
},
|
|
28
|
+
dependencies,
|
|
25
29
|
}, null, 2) + '\n';
|
|
26
30
|
}
|
|
27
31
|
|