zyket 1.2.4 → 1.2.6

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.
Files changed (3) hide show
  1. package/README.md +30 -1
  2. package/bin/cli.js +98 -11
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -6,7 +6,36 @@ Upon initial boot, Zyket automatically scaffolds a default project structure, in
6
6
 
7
7
  ## Getting Started
8
8
 
9
- To begin using Zyket, install it in your project:
9
+ ### Quick Start (Recommended)
10
+
11
+ The easiest way to get started with Zyket is to use the CLI initialization command:
12
+
13
+ ```bash
14
+ # Create a new directory for your project
15
+ mkdir my-zyket-app
16
+ cd my-zyket-app
17
+
18
+ # Install zyket
19
+ npm install zyket
20
+
21
+ # Initialize the project (one command!)
22
+ npx zyket init
23
+
24
+ # Start your application
25
+ npm run dev
26
+ ```
27
+
28
+ The `init` command will:
29
+ - Create an `index.js` file with the kernel boilerplate
30
+ - Generate a `.env` file with sensible defaults
31
+ - Create a `package.json` if one doesn't exist
32
+ - Set up your project ready to run
33
+
34
+ You can also run `npx zyket` without arguments for an interactive menu with more options.
35
+
36
+ ### Manual Setup (Alternative)
37
+
38
+ If you prefer to set up manually, install Zyket in your project:
10
39
 
11
40
  ```bash
12
41
  npm i zyket
package/bin/cli.js CHANGED
@@ -1,23 +1,110 @@
1
1
  #!/usr/bin/env node
2
2
  const prompts = require('prompts');
3
+ const fs = require('fs');
4
+ const path = require('path');
3
5
  const TemplateManager = require('../src/services/template-manager');
6
+ const EnvManager = require('../src/utils/EnvManager');
4
7
  const templateManager = new TemplateManager();
5
8
 
6
9
  (async () => {
7
10
  process.stdout.write("\u001b[2J\u001b[0;0H");
8
11
  await templateManager.boot();
9
- const response = await prompts({
10
- type: 'select',
11
- name: 'value',
12
- message: '[ZYKET] What do you want to do?',
13
- choices: [
14
- { title: 'Install Template', value: 'install-template', description: 'Install a new template', disabled: false },
15
- /*{ title: 'Remove Template', value: 'remove-template', description: 'Remove an existing template', disabled: false },*/
16
- ],
17
- initial: 0
18
- });
12
+
13
+ // Check for direct command (e.g., npx zyket init)
14
+ const args = process.argv.slice(2);
15
+ const directCommand = args[0];
16
+
17
+ let actionToRun = null;
18
+
19
+ if (directCommand === 'init') {
20
+ actionToRun = 'init-project';
21
+ } else {
22
+ // Show interactive menu
23
+ const response = await prompts({
24
+ type: 'select',
25
+ name: 'value',
26
+ message: '[ZYKET] What do you want to do?',
27
+ choices: [
28
+ { title: 'Initialize Project', value: 'init-project', description: 'Set up a new Zyket project', disabled: false },
29
+ { title: 'Install Template', value: 'install-template', description: 'Install a new template', disabled: false },
30
+ /*{ title: 'Remove Template', value: 'remove-template', description: 'Remove an existing template', disabled: false },*/
31
+ ],
32
+ initial: 0
33
+ });
34
+ actionToRun = response.value;
35
+ }
36
+
37
+ if (!actionToRun) {
38
+ console.log('[ZYKET] No action selected. Exiting.');
39
+ return;
40
+ }
19
41
 
20
42
  const actions = {
43
+ 'init-project': async () => {
44
+ const indexPath = path.join(process.cwd(), 'index.js');
45
+ const envPath = path.join(process.cwd(), '.env');
46
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
47
+
48
+ // Check if index.js already exists
49
+ if (fs.existsSync(indexPath)) {
50
+ const overwrite = await prompts({
51
+ type: 'confirm',
52
+ name: 'value',
53
+ message: '[ZYKET] index.js already exists. Overwrite?',
54
+ initial: false
55
+ });
56
+ if (!overwrite.value) {
57
+ console.log('[ZYKET] Initialization cancelled.');
58
+ return;
59
+ }
60
+ }
61
+
62
+ // Create .env file
63
+ console.log('[ZYKET] Creating .env file...');
64
+ EnvManager.createEnvFile(envPath);
65
+
66
+ // Create index.js with boilerplate code
67
+ console.log('[ZYKET] Creating index.js...');
68
+ const indexContent = `const { Kernel } = require('zyket');
69
+
70
+ const kernel = new Kernel();
71
+
72
+ kernel.boot().then(() => {
73
+ console.log('Kernel booted successfully!');
74
+ }).catch((error) => {
75
+ console.error('Error booting kernel:', error);
76
+ });
77
+ `;
78
+ fs.writeFileSync(indexPath, indexContent);
79
+
80
+ // Create package.json if it doesn't exist
81
+ if (!fs.existsSync(packageJsonPath)) {
82
+ console.log('[ZYKET] Creating package.json...');
83
+ const packageJson = {
84
+ name: path.basename(process.cwd()),
85
+ version: "1.0.0",
86
+ description: "Zyket application",
87
+ main: "index.js",
88
+ scripts: {
89
+ dev: "node index.js"
90
+ },
91
+ keywords: [],
92
+ author: "",
93
+ license: "ISC",
94
+ dependencies: {
95
+ zyket: "^1.2.3"
96
+ }
97
+ };
98
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
99
+ }
100
+
101
+ console.log('\n[ZYKET] ✅ Project initialized successfully!');
102
+ console.log('\n[ZYKET] Next steps:');
103
+ console.log(' 1. Review and update your .env file');
104
+ console.log(' 2. Run: npm install (if you haven\'t already)');
105
+ console.log(' 3. Run: npm run dev');
106
+ console.log('\n[ZYKET] Happy coding! 🚀\n');
107
+ },
21
108
  'install-template': async () => {
22
109
  const templates = templateManager.getTemplates();
23
110
  const response = await prompts({
@@ -47,5 +134,5 @@ const templateManager = new TemplateManager();
47
134
  }*/
48
135
  };
49
136
 
50
- await actions[response.value]();
137
+ await actions[actionToRun]();
51
138
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyket",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -17,6 +17,7 @@
17
17
  "@tailwindcss/vite": "^4.2.2",
18
18
  "@vitejs/plugin-react": "^6.0.1",
19
19
  "better-auth": "^1.5.6",
20
+ "better-sqlite3": "^12.8.0",
20
21
  "bullmq": "^5.71.0",
21
22
  "colors": "^1.4.0",
22
23
  "cors": "^2.8.6",