create-bodhi-js 0.7.0 → 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 +7 -2
- package/dist/index.js +41 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ npm create bodhi-js@latest
|
|
|
11
11
|
# With project name
|
|
12
12
|
npm create bodhi-js@latest my-app
|
|
13
13
|
|
|
14
|
-
# With options
|
|
15
|
-
npm create bodhi-js@latest my-app -- --
|
|
14
|
+
# With options (note the -- separator before flags)
|
|
15
|
+
npm create bodhi-js@latest my-app -- --github-pages --github-org "myorg" --dev-client-id "app-id"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Features
|
|
@@ -53,6 +53,11 @@ Options:
|
|
|
53
53
|
--no-install Skip dependency installation
|
|
54
54
|
--no-git Skip git initialization
|
|
55
55
|
--github-pages Enable GitHub Pages deployment setup
|
|
56
|
+
--no-github-pages Disable GitHub Pages deployment setup
|
|
57
|
+
--github-org <org> GitHub repository owner (user/org)
|
|
58
|
+
--dev-client-id <id> Development client ID (for .env.local and CI)
|
|
59
|
+
--prod-client-id <id> Production client ID (for GitHub Pages deploy)
|
|
60
|
+
--ci Run in CI mode (disable animations)
|
|
56
61
|
-h, --help display help for command
|
|
57
62
|
```
|
|
58
63
|
|
package/dist/index.js
CHANGED
|
@@ -25,18 +25,22 @@ var TEMPLATE_FILES = [
|
|
|
25
25
|
"playwright.config.ts",
|
|
26
26
|
"CONTRIBUTING.md",
|
|
27
27
|
"src/App.tsx",
|
|
28
|
+
"src/components/Header.tsx",
|
|
28
29
|
".github/SECURITY.md",
|
|
29
30
|
".github/ISSUE_TEMPLATE/config.yml",
|
|
30
31
|
".github/workflows/ci.yml",
|
|
31
32
|
".github/workflows/deploy-pages.yml"
|
|
32
33
|
];
|
|
33
34
|
async function processTemplates(targetDir, vars) {
|
|
35
|
+
const mcpServers = vars.mcpServers ?? [];
|
|
36
|
+
const mcpServersLiteral = mcpServers.length === 0 ? "[]" : "[" + mcpServers.map((url) => `{ url: '${url}' }`).join(", ") + "]";
|
|
37
|
+
const templateVars = { ...vars, mcpServersLiteral };
|
|
34
38
|
for (const file of TEMPLATE_FILES) {
|
|
35
39
|
const filePath = path.join(targetDir, file);
|
|
36
40
|
try {
|
|
37
41
|
const content = await fs.readFile(filePath, "utf-8");
|
|
38
42
|
const template = Handlebars.compile(content);
|
|
39
|
-
const rendered = template(
|
|
43
|
+
const rendered = template(templateVars);
|
|
40
44
|
await fs.writeFile(filePath, rendered, "utf-8");
|
|
41
45
|
} catch (error) {
|
|
42
46
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -65,7 +69,8 @@ async function scaffold(options) {
|
|
|
65
69
|
install,
|
|
66
70
|
git,
|
|
67
71
|
devClientId,
|
|
68
|
-
prodClientId
|
|
72
|
+
prodClientId,
|
|
73
|
+
mcpServers
|
|
69
74
|
} = options;
|
|
70
75
|
const targetDir = path2.resolve(process.cwd(), projectName);
|
|
71
76
|
try {
|
|
@@ -111,7 +116,8 @@ async function scaffold(options) {
|
|
|
111
116
|
basePath,
|
|
112
117
|
pathSegmentsToKeep,
|
|
113
118
|
devClientId,
|
|
114
|
-
prodClientId
|
|
119
|
+
prodClientId,
|
|
120
|
+
mcpServers
|
|
115
121
|
});
|
|
116
122
|
if (!githubPages) {
|
|
117
123
|
const filesToDelete = [
|
|
@@ -200,6 +206,7 @@ Or use a local path: /path/to/template`
|
|
|
200
206
|
}
|
|
201
207
|
|
|
202
208
|
// src/cli.ts
|
|
209
|
+
var POPULAR_MCP_SERVERS = ["https://mcp.exa.ai/mcp", "https://mcp.deepwiki.com/mcp"];
|
|
203
210
|
async function create(projectName, options) {
|
|
204
211
|
if (options.ci) {
|
|
205
212
|
process.env.CI = "true";
|
|
@@ -275,6 +282,34 @@ async function create(projectName, options) {
|
|
|
275
282
|
} else {
|
|
276
283
|
githubOrg = "YOUR_ORG";
|
|
277
284
|
}
|
|
285
|
+
let mcpServers = [];
|
|
286
|
+
if (options.mcpServers) {
|
|
287
|
+
mcpServers = options.mcpServers.split(",").map((s) => s.trim()).filter(Boolean);
|
|
288
|
+
} else if (!options.ci) {
|
|
289
|
+
const presetResult = await p.multiselect({
|
|
290
|
+
message: "Select MCP servers to request access to:",
|
|
291
|
+
options: POPULAR_MCP_SERVERS.map((url) => ({ value: url, label: url })),
|
|
292
|
+
required: false
|
|
293
|
+
});
|
|
294
|
+
if (p.isCancel(presetResult)) {
|
|
295
|
+
p.cancel("Operation cancelled");
|
|
296
|
+
process.exit(0);
|
|
297
|
+
}
|
|
298
|
+
mcpServers = presetResult;
|
|
299
|
+
const customResult = await p.text({
|
|
300
|
+
message: "Additional MCP server URLs (comma-separated, blank to skip):",
|
|
301
|
+
placeholder: "https://mcp.example.com/mcp",
|
|
302
|
+
defaultValue: ""
|
|
303
|
+
});
|
|
304
|
+
if (p.isCancel(customResult)) {
|
|
305
|
+
p.cancel("Operation cancelled");
|
|
306
|
+
process.exit(0);
|
|
307
|
+
}
|
|
308
|
+
if (customResult) {
|
|
309
|
+
const customUrls = customResult.split(",").map((s) => s.trim()).filter(Boolean);
|
|
310
|
+
mcpServers = [...mcpServers, ...customUrls];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
278
313
|
const spinner2 = p.spinner();
|
|
279
314
|
spinner2.start("Scaffolding project...");
|
|
280
315
|
try {
|
|
@@ -288,7 +323,8 @@ async function create(projectName, options) {
|
|
|
288
323
|
install: options.install,
|
|
289
324
|
git: options.git,
|
|
290
325
|
devClientId: options.devClientId,
|
|
291
|
-
prodClientId: options.prodClientId
|
|
326
|
+
prodClientId: options.prodClientId,
|
|
327
|
+
mcpServers
|
|
292
328
|
});
|
|
293
329
|
spinner2.stop("Project scaffolded successfully!");
|
|
294
330
|
p.note(
|
|
@@ -305,7 +341,7 @@ async function create(projectName, options) {
|
|
|
305
341
|
|
|
306
342
|
// src/index.ts
|
|
307
343
|
var program = new Command();
|
|
308
|
-
program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template name or local path", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").option("--no-github-pages", "Disable GitHub Pages deployment setup").option("--github-org <org>", "GitHub repository owner (user/org)").option("--dev-client-id <id>", "Development client ID (for .env.local and CI)").option("--prod-client-id <id>", "Production client ID (for GitHub Pages deploy)").option("--ci", "Run in CI mode (disable animations)").action(async (projectName, options) => {
|
|
344
|
+
program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template name or local path", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").option("--no-github-pages", "Disable GitHub Pages deployment setup").option("--github-org <org>", "GitHub repository owner (user/org)").option("--dev-client-id <id>", "Development client ID (for .env.local and CI)").option("--prod-client-id <id>", "Production client ID (for GitHub Pages deploy)").option("--mcp-servers <urls>", "Comma-separated MCP server URLs to request access to").option("--ci", "Run in CI mode (disable animations)").action(async (projectName, options) => {
|
|
309
345
|
await create(projectName, options);
|
|
310
346
|
});
|
|
311
347
|
program.parse();
|