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.
- package/index.js +61 -45
- 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
|
-
// ---
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
//
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
80
|
+
// Hapus .git biar user punya repo bersih
|
|
62
81
|
const gitFolder = path.join(targetDir, '.git');
|
|
63
82
|
if (fs.existsSync(gitFolder)) {
|
|
64
|
-
|
|
83
|
+
const cmd = process.platform === 'win32' ? `rmdir /s /q "${gitFolder}"` : `rm -rf "${gitFolder}"`;
|
|
84
|
+
execSync(cmd);
|
|
65
85
|
}
|
|
66
86
|
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
console.log(`\n\n${pc.bold(pc.cyan('🚀 MISSION ACCOMPLISHED'))}`);
|
|
88
|
+
console.log(surfingArt);
|
|
69
89
|
|
|
70
|
-
|
|
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.
|
|
76
|
-
console.log(` ${pc.
|
|
77
|
-
console.log(` ${pc.
|
|
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(
|
|
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
|
-
|
|
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
|
|