cosmolo 0.3.1 → 0.3.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/package.json
CHANGED
package/src/cli/init.ts
CHANGED
|
@@ -78,15 +78,15 @@ export async function main(): Promise<void> {
|
|
|
78
78
|
|
|
79
79
|
// ── Mode selection ──────────────────────────────────────────────────────
|
|
80
80
|
console.log('Choose an initialization mode:\n');
|
|
81
|
-
console.log('
|
|
82
|
-
console.log('
|
|
81
|
+
console.log(' 1) Full — server routes + Svelte page components');
|
|
82
|
+
console.log(' 2) Slim — server routes only (bring your own Svelte UI)\n');
|
|
83
83
|
|
|
84
84
|
let modeRaw = '';
|
|
85
|
-
while (!['
|
|
86
|
-
modeRaw = (await ask(rl, 'Mode [
|
|
87
|
-
if (!['
|
|
85
|
+
while (!['1', '2'].includes(modeRaw)) {
|
|
86
|
+
modeRaw = (await ask(rl, 'Mode [1/2]: ')).trim();
|
|
87
|
+
if (!['1', '2'].includes(modeRaw)) console.log(' Please enter 1 or 2.');
|
|
88
88
|
}
|
|
89
|
-
const mode: 'full' | 'slim' = modeRaw === '
|
|
89
|
+
const mode: 'full' | 'slim' = modeRaw === '1' ? 'full' : 'slim';
|
|
90
90
|
|
|
91
91
|
// ── Adapter selection ───────────────────────────────────────────────────
|
|
92
92
|
console.log('\nChoose your deployment adapter:\n');
|
|
@@ -100,8 +100,6 @@ export async function main(): Promise<void> {
|
|
|
100
100
|
}
|
|
101
101
|
const isSSG = adapterRaw === '1';
|
|
102
102
|
|
|
103
|
-
rl.close();
|
|
104
|
-
|
|
105
103
|
// ── Collect files ───────────────────────────────────────────────────────
|
|
106
104
|
const sharedFiles = collectFiles(path.join(TEMPLATE_DIR, 'shared'));
|
|
107
105
|
const fullFiles = mode === 'full' ? collectFiles(path.join(TEMPLATE_DIR, 'full')) : [];
|
|
@@ -126,20 +124,24 @@ export async function main(): Promise<void> {
|
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
if (conflicts.length > 0) {
|
|
129
|
-
console.
|
|
130
|
-
for (const f of conflicts) console.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
127
|
+
console.log('\nThe following files already exist:\n');
|
|
128
|
+
for (const f of conflicts) console.log(` ${f}`);
|
|
129
|
+
|
|
130
|
+
let overwriteRaw = '';
|
|
131
|
+
while (!['y', 'n'].includes(overwriteRaw)) {
|
|
132
|
+
overwriteRaw = (await ask(rl, '\nOverwrite all? [y/N]: ')).trim().toLowerCase() || 'n';
|
|
133
|
+
if (!['y', 'n'].includes(overwriteRaw)) console.log(' Please enter y or n.');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (overwriteRaw === 'n') {
|
|
137
|
+
console.log('\nAborted. No files were written.\n');
|
|
138
|
+
rl.close();
|
|
139
|
+
process.exit(0);
|
|
139
140
|
}
|
|
140
|
-
process.exit(1);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
rl.close();
|
|
144
|
+
|
|
143
145
|
// ── Write files ─────────────────────────────────────────────────────────
|
|
144
146
|
for (const [src, rel] of allFiles) {
|
|
145
147
|
const dest = destPath(rel, PROJECT_ROOT);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"url": "https://your-site.example.com",
|
|
3
|
+
"name": "Your Site Name",
|
|
4
|
+
"description": "A content site built with Cosmolo.",
|
|
5
|
+
"twitterHandle": "@yourhandle",
|
|
6
|
+
"fallbackCategoryLabel": "Other",
|
|
7
|
+
"articlesPerPage": 10,
|
|
8
|
+
"ogImage": { "mode": "static" },
|
|
9
|
+
"api": { "articleBody": "html" }
|
|
10
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resolveConfig } from 'cosmolo';
|
|
2
2
|
|
|
3
3
|
const config = resolveConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
articlesDir: 'src/content/articles',
|
|
5
|
+
pagesDir: 'src/content/pages',
|
|
6
|
+
siteConfigPath: 'config/site.json',
|
|
7
|
+
categoriesConfigPath: 'config/categories.json',
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
export default config;
|