create-kyro 0.4.0 → 0.4.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/README.md CHANGED
@@ -18,7 +18,7 @@ npx create-kyro
18
18
 
19
19
  1. **Interactive Setup** - Prompts for:
20
20
  - Project name
21
- - Database (SQLite, PostgreSQL, MySQL, MongoDB)
21
+ - Database (SQLite, PostgreSQL, MongoDB)
22
22
  - Starting template (Minimal, Blog, E-commerce, Kitchen Sink)
23
23
 
24
24
  2. **Project Generation** - Creates:
package/dist/index.js CHANGED
@@ -52,11 +52,6 @@ async function promptUser() {
52
52
  description: "Recommended for production. Robust and scalable.",
53
53
  value: "postgres"
54
54
  },
55
- {
56
- title: "MySQL",
57
- description: "Popular choice for web applications.",
58
- value: "mysql"
59
- },
60
55
  {
61
56
  title: "MongoDB",
62
57
  description: "Best for flexible, document-based schemas.",
@@ -162,11 +157,6 @@ function generatePackageJson(answers) {
162
157
  const devDeps = {
163
158
  "typescript": "^5.7.3"
164
159
  };
165
- if (answers.database === "postgres") {
166
- deps["pg"] = "^8.13.1";
167
- } else if (answers.database === "mysql") {
168
- deps["mysql2"] = "^3.12.0";
169
- }
170
160
  const scripts = {
171
161
  "dev": "astro dev",
172
162
  "build": "astro build",
@@ -198,15 +188,13 @@ function generateKyroConfig(answers) {
198
188
  imports.push("import { createLocalAdapter } from '@kyro-cms/core';");
199
189
  } else if (answers.database === "postgres") {
200
190
  imports.push("import { createDrizzleAdapter } from '@kyro-cms/core';");
201
- } else if (answers.database === "mysql") {
202
- imports.push("import { createDrizzleAdapter } from '@kyro-cms/core';");
203
191
  } else if (answers.database === "mongodb") {
204
192
  imports.push("import { createMongoDBAdapter } from '@kyro-cms/core';");
205
193
  }
206
194
  const adapterLines = [];
207
195
  if (answers.database === "sqlite") {
208
196
  adapterLines.push(` adapter: createLocalAdapter({ path: './data.db' }),`);
209
- } else if (answers.database === "postgres" || answers.database === "mysql") {
197
+ } else if (answers.database === "postgres") {
210
198
  adapterLines.push(` adapter: createDrizzleAdapter({`);
211
199
  adapterLines.push(` connectionString: process.env.DATABASE_URL,`);
212
200
  adapterLines.push(` }),`);
@@ -301,7 +289,11 @@ function generateProjectFiles(answers, projectDir) {
301
289
  mkdirSync(pagesDir, { recursive: true });
302
290
  mkdirSync(publicDir, { recursive: true });
303
291
  if (answers.database === "sqlite") {
304
- mkdirSync(join(projectDir, "data"), { recursive: true });
292
+ envDbSection = "# SQLite (local) - no additional config needed";
293
+ } else if (answers.database === "postgres") {
294
+ envDbSection = "# Database connection (PostgreSQL)\nDATABASE_URL=postgresql://user:password@localhost:5432/kyro_cms";
295
+ } else {
296
+ envDbSection = "# MongoDB connection\nMONGODB_URI=mongodb://localhost:27017/kyro_cms";
305
297
  }
306
298
  const tsconfig = `{
307
299
  "extends": "astro/tsconfigs/strict",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kyro",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Interactive scaffolding for Kyro CMS projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -7,8 +7,6 @@ export function generateKyroConfig(answers: Answers): string {
7
7
  imports.push("import { createLocalAdapter } from '@kyro-cms/core';");
8
8
  } else if (answers.database === "postgres") {
9
9
  imports.push("import { createDrizzleAdapter } from '@kyro-cms/core';");
10
- } else if (answers.database === "mysql") {
11
- imports.push("import { createDrizzleAdapter } from '@kyro-cms/core';");
12
10
  } else if (answers.database === "mongodb") {
13
11
  imports.push("import { createMongoDBAdapter } from '@kyro-cms/core';");
14
12
  }
@@ -16,7 +14,7 @@ export function generateKyroConfig(answers: Answers): string {
16
14
  const adapterLines: string[] = [];
17
15
  if (answers.database === "sqlite") {
18
16
  adapterLines.push(` adapter: createLocalAdapter({ path: './data.db' }),`);
19
- } else if (answers.database === "postgres" || answers.database === "mysql") {
17
+ } else if (answers.database === "postgres") {
20
18
  adapterLines.push(` adapter: createDrizzleAdapter({`);
21
19
  adapterLines.push(` connectionString: process.env.DATABASE_URL,`);
22
20
  adapterLines.push(` }),`);
@@ -14,7 +14,11 @@ export function generateProjectFiles(
14
14
  mkdirSync(publicDir, { recursive: true });
15
15
 
16
16
  if (answers.database === "sqlite") {
17
- mkdirSync(join(projectDir, "data"), { recursive: true });
17
+ envDbSection = "# SQLite (local) - no additional config needed";
18
+ } else if (answers.database === "postgres") {
19
+ envDbSection = "# Database connection (PostgreSQL)\nDATABASE_URL=postgresql://user:password@localhost:5432/kyro_cms";
20
+ } else {
21
+ envDbSection = "# MongoDB connection\nMONGODB_URI=mongodb://localhost:27017/kyro_cms";
18
22
  }
19
23
 
20
24
  const tsconfig = `{
@@ -71,8 +75,8 @@ Visit [https://kyro.dev](https://kyro.dev) for full documentation.
71
75
  ${
72
76
  answers.database === "sqlite"
73
77
  ? "# SQLite (local) - no additional config needed"
74
- : answers.database === "postgres" || answers.database === "mysql"
75
- ? "# Database connection (PostgreSQL/MySQL)\nDATABASE_URL=postgresql://user:password@localhost:5432/kyro_cms"
78
+ : answers.database === "postgres"
79
+ ? "# Database connection (PostgreSQL)\nDATABASE_URL=postgresql://user:password@localhost:5432/kyro_cms"
76
80
  : "# MongoDB connection\nMONGODB_URI=mongodb://localhost:27017/kyro_cms"
77
81
  }
78
82
 
@@ -23,12 +23,6 @@ export function generatePackageJson(
23
23
  "typescript": "^5.7.3",
24
24
  };
25
25
 
26
- if (answers.database === "postgres") {
27
- deps["pg"] = "^8.13.1";
28
- } else if (answers.database === "mysql") {
29
- deps["mysql2"] = "^3.12.0";
30
- }
31
-
32
26
  const scripts: Record<string, string> = {
33
27
  "dev": "astro dev",
34
28
  "build": "astro build",
package/src/prompts.ts CHANGED
@@ -3,7 +3,7 @@ import { validateProjectName } from "./validators.js";
3
3
 
4
4
  export interface Answers {
5
5
  projectName: string;
6
- database: "sqlite" | "postgres" | "mysql" | "mongodb";
6
+ database: "sqlite" | "postgres" | "mongodb";
7
7
  template: "minimal" | "blog" | "ecommerce" | "kitchen-sink";
8
8
  }
9
9
 
@@ -34,11 +34,6 @@ export async function promptUser(): Promise<Answers> {
34
34
  description: "Recommended for production. Robust and scalable.",
35
35
  value: "postgres",
36
36
  },
37
- {
38
- title: "MySQL",
39
- description: "Popular choice for web applications.",
40
- value: "mysql",
41
- },
42
37
  {
43
38
  title: "MongoDB",
44
39
  description: "Best for flexible, document-based schemas.",
@@ -28,12 +28,6 @@ describe("generators", () => {
28
28
  expect(config).toContain("DATABASE_URL");
29
29
  });
30
30
 
31
- it("generates config with MySQL adapter", () => {
32
- const answers = { ...baseAnswers, database: "mysql" as const };
33
- const config = generateKyroConfig(answers);
34
- expect(config).toContain("createDrizzleAdapter");
35
- });
36
-
37
31
  it("generates config with MongoDB adapter", () => {
38
32
  const answers = { ...baseAnswers, database: "mongodb" as const };
39
33
  const config = generateKyroConfig(answers);
@@ -107,21 +101,6 @@ describe("generators", () => {
107
101
  expect(pkg.dependencies["astro"]).toBeDefined();
108
102
  });
109
103
 
110
- it("includes database-specific peer dependencies", () => {
111
- const pg = generatePackageJson({ ...baseAnswers, database: "postgres" });
112
- expect(pg.dependencies["pg"]).toBeDefined();
113
-
114
- const mysql = generatePackageJson({ ...baseAnswers, database: "mysql" });
115
- expect(mysql.dependencies["mysql2"]).toBeDefined();
116
- });
117
-
118
- it("includes SQLite scripts for SQLite database", () => {
119
- const pkg = generatePackageJson(baseAnswers);
120
- expect(pkg.scripts["db:generate"]).toBeDefined();
121
- expect(pkg.scripts["db:push"]).toBeDefined();
122
- expect(pkg.scripts["db:studio"]).toBeDefined();
123
- });
124
-
125
104
  it("has correct project name", () => {
126
105
  const pkg = generatePackageJson(baseAnswers);
127
106
  expect(pkg.name).toBe("test-project");