create-kyro 0.1.1 → 0.1.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/src/prompts.ts DELETED
@@ -1,164 +0,0 @@
1
- import prompts from 'prompts';
2
- import { validateProjectName } from './validators.js';
3
-
4
- export interface Answers {
5
- projectName: string;
6
- database: 'sqlite' | 'postgres' | 'mysql' | 'mongodb';
7
- apis: ('rest' | 'graphql' | 'trpc' | 'websocket')[];
8
- styling: 'tailwind' | 'cssmodules' | 'styled' | 'none';
9
- auth: boolean;
10
- versioning: boolean;
11
- admin: boolean;
12
- template: 'minimal' | 'blog' | 'ecommerce';
13
- }
14
-
15
- export async function promptUser(): Promise<Answers> {
16
- const response = await prompts([
17
- {
18
- type: 'text',
19
- name: 'projectName',
20
- message: 'Project name:',
21
- initial: 'my-kyro-app',
22
- validate: validateProjectName
23
- },
24
- {
25
- type: 'select',
26
- name: 'database',
27
- message: 'Database:',
28
- hint: ' ',
29
- choices: [
30
- {
31
- title: 'SQLite (local-first, zero config)',
32
- description: 'Best for development and small projects. No setup required.',
33
- value: 'sqlite'
34
- },
35
- {
36
- title: 'PostgreSQL',
37
- description: 'Recommended for production. Robust and scalable.',
38
- value: 'postgres'
39
- },
40
- {
41
- title: 'MySQL',
42
- description: 'Popular choice for web applications.',
43
- value: 'mysql'
44
- },
45
- {
46
- title: 'MongoDB',
47
- description: 'Best for flexible, document-based schemas.',
48
- value: 'mongodb'
49
- }
50
- ]
51
- },
52
- {
53
- type: 'multiselect',
54
- name: 'apis',
55
- message: 'API protocols (select multiple):',
56
- hint: 'Space to select, Enter to confirm',
57
- instructions: false,
58
- choices: [
59
- {
60
- title: 'REST',
61
- description: 'Simple HTTP API, great for any client',
62
- value: 'rest',
63
- selected: true
64
- },
65
- {
66
- title: 'GraphQL',
67
- description: 'Flexible query language, great for complex data',
68
- value: 'graphql',
69
- selected: true
70
- },
71
- {
72
- title: 'tRPC',
73
- description: 'End-to-end typesafe APIs, great for TypeScript',
74
- value: 'trpc'
75
- },
76
- {
77
- title: 'WebSocket',
78
- description: 'Real-time bidirectional communication',
79
- value: 'websocket'
80
- }
81
- ]
82
- },
83
- {
84
- type: 'select',
85
- name: 'styling',
86
- message: 'Styling:',
87
- hint: ' ',
88
- choices: [
89
- {
90
- title: 'Tailwind CSS',
91
- description: 'Utility-first CSS framework, excellent DX',
92
- value: 'tailwind'
93
- },
94
- {
95
- title: 'CSS Modules',
96
- description: 'Scoped CSS, no extra dependencies',
97
- value: 'cssmodules'
98
- },
99
- {
100
- title: 'Styled Components',
101
- description: 'CSS-in-JS with tagged template literals',
102
- value: 'styled'
103
- },
104
- {
105
- title: 'None',
106
- description: 'Bring your own styling solution',
107
- value: 'none'
108
- }
109
- ]
110
- },
111
- {
112
- type: 'toggle',
113
- name: 'auth',
114
- message: 'Add authentication (JWT)?',
115
- active: 'Yes',
116
- inactive: 'No'
117
- },
118
- {
119
- type: 'toggle',
120
- name: 'versioning',
121
- message: 'Add versioning/drafts?',
122
- active: 'Yes',
123
- inactive: 'No'
124
- },
125
- {
126
- type: 'toggle',
127
- name: 'admin',
128
- message: 'Include admin dashboard?',
129
- initial: true,
130
- active: 'Yes',
131
- inactive: 'No'
132
- },
133
- {
134
- type: 'select',
135
- name: 'template',
136
- message: 'Starting template:',
137
- hint: ' ',
138
- choices: [
139
- {
140
- title: 'Minimal',
141
- description: 'Basic configuration with one example collection',
142
- value: 'minimal'
143
- },
144
- {
145
- title: 'Blog',
146
- description: 'Posts, categories, tags, and media library',
147
- value: 'blog'
148
- },
149
- {
150
- title: 'E-commerce',
151
- description: 'Products, orders, customers, inventory, and coupons',
152
- value: 'ecommerce'
153
- }
154
- ]
155
- }
156
- ], {
157
- onCancel: () => {
158
- console.log('\nCancelled.');
159
- process.exit(1);
160
- }
161
- });
162
-
163
- return response as Answers;
164
- }
@@ -1,60 +0,0 @@
1
- import kolorist from 'kolorist';
2
-
3
- const { cyan, green, yellow, red, bold, dim } = kolorist;
4
-
5
- export const logger = {
6
- intro: (name: string, version: string) => {
7
- console.log(`
8
- ${bold(cyan(`██████╗ ███████╗██╗ ██╗██████╗ ███████╗`))}
9
- ${bold(cyan(`██╔══██╗██╔════╝██║ ██║██╔══██╗██╔════╝`))}
10
- ${bold(cyan(`██████╔╝███████╗██║ ██║██████╔╝███████╗`))}
11
- ${bold(cyan(`██╔═══╝ ╚════██║██║ ██║██╔═══╝ ╚════██║`))}
12
- ${bold(cyan(`██║ ███████║╚██████╔╝██║ ███████║`))}
13
- ${bold(cyan(`╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚══════╝`))}
14
- ${dim(`v${version}`)}
15
- ${dim('Astro-native headless CMS')}
16
- `);
17
- },
18
-
19
- success: (msg: string) => {
20
- console.log(`${green('✓')} ${msg}`);
21
- },
22
-
23
- error: (msg: string) => {
24
- console.log(`${red('✗')} ${msg}`);
25
- },
26
-
27
- warning: (msg: string) => {
28
- console.log(`${yellow('⚠')} ${msg}`);
29
- },
30
-
31
- info: (msg: string) => {
32
- console.log(`${cyan('ℹ')} ${msg}`);
33
- },
34
-
35
- step: (num: number, total: number, msg: string) => {
36
- console.log(`${dim(`[${num}/${total}]`)} ${msg}`);
37
- },
38
-
39
- heading: (msg: string) => {
40
- console.log(`\n${bold(cyan(msg))}`);
41
- },
42
-
43
- subheading: (msg: string) => {
44
- console.log(`\n${bold(msg)}`);
45
- },
46
-
47
- list: (items: string[]) => {
48
- items.forEach(item => {
49
- console.log(` ${green('•')} ${item}`);
50
- });
51
- },
52
-
53
- done: () => {
54
- console.log(`\n${green(bold('Done!'))} Project created successfully.\n`);
55
- },
56
-
57
- prompt: (msg: string) => {
58
- console.log(`\n${cyan('?')} ${bold(msg)}`);
59
- }
60
- };
package/src/validators.ts DELETED
@@ -1,36 +0,0 @@
1
- export function validateProjectName(name: string): string | true {
2
- if (!name) {
3
- return 'Project name is required';
4
- }
5
-
6
- if (!/^[a-z0-9-]+$/.test(name)) {
7
- return 'Use lowercase letters, numbers, and hyphens only';
8
- }
9
-
10
- if (name.length < 2) {
11
- return 'Project name must be at least 2 characters';
12
- }
13
-
14
- if (name.length > 50) {
15
- return 'Project name must be less than 50 characters';
16
- }
17
-
18
- if (/^[-0-9]/.test(name)) {
19
- return 'Project name cannot start with a number or hyphen';
20
- }
21
-
22
- const reserved = ['node_modules', 'dist', 'build', 'public', 'src', 'test', 'tests'];
23
- if (reserved.includes(name)) {
24
- return `"${name}" is a reserved name`;
25
- }
26
-
27
- return true;
28
- }
29
-
30
- export function validateEmail(email: string): string | true {
31
- if (!email) return true;
32
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
33
- return 'Invalid email address';
34
- }
35
- return true;
36
- }
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "outDir": "./dist",
10
- "declaration": true,
11
- "lib": ["ES2022"]
12
- },
13
- "include": ["src/**/*"],
14
- "exclude": ["node_modules", "dist"]
15
- }
package/tsup.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts'],
5
- format: ['esm'],
6
- dts: true,
7
- splitting: false,
8
- clean: true,
9
- target: 'node18',
10
- platform: 'node'
11
- });