create-letswhim 2.0.2 → 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 +32 -44
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
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';
|
|
5
|
+
import pc from 'picocolors'; // Menggunakan picocolors
|
|
6
|
+
import prompts from 'prompts'; // Menggunakan prompts
|
|
7
7
|
|
|
8
|
-
// --- FRAME 1: Orang Jalan di Tempat
|
|
8
|
+
// --- FRAME 1: Orang Jalan di Tempat (NASA-Blue/Cyan) ---
|
|
9
9
|
const walkingFrames = [
|
|
10
|
-
` ${pc.
|
|
11
|
-
${pc.
|
|
12
|
-
${pc.
|
|
13
|
-
${pc.
|
|
14
|
-
` ${pc.
|
|
15
|
-
${pc.
|
|
16
|
-
${pc.
|
|
17
|
-
${pc.
|
|
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
18
|
];
|
|
19
19
|
|
|
20
|
-
// --- FRAME 2: Orang Menerjang Ombak (
|
|
20
|
+
// --- FRAME 2: Orang Menerjang Ombak (Success) ---
|
|
21
21
|
const surfingArt = `
|
|
22
|
-
${pc.
|
|
23
|
-
${pc.
|
|
24
|
-
${pc.
|
|
25
|
-
${pc.
|
|
26
|
-
${pc.
|
|
27
|
-
${pc.
|
|
28
|
-
${pc.
|
|
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
29
|
`;
|
|
30
30
|
|
|
31
31
|
async function startLoading(message) {
|
|
@@ -35,17 +35,13 @@ async function startLoading(message) {
|
|
|
35
35
|
|
|
36
36
|
for (let i = 0; i <= total; i++) {
|
|
37
37
|
const percent = Math.round((i / total) * 100);
|
|
38
|
-
|
|
38
|
+
// Ganti pc.blue ke pc.cyan biar gak ungu!
|
|
39
|
+
const bar = pc.cyan('█').repeat(i) + pc.gray('░').repeat(total - i);
|
|
39
40
|
|
|
40
|
-
// Reset kursor ke atas (5 baris)
|
|
41
41
|
process.stdout.write('\u001b[5A');
|
|
42
|
-
|
|
43
|
-
// Render Frame Jalan
|
|
44
42
|
console.log(walkingFrames[frameIndex]);
|
|
45
|
-
|
|
46
|
-
// Render Progress Bar
|
|
47
43
|
console.log(`${pc.cyan('▹')} ${pc.white(message)}`);
|
|
48
|
-
process.stdout.write(` ${bar} ${pc.
|
|
44
|
+
process.stdout.write(` ${bar} ${pc.cyan(percent + '%')}\r`);
|
|
49
45
|
|
|
50
46
|
if (i % 3 === 0) frameIndex = frameIndex === 0 ? 1 : 0;
|
|
51
47
|
await new Promise(resolve => setTimeout(resolve, 50));
|
|
@@ -54,10 +50,9 @@ async function startLoading(message) {
|
|
|
54
50
|
}
|
|
55
51
|
|
|
56
52
|
async function init() {
|
|
57
|
-
// Clear
|
|
58
|
-
process.stdout.write('\x1Bc');
|
|
53
|
+
process.stdout.write('\x1Bc'); // Clear terminal biar rapi
|
|
59
54
|
|
|
60
|
-
console.log(`\n${pc.bold(pc.
|
|
55
|
+
console.log(`\n${pc.bold(pc.cyan('🌊 LETSWHIM'))} ${pc.gray('v2.0.3')}`);
|
|
61
56
|
console.log(`${pc.white('The Ultralight Web Engine for Modern Logic')}\n`);
|
|
62
57
|
|
|
63
58
|
const response = await prompts({
|
|
@@ -76,35 +71,28 @@ async function init() {
|
|
|
76
71
|
process.exit(1);
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
// 1. ANIMASI JALAN DI TEMPAT
|
|
80
74
|
await startLoading('Preparing your surfboard...');
|
|
81
75
|
|
|
82
76
|
try {
|
|
83
|
-
|
|
84
|
-
process.stdout.write(`${pc.blue('▹')} ${pc.gray('Catching the waves (Cloning template)...')}`);
|
|
77
|
+
process.stdout.write(`${pc.cyan('▹')} ${pc.gray('Catching the waves (Cloning template)...')}`);
|
|
85
78
|
execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
|
|
86
79
|
|
|
87
|
-
//
|
|
80
|
+
// Hapus .git biar user punya repo bersih
|
|
88
81
|
const gitFolder = path.join(targetDir, '.git');
|
|
89
82
|
if (fs.existsSync(gitFolder)) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} catch (e) {
|
|
93
|
-
const cmd = process.platform === 'win32' ? `rmdir /s /q "${gitFolder}"` : `rm -rf "${gitFolder}"`;
|
|
94
|
-
execSync(cmd);
|
|
95
|
-
}
|
|
83
|
+
const cmd = process.platform === 'win32' ? `rmdir /s /q "${gitFolder}"` : `rm -rf "${gitFolder}"`;
|
|
84
|
+
execSync(cmd);
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
|
|
99
|
-
console.log(`\n\n${pc.bold(pc.blue('🚀 MISSION ACCOMPLISHED'))}`);
|
|
87
|
+
console.log(`\n\n${pc.bold(pc.cyan('🚀 MISSION ACCOMPLISHED'))}`);
|
|
100
88
|
console.log(surfingArt);
|
|
101
89
|
|
|
102
90
|
console.log(`${pc.gray('Project created at')} ${pc.cyan(`./${projectName}`)}`);
|
|
103
91
|
|
|
104
92
|
console.log(`\n${pc.bold(pc.white('Next steps to surf:'))}`);
|
|
105
|
-
console.log(` ${pc.
|
|
106
|
-
console.log(` ${pc.
|
|
107
|
-
console.log(` ${pc.
|
|
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`);
|
|
108
96
|
|
|
109
97
|
console.log(`\n${pc.gray("Happy surfing, Developer!")} 🏄♂️\n`);
|
|
110
98
|
|