create-nyoworks 2.4.2 → 2.5.1
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/dist/checks.d.ts +1 -0
- package/dist/checks.js +15 -0
- package/dist/init.js +53 -2
- package/package.json +1 -1
package/dist/checks.d.ts
CHANGED
package/dist/checks.js
CHANGED
|
@@ -87,6 +87,21 @@ export async function checkDependencies() {
|
|
|
87
87
|
console.log(pc.red("Please install the required dependencies before continuing."));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
export async function getDockerComposeCommand() {
|
|
91
|
+
try {
|
|
92
|
+
await execa("docker", ["compose", "version"]);
|
|
93
|
+
return "docker compose";
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
try {
|
|
97
|
+
await execa("docker-compose", ["version"]);
|
|
98
|
+
return "docker-compose";
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return "docker compose";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
90
105
|
export function showClaudeMaxWarning() {
|
|
91
106
|
console.log();
|
|
92
107
|
console.log(pc.yellow("╔═══════════════════════════════════════════════════════════════════════╗"));
|
package/dist/init.js
CHANGED
|
@@ -5,7 +5,7 @@ import path from "path";
|
|
|
5
5
|
import os from "os";
|
|
6
6
|
import { execa } from "execa";
|
|
7
7
|
import { replacePlaceholders } from "./replace.js";
|
|
8
|
-
import { checkDependencies, showClaudeMaxWarning } from "./checks.js";
|
|
8
|
+
import { checkDependencies, showClaudeMaxWarning, getDockerComposeCommand } from "./checks.js";
|
|
9
9
|
const REPO = "naimozcan/nyoworks-framework";
|
|
10
10
|
const BRANCH = "main";
|
|
11
11
|
const AVAILABLE_FEATURES = [
|
|
@@ -23,6 +23,16 @@ const AVAILABLE_PLATFORMS = [
|
|
|
23
23
|
{ title: "Mobile", value: "mobile", description: "Expo SDK 54" },
|
|
24
24
|
{ title: "Desktop", value: "desktop", description: "Tauri 2.0" },
|
|
25
25
|
];
|
|
26
|
+
const AVAILABLE_LANGUAGES = [
|
|
27
|
+
{ title: "Turkish", value: "tr", description: "Türkçe yanıtlar" },
|
|
28
|
+
{ title: "English", value: "en", description: "English responses" },
|
|
29
|
+
{ title: "Dutch", value: "nl", description: "Nederlandse antwoorden" },
|
|
30
|
+
];
|
|
31
|
+
const LANGUAGE_RESPONSES = {
|
|
32
|
+
tr: "Turkish",
|
|
33
|
+
en: "English",
|
|
34
|
+
nl: "Dutch",
|
|
35
|
+
};
|
|
26
36
|
function generateCode(name) {
|
|
27
37
|
return name
|
|
28
38
|
.toUpperCase()
|
|
@@ -80,6 +90,13 @@ export async function createProject(projectName) {
|
|
|
80
90
|
hint: "- Space to select. Return to submit",
|
|
81
91
|
instructions: false,
|
|
82
92
|
},
|
|
93
|
+
{
|
|
94
|
+
type: "select",
|
|
95
|
+
name: "language",
|
|
96
|
+
message: "Agent response language:",
|
|
97
|
+
choices: AVAILABLE_LANGUAGES,
|
|
98
|
+
initial: 0,
|
|
99
|
+
},
|
|
83
100
|
]);
|
|
84
101
|
if (!response.name && !projectName) {
|
|
85
102
|
console.log(pc.red("Aborted."));
|
|
@@ -91,6 +108,7 @@ export async function createProject(projectName) {
|
|
|
91
108
|
const databaseName = generateDatabaseName(name);
|
|
92
109
|
const platforms = response.platforms || ["web"];
|
|
93
110
|
const features = response.features || [];
|
|
111
|
+
const language = response.language || "tr";
|
|
94
112
|
const targetDir = path.resolve(process.cwd(), slug);
|
|
95
113
|
if (fs.existsSync(targetDir)) {
|
|
96
114
|
console.log(pc.red(`Directory ${slug} already exists.`));
|
|
@@ -142,9 +160,11 @@ export async function createProject(projectName) {
|
|
|
142
160
|
"pnpm-workspace.yaml",
|
|
143
161
|
"turbo.json",
|
|
144
162
|
"tsconfig.json",
|
|
163
|
+
"tsconfig.base.json",
|
|
145
164
|
".env.example",
|
|
146
165
|
".gitignore",
|
|
147
166
|
"nyoworks.config.yaml",
|
|
167
|
+
"docker-compose.yml",
|
|
148
168
|
];
|
|
149
169
|
for (const file of rootFiles) {
|
|
150
170
|
const src = path.join(repoDir, file);
|
|
@@ -160,6 +180,7 @@ export async function createProject(projectName) {
|
|
|
160
180
|
"${PROJECT_CODE}": code,
|
|
161
181
|
"${PROJECT_SLUG}": slug,
|
|
162
182
|
"${DATABASE_NAME}": databaseName,
|
|
183
|
+
"${RESPONSE_LANGUAGE}": LANGUAGE_RESPONSES[language] || "Turkish",
|
|
163
184
|
};
|
|
164
185
|
process.stdout.write(pc.dim(" Replacing placeholders..."));
|
|
165
186
|
await replacePlaceholders(targetDir, placeholders);
|
|
@@ -214,13 +235,14 @@ See \`docs/bible/data/schema.md\`
|
|
|
214
235
|
console.log();
|
|
215
236
|
console.log(pc.green(pc.bold("Project created successfully!")));
|
|
216
237
|
await checkDependencies();
|
|
238
|
+
const dockerCmd = await getDockerComposeCommand();
|
|
217
239
|
showClaudeMaxWarning();
|
|
218
240
|
console.log();
|
|
219
241
|
console.log(pc.bold(" Next steps:"));
|
|
220
242
|
console.log();
|
|
221
243
|
console.log(pc.cyan(` cd ${slug}`));
|
|
222
244
|
console.log(pc.cyan(" pnpm install"));
|
|
223
|
-
console.log(pc.cyan(
|
|
245
|
+
console.log(pc.cyan(` ${dockerCmd} up -d`) + " " + pc.dim("# Start PostgreSQL & Redis"));
|
|
224
246
|
console.log(pc.cyan(" pnpm dev"));
|
|
225
247
|
console.log();
|
|
226
248
|
console.log(pc.dim(" Optional:"));
|
|
@@ -232,5 +254,34 @@ See \`docs/bible/data/schema.md\`
|
|
|
232
254
|
console.log(pc.dim(` Code: ${code}`));
|
|
233
255
|
console.log(pc.dim(` Platforms: ${platforms.join(", ")}`));
|
|
234
256
|
console.log(pc.dim(` Features: ${features.join(", ") || "none"}`));
|
|
257
|
+
console.log(pc.dim(` Language: ${LANGUAGE_RESPONSES[language] || "Turkish"}`));
|
|
235
258
|
console.log();
|
|
259
|
+
process.stdout.write(pc.dim(" Building MCP server..."));
|
|
260
|
+
const mcpPath = path.join(targetDir, "mcp-server");
|
|
261
|
+
try {
|
|
262
|
+
await execa("pnpm", ["install"], { cwd: mcpPath });
|
|
263
|
+
await execa("pnpm", ["build"], { cwd: mcpPath });
|
|
264
|
+
console.log(pc.green(" done"));
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
console.log(pc.yellow(" failed"));
|
|
268
|
+
if (error instanceof Error) {
|
|
269
|
+
console.log(pc.dim(` Error: ${error.message.split("\n")[0]}`));
|
|
270
|
+
}
|
|
271
|
+
console.log(pc.dim(" Run manually: cd mcp-server && pnpm install && pnpm build"));
|
|
272
|
+
}
|
|
273
|
+
const mcpConfigPath = path.join(targetDir, ".claude", "settings.local.json");
|
|
274
|
+
const mcpConfig = {
|
|
275
|
+
mcpServers: {
|
|
276
|
+
nyoworks: {
|
|
277
|
+
command: "node",
|
|
278
|
+
args: [path.join(targetDir, "mcp-server", "dist", "index.js")],
|
|
279
|
+
env: {
|
|
280
|
+
PROJECT_ROOT: targetDir,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
await fs.outputJson(mcpConfigPath, mcpConfig, { spaces: 2 });
|
|
286
|
+
console.log(pc.dim(" Created .claude/settings.local.json"));
|
|
236
287
|
}
|