create-letswhim 2.0.1 → 2.0.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.
Files changed (2) hide show
  1. package/index.js +61 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,37 +2,59 @@
2
2
  import { execSync } from 'child_process';
3
3
  import path from 'path';
4
4
  import fs from 'fs';
5
- import pc from 'picocolors';
6
- import prompts from 'prompts';
7
-
8
- // --- Fungsi Animasi Spinner (Efek Gerak) ---
9
- function createSpinner(message) {
10
- const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
11
- let i = 0;
12
- const interval = setInterval(() => {
13
- process.stdout.write(`\r${pc.blue(frames[i])} ${pc.gray(message)}`);
14
- i = (i + 1) % frames.length;
15
- }, 80);
16
-
17
- return {
18
- stop: (success = true) => {
19
- clearInterval(interval);
20
- process.stdout.write('\r'); // Bersihkan baris
21
- if (success) {
22
- console.log(`${pc.blue('✓')} ${pc.gray(message)}`);
23
- } else {
24
- console.log(`${pc.red('×')} ${pc.gray(message)}`);
25
- }
5
+ import pc from 'picocolors'; // Menggunakan picocolors
6
+ import prompts from 'prompts'; // Menggunakan prompts
7
+
8
+ // --- FRAME 1: Orang Jalan di Tempat (NASA-Blue/Cyan) ---
9
+ const walkingFrames = [
10
+ ` ${pc.cyan(' ( ) ')}
11
+ ${pc.cyan(' /| |\\ ')}
12
+ ${pc.cyan(' / \\ ')}
13
+ ${pc.blue('~~~~~~~~~~')}`,
14
+ ` ${pc.cyan(' ( ) ')}
15
+ ${pc.cyan(' | |/ ')}
16
+ ${pc.cyan(' | | ')}
17
+ ${pc.blue('~~~~~~~~~~')}`
18
+ ];
19
+
20
+ // --- FRAME 2: Orang Menerjang Ombak (Success) ---
21
+ const surfingArt = `
22
+ ${pc.cyan(' ( ) /')}
23
+ ${pc.cyan(' /| |/')}
24
+ ${pc.cyan(' /_|_|/')} ${pc.white("let's just start")}
25
+ ${pc.blue('~')} ${pc.cyan(' / \\')}
26
+ ${pc.blue('~~~')} ${pc.cyan(' / \\')}
27
+ ${pc.blue('~~~~~')} ${pc.cyan(' / \\')}
28
+ ${pc.blue('~~~~~~~~~~~~~~~~~~~~~~~~~~~~')}
29
+ `;
30
+
31
+ async function startLoading(message) {
32
+ const total = 40;
33
+ let frameIndex = 0;
34
+ console.log('\n\n\n\n');
35
+
36
+ for (let i = 0; i <= total; i++) {
37
+ const percent = Math.round((i / total) * 100);
38
+ // Ganti pc.blue ke pc.cyan biar gak ungu!
39
+ const bar = pc.cyan('█').repeat(i) + pc.gray('░').repeat(total - i);
40
+
41
+ process.stdout.write('\u001b[5A');
42
+ console.log(walkingFrames[frameIndex]);
43
+ console.log(`${pc.cyan('▹')} ${pc.white(message)}`);
44
+ process.stdout.write(` ${bar} ${pc.cyan(percent + '%')}\r`);
45
+
46
+ if (i % 3 === 0) frameIndex = frameIndex === 0 ? 1 : 0;
47
+ await new Promise(resolve => setTimeout(resolve, 50));
26
48
  }
27
- };
49
+ console.log('\n');
28
50
  }
29
51
 
30
52
  async function init() {
31
- // Header - NASA Blue Style
32
- console.log(`\n${pc.bold(pc.blue('🌊 LETSWHIM'))} ${pc.gray('v1.1.6')}`);
53
+ process.stdout.write('\x1Bc'); // Clear terminal biar rapi
54
+
55
+ console.log(`\n${pc.bold(pc.cyan('🌊 LETSWHIM'))} ${pc.gray('v2.0.3')}`);
33
56
  console.log(`${pc.white('The Ultralight Web Engine for Modern Logic')}\n`);
34
57
 
35
- // 1. Tanya nama project (Interaktif ala Astro)
36
58
  const response = await prompts({
37
59
  type: 'text',
38
60
  name: 'projectName',
@@ -49,39 +71,33 @@ async function init() {
49
71
  process.exit(1);
50
72
  }
51
73
 
52
- console.log(''); // Spasi baris
53
-
54
- // 2. Mulai Animasi "Gerak" (Spinning)
55
- const loader = createSpinner('Syncing LetsWhim template...');
74
+ await startLoading('Preparing your surfboard...');
56
75
 
57
76
  try {
58
- // Proses Clone
77
+ process.stdout.write(`${pc.cyan('▹')} ${pc.gray('Catching the waves (Cloning template)...')}`);
59
78
  execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
60
79
 
61
- // Bersihkan Git lama
80
+ // Hapus .git biar user punya repo bersih
62
81
  const gitFolder = path.join(targetDir, '.git');
63
82
  if (fs.existsSync(gitFolder)) {
64
- fs.rmSync(gitFolder, { recursive: true, force: true });
83
+ const cmd = process.platform === 'win32' ? `rmdir /s /q "${gitFolder}"` : `rm -rf "${gitFolder}"`;
84
+ execSync(cmd);
65
85
  }
66
86
 
67
- // Stop animasi dengan tanda sukses
68
- loader.stop(true);
87
+ console.log(`\n\n${pc.bold(pc.cyan('🚀 MISSION ACCOMPLISHED'))}`);
88
+ console.log(surfingArt);
69
89
 
70
- // 3. Pesan Final & Instruksi
71
- console.log(`\n${pc.bold(pc.blue('🚀 MISSION ACCOMPLISHED'))}`);
72
- console.log(`${pc.gray('Your project is ready at')} ${pc.cyan(`./${projectName}`)}`);
90
+ console.log(`${pc.gray('Project created at')} ${pc.cyan(`./${projectName}`)}`);
73
91
 
74
- console.log(`\n${pc.bold(pc.white('Next steps:'))}`);
75
- console.log(` ${pc.blue('1.')} cd ${pc.white(projectName)}`);
76
- console.log(` ${pc.blue('2.')} npm install`);
77
- console.log(` ${pc.blue('3.')} npm run dev`);
92
+ console.log(`\n${pc.bold(pc.white('Next steps to surf:'))}`);
93
+ console.log(` ${pc.cyan('1.')} cd ${pc.white(projectName)}`);
94
+ console.log(` ${pc.cyan('2.')} npm install`);
95
+ console.log(` ${pc.cyan('3.')} npm run dev`);
78
96
 
79
- console.log(`\n${pc.gray('Note: Start editing in')} ${pc.blue('start/pages/index.lw')}`);
80
- console.log(`${pc.gray('Happy hacking, Rifky! 🏄‍♂️')}\n`);
97
+ console.log(`\n${pc.gray("Happy surfing, Developer!")} 🏄‍♂️\n`);
81
98
 
82
99
  } catch (error) {
83
- loader.stop(false);
84
- console.log(`\n${pc.red('✖')} ${pc.bold('Launch aborted:')} ${error.message}`);
100
+ console.log(`\n${pc.red('✖')} ${pc.bold('Wipeout! (Error):')} ${pc.gray(error.message)}`);
85
101
  }
86
102
  }
87
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-letswhim",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "The official ultralight CLI to initialize your LetsWhim project in seconds.",
5
5
  "type": "module",
6
6
  "main": "index.js",