vending-mocha 0.1.3 → 0.1.5
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/bin/cli.js +3 -61
- package/package.json +1 -1
- package/projects/placeholder-1.md +7 -0
- package/projects/placeholder-2.md +7 -0
- package/src/posts.json +23 -0
- package/src/projects.json +23 -0
- package/src/site.config.ts +1 -1
- package/projects/legacy-api.md +0 -7
- package/projects/task-master.md +0 -7
package/bin/cli.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import { execSync } from 'child_process';
|
|
6
5
|
import { fileURLToPath } from 'url';
|
|
7
6
|
import inquirer from 'inquirer';
|
|
8
7
|
import chalk from 'chalk';
|
|
@@ -22,7 +21,8 @@ const IGNORE_FILES = [
|
|
|
22
21
|
'docs',
|
|
23
22
|
'bin',
|
|
24
23
|
'package-lock.json',
|
|
25
|
-
'.DS_Store'
|
|
24
|
+
'.DS_Store',
|
|
25
|
+
'LICENSE'
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
function getAsciiArt() {
|
|
@@ -152,25 +152,6 @@ function copyRecursiveSync(src, dest, destRoot) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
function updateSiteConfig(projectDir, config) {
|
|
156
|
-
const configPath = path.join(projectDir, 'src', 'site.config.ts');
|
|
157
|
-
if (fs.existsSync(configPath)) {
|
|
158
|
-
let content = fs.readFileSync(configPath, 'utf8');
|
|
159
|
-
|
|
160
|
-
// Update title
|
|
161
|
-
if (config.title) {
|
|
162
|
-
content = content.replace(/title:\s*".*?"/, `title: "${config.title}"`);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Update URL
|
|
166
|
-
if (config.url) {
|
|
167
|
-
content = content.replace(/url:\s*".*?"/, `url: "${config.url}"`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
fs.writeFileSync(configPath, content, 'utf8');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
155
|
function updatePackageJson(projectDir, config) {
|
|
175
156
|
const pkgPath = path.join(projectDir, 'package.json');
|
|
176
157
|
if (fs.existsSync(pkgPath)) {
|
|
@@ -179,6 +160,7 @@ function updatePackageJson(projectDir, config) {
|
|
|
179
160
|
pkg.name = config.projectName;
|
|
180
161
|
pkg.version = '0.0.0';
|
|
181
162
|
pkg.description = config.description || `My new blog built with vending-mocha`;
|
|
163
|
+
pkg.license = 'Unknown';
|
|
182
164
|
|
|
183
165
|
// Remove the bin entry so the new project doesn't try to be a CLI itself
|
|
184
166
|
if (pkg.bin) {
|
|
@@ -220,35 +202,11 @@ async function handleNew(projectName, options) {
|
|
|
220
202
|
});
|
|
221
203
|
}
|
|
222
204
|
|
|
223
|
-
questions.push({
|
|
224
|
-
type: 'input',
|
|
225
|
-
name: 'title',
|
|
226
|
-
message: 'What is the title of your blog?',
|
|
227
|
-
default: (answers) => answers.projectName || projectName
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
questions.push({
|
|
231
|
-
type: 'input',
|
|
232
|
-
name: 'url',
|
|
233
|
-
message: 'What is the production URL of your blog?',
|
|
234
|
-
default: (answers) => `https://example.com/${answers.projectName || projectName}`
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
questions.push({
|
|
238
|
-
type: 'input',
|
|
239
|
-
name: 'description',
|
|
240
|
-
message: 'Write a short description for your blog:',
|
|
241
|
-
default: 'A personal blogging framework for developers.'
|
|
242
|
-
});
|
|
243
|
-
|
|
244
205
|
const answers = await inquirer.prompt(questions);
|
|
245
206
|
|
|
246
207
|
// Merge args and answers
|
|
247
208
|
const config = {
|
|
248
209
|
projectName: projectName || answers.projectName,
|
|
249
|
-
title: answers.title,
|
|
250
|
-
url: answers.url,
|
|
251
|
-
description: answers.description
|
|
252
210
|
};
|
|
253
211
|
|
|
254
212
|
const currentDir = process.cwd();
|
|
@@ -271,25 +229,9 @@ async function handleNew(projectName, options) {
|
|
|
271
229
|
|
|
272
230
|
// 2. Update config
|
|
273
231
|
console.log(chalk.gray('Updating configuration...'));
|
|
274
|
-
updateSiteConfig(projectDir, config);
|
|
275
|
-
console.log(chalk.green('✔ Configuration updated'));
|
|
276
|
-
|
|
277
|
-
// 3. Update package.json
|
|
278
|
-
console.log(chalk.gray('Updating package.json...'));
|
|
279
232
|
updatePackageJson(projectDir, config);
|
|
280
233
|
console.log(chalk.green('✔ package.json updated'));
|
|
281
234
|
|
|
282
|
-
// 4. Initialize Git
|
|
283
|
-
console.log(chalk.gray('Initializing git repository...'));
|
|
284
|
-
try {
|
|
285
|
-
execSync('git init', { cwd: projectDir, stdio: 'ignore' });
|
|
286
|
-
execSync('git add .', { cwd: projectDir, stdio: 'ignore' });
|
|
287
|
-
execSync('git commit -m "Initial commit from vending-mocha"', { cwd: projectDir, stdio: 'ignore' });
|
|
288
|
-
console.log(chalk.green('✔ Git initialized'));
|
|
289
|
-
} catch (e) {
|
|
290
|
-
console.warn(chalk.yellow('⚠ Failed to initialize git repository (git might not be installed).'));
|
|
291
|
-
}
|
|
292
|
-
|
|
293
235
|
console.log(chalk.green(`\nSuccess! Created ${config.projectName} at ${projectDir}`));
|
|
294
236
|
console.log('\nInside that directory, you can run:');
|
|
295
237
|
console.log(chalk.cyan(` cd ${config.projectName}`));
|
package/package.json
CHANGED
package/src/posts.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"slug": "hello-world",
|
|
4
|
+
"title": "Welcome to Vending Mocha ☕",
|
|
5
|
+
"date": "2026-02-17 04:00:00",
|
|
6
|
+
"summary": "Welcome to your new blogging framework! This is a sample post to get you started.",
|
|
7
|
+
"weight": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"slug": "markdown-features",
|
|
11
|
+
"title": "Markdown Features Demo 📝",
|
|
12
|
+
"date": "2026-02-17 02:00:00",
|
|
13
|
+
"summary": "A demonstration of the Markdown features supported by Vending Mocha, including code blocks, lists, and formatting.",
|
|
14
|
+
"weight": 0
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"slug": "deploy-to-github-pages",
|
|
18
|
+
"title": "Deploying to GitHub Pages 🚀",
|
|
19
|
+
"date": "2026-02-17 01:00:00",
|
|
20
|
+
"summary": "A step-by-step guide to deploying your Vending Mocha blog to GitHub Pages using GitHub Actions.",
|
|
21
|
+
"weight": 0
|
|
22
|
+
}
|
|
23
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Vending Mocha",
|
|
4
|
+
"description": "A lightweight, blazing fast, personal blogging framework built with React.",
|
|
5
|
+
"link": "https://github.com/kcthota/vending-mocha",
|
|
6
|
+
"status": "active",
|
|
7
|
+
"weight": 10
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "Placeholder 1",
|
|
11
|
+
"description": "A Placeholder description for the project",
|
|
12
|
+
"link": "https://example.com/",
|
|
13
|
+
"status": "inactive",
|
|
14
|
+
"weight": 5
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Placeholder 2",
|
|
18
|
+
"description": "A placeholder description for the project",
|
|
19
|
+
"link": "https://example.com/",
|
|
20
|
+
"status": "dead",
|
|
21
|
+
"weight": 1
|
|
22
|
+
}
|
|
23
|
+
]
|
package/src/site.config.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export const siteConfig = {
|
|
4
4
|
title: "Vending Mocha",
|
|
5
5
|
url: "https://vendingmocha.com",
|
|
6
|
-
description: '**Vending Mocha** is a lightweight, strictly typed, and blazing fast personal blogging framework built with React
|
|
6
|
+
description: '**Vending Mocha** is a lightweight, strictly typed, and blazing fast personal blogging framework built with React.\n\nIt is designed to be minimal, easy to customize, and deployed within minutes. Create a site, update the config, and start writing!\n\nSimply write your new posts in markdown files and Vending Mocha will publish them as static HTML files to your GitHub Pages site.',
|
|
7
7
|
image: '/images/profile.png',
|
|
8
8
|
contact: {
|
|
9
9
|
github: "https://github.com/kcthota/vending-mocha",
|
package/projects/legacy-api.md
DELETED