desen 1.0.0-draft.2 → 1.0.0-draft.4

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > desen@1.0.0-draft.2 build /Users/selmanay/Desktop/desen/packages/react
3
+ > desen@1.0.0-draft.4 build /Users/selmanay/Desktop/desen/packages/react
4
4
  > tsc
5
5
 
package/dist/bin.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
- declare const args: string[];
3
- declare const command: string;
2
+ export {};
package/dist/bin.js CHANGED
@@ -1,17 +1,39 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- const args = process.argv.slice(2);
4
- const command = args[0];
5
- if (command === "daemon" || command === "audit") {
6
- // This will execute the exported CLI process from desen-cli since it runs side-effects directly
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const prompts_1 = require("@clack/prompts");
8
+ const picocolors_1 = __importDefault(require("picocolors"));
9
+ async function main() {
10
+ const args = process.argv.slice(2);
11
+ const command = args[0];
12
+ // If a command is passed directly (e.g., npx desen daemon), execute it without the wizard
13
+ if (command === "daemon" || command === "audit" || command === "generate") {
14
+ require("desen-cli");
15
+ return;
16
+ }
17
+ // Otherwise, show the interactive wizard
18
+ console.clear();
19
+ (0, prompts_1.intro)(picocolors_1.default.bgCyan(picocolors_1.default.black(' 💠 DESEN Protocol ')));
20
+ const selectedCommand = await (0, prompts_1.select)({
21
+ message: 'Ne yapmak istersin?',
22
+ options: [
23
+ { value: 'daemon', label: '🚀 Daemon Sunucusunu Başlat (Figma Sync)' },
24
+ { value: 'audit', label: '🛡️ Anayasayı Denetle (Audit / Validate)' },
25
+ { value: 'generate', label: '📦 Yeni Bir DESEN Workspace Oluştur (Generate)' },
26
+ { value: 'exit', label: '❌ Çıkış' }
27
+ ],
28
+ });
29
+ if ((0, prompts_1.isCancel)(selectedCommand) || selectedCommand === 'exit') {
30
+ (0, prompts_1.outro)('İyi çalışmalar! 👋');
31
+ process.exit(0);
32
+ }
33
+ (0, prompts_1.outro)(picocolors_1.default.green(`Seçilen işlem başlatılıyor: ${selectedCommand}...`));
34
+ // Modify process.argv to act as if the user typed the command directly
35
+ process.argv = [process.argv[0], process.argv[1], selectedCommand];
36
+ // Trigger desen-cli
7
37
  require("desen-cli");
8
38
  }
9
- else {
10
- console.log(`
11
- \x1b[36m💠 DESEN Protocol CLI\x1b[0m
12
-
13
- Usage:
14
- \x1b[1mnpx desen daemon\x1b[0m Start the local synchronization daemon
15
- \x1b[1mnpx desen audit\x1b[0m Audit DESEN JSON files
16
- `);
17
- }
39
+ main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desen",
3
- "version": "1.0.0-draft.2",
3
+ "version": "1.0.0-draft.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -12,10 +12,12 @@
12
12
  "desen": "./dist/bin.js"
13
13
  },
14
14
  "dependencies": {
15
+ "@clack/prompts": "^0.7.0",
16
+ "picocolors": "^1.0.0",
15
17
  "react": "^18.2.0",
16
18
  "react-dom": "^18.2.0",
17
- "desen-core": "1.0.0-draft.2",
18
- "desen-cli": "1.0.0-draft.2"
19
+ "desen-core": "1.0.0-draft.4",
20
+ "desen-cli": "1.0.0-draft.4"
19
21
  },
20
22
  "devDependencies": {
21
23
  "typescript": "^5.0.0",
package/src/bin.ts CHANGED
@@ -1,17 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const args = process.argv.slice(2);
4
- const command = args[0];
3
+ import { intro, select, outro, isCancel, spinner } from '@clack/prompts';
4
+ import pc from 'picocolors';
5
5
 
6
- if (command === "daemon" || command === "audit") {
7
- // This will execute the exported CLI process from desen-cli since it runs side-effects directly
6
+ async function main() {
7
+ const args = process.argv.slice(2);
8
+ const command = args[0];
9
+
10
+ // If a command is passed directly (e.g., npx desen daemon), execute it without the wizard
11
+ if (command === "daemon" || command === "audit" || command === "generate") {
8
12
  require("desen-cli");
9
- } else {
10
- console.log(`
11
- \x1b[36m💠 DESEN Protocol CLI\x1b[0m
12
-
13
- Usage:
14
- \x1b[1mnpx desen daemon\x1b[0m Start the local synchronization daemon
15
- \x1b[1mnpx desen audit\x1b[0m Audit DESEN JSON files
16
- `);
13
+ return;
14
+ }
15
+
16
+ // Otherwise, show the interactive wizard
17
+ console.clear();
18
+ intro(pc.bgCyan(pc.black(' 💠 DESEN Protocol ')));
19
+
20
+ const selectedCommand = await select({
21
+ message: 'Ne yapmak istersin?',
22
+ options: [
23
+ { value: 'daemon', label: '🚀 Daemon Sunucusunu Başlat (Figma Sync)' },
24
+ { value: 'audit', label: '🛡️ Anayasayı Denetle (Audit / Validate)' },
25
+ { value: 'generate', label: '📦 Yeni Bir DESEN Workspace Oluştur (Generate)' },
26
+ { value: 'exit', label: '❌ Çıkış' }
27
+ ],
28
+ });
29
+
30
+ if (isCancel(selectedCommand) || selectedCommand === 'exit') {
31
+ outro('İyi çalışmalar! 👋');
32
+ process.exit(0);
33
+ }
34
+
35
+ outro(pc.green(`Seçilen işlem başlatılıyor: ${selectedCommand}...`));
36
+
37
+ // Modify process.argv to act as if the user typed the command directly
38
+ process.argv = [process.argv[0], process.argv[1], selectedCommand as string];
39
+
40
+ // Trigger desen-cli
41
+ require("desen-cli");
17
42
  }
43
+
44
+ main().catch(console.error);