@karaoke-cms/create 0.9.7 → 0.10.3
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 +9 -0
- package/package.json +5 -5
- package/src/index.js +11 -2
- package/src/templates.js +13 -1
- package/karaoke-create-vault/.obsidian/workspace.json +0 -213
package/README.md
CHANGED
|
@@ -73,6 +73,15 @@ npm run deploy # publishes to Cloudflare Pages
|
|
|
73
73
|
|
|
74
74
|
Requires a Cloudflare account and the `wrangler` CLI. The wizard handles the first deploy interactively.
|
|
75
75
|
|
|
76
|
+
## What's new in 0.10.3
|
|
77
|
+
|
|
78
|
+
- **Directory traversal rejected** — passing a project name like `../../outside` that resolves outside the current working directory now exits with a clear error instead of creating files at an unexpected location.
|
|
79
|
+
|
|
80
|
+
## What's new in 0.10.2
|
|
81
|
+
|
|
82
|
+
- **`sharp` in devDependencies** — scaffolded projects now include `sharp` so Astro's image optimisation works without a manual install step.
|
|
83
|
+
- Scaffolded `content.config.ts` passes the full karaoke config to `makeCollections`, so new projects are multi-docs-section-ready from day one.
|
|
84
|
+
|
|
76
85
|
## What's new in 0.9.5
|
|
77
86
|
|
|
78
87
|
- **Deploy defaults to yes** — the Cloudflare Pages deploy prompt now defaults to YES, so new sites are live by the end of the wizard
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karaoke-cms/create",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.3",
|
|
5
5
|
"description": "Scaffold a new karaoke-cms project",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-karaoke-cms": "src/index.js"
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"scaffold",
|
|
21
21
|
"obsidian"
|
|
22
22
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"test": "vitest run test/templates.test.js test/index.test.js"
|
|
25
|
-
},
|
|
26
23
|
"devDependencies": {
|
|
27
24
|
"vitest": "^4.1.1"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "vitest run test/templates.test.js test/index.test.js"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createInterface } from 'readline';
|
|
10
10
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, cpSync } from 'fs';
|
|
11
|
-
import { join, resolve } from 'path';
|
|
11
|
+
import { join, resolve, normalize, sep } from 'path';
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
13
|
import { spawnSync } from 'child_process';
|
|
14
14
|
import {
|
|
@@ -95,7 +95,16 @@ async function main() {
|
|
|
95
95
|
let dir = process.argv[2]?.replace(/^-+/, '') || '';
|
|
96
96
|
if (!dir) dir = await ask('Project directory', 'my-cms');
|
|
97
97
|
|
|
98
|
-
const
|
|
98
|
+
const cwd = process.cwd();
|
|
99
|
+
const targetDir = resolve(cwd, dir);
|
|
100
|
+
const normTarget = normalize(targetDir);
|
|
101
|
+
const normCwd = normalize(cwd);
|
|
102
|
+
|
|
103
|
+
if (!normTarget.startsWith(normCwd + sep) && normTarget !== normCwd) {
|
|
104
|
+
console.error(`\n${RED}✗${R} Invalid project directory: must be inside the current working directory.`);
|
|
105
|
+
rl.close();
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
99
108
|
|
|
100
109
|
if (existsSync(targetDir)) {
|
|
101
110
|
console.error(`\n${RED}✗${R} Directory already exists: ${BOLD}${targetDir}${R}`);
|
package/src/templates.js
CHANGED
|
@@ -43,6 +43,7 @@ export function packageJson({ name, astroVersion, theme }) {
|
|
|
43
43
|
},
|
|
44
44
|
dependencies,
|
|
45
45
|
devDependencies: {
|
|
46
|
+
sharp: '^0.33.0',
|
|
46
47
|
wrangler: '^4',
|
|
47
48
|
},
|
|
48
49
|
}, null, 2) + '\n';
|
|
@@ -106,7 +107,18 @@ import { loadEnv } from '@karaoke-cms/astro/env';
|
|
|
106
107
|
|
|
107
108
|
const env = loadEnv(new URL('..', import.meta.url));
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
// Load karaoke config so makeCollections can register docs() instance collections.
|
|
111
|
+
let karaokeConfig;
|
|
112
|
+
try {
|
|
113
|
+
karaokeConfig = (await import('../karaoke.config.ts')).default;
|
|
114
|
+
} catch (err) {
|
|
115
|
+
const missingModule = (err?.code === 'ERR_MODULE_NOT_FOUND')
|
|
116
|
+
? (err?.message?.match(/Cannot find module '([^']+)'/)?.[1] ?? '')
|
|
117
|
+
: '';
|
|
118
|
+
if (!missingModule.includes('karaoke.config')) throw err;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const collections = makeCollections(new URL('..', import.meta.url), env.KARAOKE_VAULT, { config: karaokeConfig });
|
|
110
122
|
`;
|
|
111
123
|
}
|
|
112
124
|
|
|
@@ -1,213 +0,0 @@
|
|
|
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
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"direction": "vertical"
|
|
28
|
-
},
|
|
29
|
-
"left": {
|
|
30
|
-
"id": "f848878ad9626a8e",
|
|
31
|
-
"type": "split",
|
|
32
|
-
"children": [
|
|
33
|
-
{
|
|
34
|
-
"id": "ea3061d9ba4255be",
|
|
35
|
-
"type": "tabs",
|
|
36
|
-
"children": [
|
|
37
|
-
{
|
|
38
|
-
"id": "94f03deca1f3d6ef",
|
|
39
|
-
"type": "leaf",
|
|
40
|
-
"state": {
|
|
41
|
-
"type": "file-explorer",
|
|
42
|
-
"state": {
|
|
43
|
-
"sortOrder": "alphabetical",
|
|
44
|
-
"autoReveal": false
|
|
45
|
-
},
|
|
46
|
-
"icon": "lucide-folder-closed",
|
|
47
|
-
"title": "Files"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"id": "b92a29ffd5bd2fcd",
|
|
52
|
-
"type": "leaf",
|
|
53
|
-
"state": {
|
|
54
|
-
"type": "search",
|
|
55
|
-
"state": {
|
|
56
|
-
"query": "",
|
|
57
|
-
"matchingCase": false,
|
|
58
|
-
"explainSearch": false,
|
|
59
|
-
"collapseAll": false,
|
|
60
|
-
"extraContext": false,
|
|
61
|
-
"sortOrder": "alphabetical"
|
|
62
|
-
},
|
|
63
|
-
"icon": "lucide-search",
|
|
64
|
-
"title": "Search"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"id": "2fa9963b38cc204e",
|
|
69
|
-
"type": "leaf",
|
|
70
|
-
"state": {
|
|
71
|
-
"type": "bookmarks",
|
|
72
|
-
"state": {},
|
|
73
|
-
"icon": "lucide-bookmark",
|
|
74
|
-
"title": "Bookmarks"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"direction": "horizontal",
|
|
81
|
-
"width": 300
|
|
82
|
-
},
|
|
83
|
-
"right": {
|
|
84
|
-
"id": "068d5dd11487213f",
|
|
85
|
-
"type": "split",
|
|
86
|
-
"children": [
|
|
87
|
-
{
|
|
88
|
-
"id": "b36a87ef12a5b05e",
|
|
89
|
-
"type": "tabs",
|
|
90
|
-
"children": [
|
|
91
|
-
{
|
|
92
|
-
"id": "5040cbb52c2ed323",
|
|
93
|
-
"type": "leaf",
|
|
94
|
-
"state": {
|
|
95
|
-
"type": "backlink",
|
|
96
|
-
"state": {
|
|
97
|
-
"collapseAll": false,
|
|
98
|
-
"extraContext": false,
|
|
99
|
-
"sortOrder": "alphabetical",
|
|
100
|
-
"showSearch": false,
|
|
101
|
-
"searchQuery": "",
|
|
102
|
-
"backlinkCollapsed": false,
|
|
103
|
-
"unlinkedCollapsed": true
|
|
104
|
-
},
|
|
105
|
-
"icon": "links-coming-in",
|
|
106
|
-
"title": "Backlinks"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"id": "262dc809ddada450",
|
|
111
|
-
"type": "leaf",
|
|
112
|
-
"state": {
|
|
113
|
-
"type": "outgoing-link",
|
|
114
|
-
"state": {
|
|
115
|
-
"linksCollapsed": false,
|
|
116
|
-
"unlinkedCollapsed": true
|
|
117
|
-
},
|
|
118
|
-
"icon": "links-going-out",
|
|
119
|
-
"title": "Outgoing links"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"id": "27e78afa43f86c41",
|
|
124
|
-
"type": "leaf",
|
|
125
|
-
"state": {
|
|
126
|
-
"type": "tag",
|
|
127
|
-
"state": {
|
|
128
|
-
"sortOrder": "frequency",
|
|
129
|
-
"useHierarchy": true,
|
|
130
|
-
"showSearch": false,
|
|
131
|
-
"searchQuery": ""
|
|
132
|
-
},
|
|
133
|
-
"icon": "lucide-tags",
|
|
134
|
-
"title": "Tags"
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"id": "b25127a84b56f576",
|
|
139
|
-
"type": "leaf",
|
|
140
|
-
"state": {
|
|
141
|
-
"type": "all-properties",
|
|
142
|
-
"state": {
|
|
143
|
-
"sortOrder": "frequency",
|
|
144
|
-
"showSearch": false,
|
|
145
|
-
"searchQuery": ""
|
|
146
|
-
},
|
|
147
|
-
"icon": "lucide-archive",
|
|
148
|
-
"title": "All properties"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"id": "9144cec5db6c0b0e",
|
|
153
|
-
"type": "leaf",
|
|
154
|
-
"state": {
|
|
155
|
-
"type": "outline",
|
|
156
|
-
"state": {
|
|
157
|
-
"followCursor": false,
|
|
158
|
-
"showSearch": false,
|
|
159
|
-
"searchQuery": ""
|
|
160
|
-
},
|
|
161
|
-
"icon": "lucide-list",
|
|
162
|
-
"title": "Outline"
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"id": "d5b8fda7e074d1fc",
|
|
167
|
-
"type": "leaf",
|
|
168
|
-
"state": {
|
|
169
|
-
"type": "file-properties",
|
|
170
|
-
"state": {
|
|
171
|
-
"file": "docs/getting-started.md"
|
|
172
|
-
},
|
|
173
|
-
"icon": "lucide-info",
|
|
174
|
-
"title": "File properties for getting-started"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
"currentTab": 5
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
"direction": "horizontal",
|
|
182
|
-
"width": 300
|
|
183
|
-
},
|
|
184
|
-
"left-ribbon": {
|
|
185
|
-
"hiddenItems": {
|
|
186
|
-
"switcher:Open quick switcher": false,
|
|
187
|
-
"graph:Open graph view": false,
|
|
188
|
-
"canvas:Create new canvas": false,
|
|
189
|
-
"daily-notes:Open today's daily note": false,
|
|
190
|
-
"templates:Insert template": false,
|
|
191
|
-
"command-palette:Open command palette": false,
|
|
192
|
-
"bases:Create new base": false,
|
|
193
|
-
"templater-obsidian:Templater": false
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
"active": "d663da17c7b12a45",
|
|
197
|
-
"lastOpenFiles": [
|
|
198
|
-
"karaoke-cms/manual/deployment.md",
|
|
199
|
-
"karaoke-cms/manual/configuration.md",
|
|
200
|
-
"karaoke-cms/templates/index.md",
|
|
201
|
-
"karaoke-cms/config/index.md",
|
|
202
|
-
"karaoke-cms/templates/docs-header.md",
|
|
203
|
-
"karaoke-cms/templates/blog-header.md",
|
|
204
|
-
"karaoke-cms/templates/index-by-foldernote.md",
|
|
205
|
-
"karaoke-cms/manual/content.md",
|
|
206
|
-
"blog/hello-world.md",
|
|
207
|
-
"karaoke-cms/templates",
|
|
208
|
-
"karaoke-cms/index.md",
|
|
209
|
-
"blog/draft-post.md",
|
|
210
|
-
"docs/testing.md",
|
|
211
|
-
"docs/getting-started.md"
|
|
212
|
-
]
|
|
213
|
-
}
|