create-letswhim 1.1.6 → 2.0.2

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 +106 -13
  2. package/package.json +14 -4
package/index.js CHANGED
@@ -2,22 +2,115 @@
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
7
 
6
- const projectName = process.argv[2] || "my-whim-project";
7
- const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git"; // URL BARU
8
+ // --- FRAME 1: Orang Jalan di Tempat Bawa Papan ---
9
+ const walkingFrames = [
10
+ ` ${pc.blue(' ( ) ')}
11
+ ${pc.blue(' /| |\\ ')}
12
+ ${pc.blue(' / \\ ')}
13
+ ${pc.cyan('~~~~~~~~~~')}`,
14
+ ` ${pc.blue(' ( ) ')}
15
+ ${pc.blue(' | |/ ')}
16
+ ${pc.blue(' | | ')}
17
+ ${pc.cyan('~~~~~~~~~~')}`
18
+ ];
8
19
 
9
- console.log(`\nšŸš€ Preparing your Lightweight project: ${projectName}...`);
20
+ // --- FRAME 2: Orang Menerjang Ombak (Victory) ---
21
+ const surfingArt = `
22
+ ${pc.blue(' ( ) /')}
23
+ ${pc.blue(' /| |/')}
24
+ ${pc.blue(' /_|_|/')} ${pc.white("let's just start")}
25
+ ${pc.cyan('~')} ${pc.blue(' / \\')}
26
+ ${pc.cyan('~~~')} ${pc.blue(' / \\')}
27
+ ${pc.cyan('~~~~~')} ${pc.blue(' / \\')}
28
+ ${pc.cyan('~~~~~~~~~~~~~~~~~~~~~~~~~~~~')}
29
+ `;
10
30
 
11
- try {
12
- // CLONE TANPA -b starter
13
- execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
31
+ async function startLoading(message) {
32
+ const total = 40;
33
+ let frameIndex = 0;
34
+ console.log('\n\n\n\n');
14
35
 
15
- const gitFolder = path.join(process.cwd(), projectName, '.git');
16
- if (fs.existsSync(gitFolder)) {
17
- fs.rmSync(gitFolder, { recursive: true, force: true });
36
+ for (let i = 0; i <= total; i++) {
37
+ const percent = Math.round((i / total) * 100);
38
+ const bar = pc.blue('ā–ˆ').repeat(i) + pc.gray('ā–‘').repeat(total - i);
39
+
40
+ // Reset kursor ke atas (5 baris)
41
+ process.stdout.write('\u001b[5A');
42
+
43
+ // Render Frame Jalan
44
+ console.log(walkingFrames[frameIndex]);
45
+
46
+ // Render Progress Bar
47
+ console.log(`${pc.cyan('ā–¹')} ${pc.white(message)}`);
48
+ process.stdout.write(` ${bar} ${pc.blue(percent + '%')}\r`);
49
+
50
+ if (i % 3 === 0) frameIndex = frameIndex === 0 ? 1 : 0;
51
+ await new Promise(resolve => setTimeout(resolve, 50));
52
+ }
53
+ console.log('\n');
54
+ }
55
+
56
+ async function init() {
57
+ // Clear Terminal Biar Aesthetic
58
+ process.stdout.write('\x1Bc');
59
+
60
+ console.log(`\n${pc.bold(pc.blue('🌊 LETSWHIM'))} ${pc.gray('v2.0.2')}`);
61
+ console.log(`${pc.white('The Ultralight Web Engine for Modern Logic')}\n`);
62
+
63
+ const response = await prompts({
64
+ type: 'text',
65
+ name: 'projectName',
66
+ message: pc.cyan('?') + ' Project name:',
67
+ initial: process.argv[2] || 'my-whim-project'
68
+ });
69
+
70
+ const projectName = response.projectName || 'my-whim-project';
71
+ const targetDir = path.join(process.cwd(), projectName);
72
+ const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git";
73
+
74
+ if (fs.existsSync(targetDir)) {
75
+ console.log(`\n${pc.red('āœ–')} ${pc.bold('Error:')} Directory ${pc.cyan(projectName)} already exists.`);
76
+ process.exit(1);
77
+ }
78
+
79
+ // 1. ANIMASI JALAN DI TEMPAT
80
+ await startLoading('Preparing your surfboard...');
81
+
82
+ try {
83
+ // 2. PROSES CLONE
84
+ process.stdout.write(`${pc.blue('ā–¹')} ${pc.gray('Catching the waves (Cloning template)...')}`);
85
+ execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
86
+
87
+ // 3. PAKSA HAPUS .GIT (Anti ENOTEMPTY)
88
+ const gitFolder = path.join(targetDir, '.git');
89
+ if (fs.existsSync(gitFolder)) {
90
+ try {
91
+ fs.rmSync(gitFolder, { recursive: true, force: true });
92
+ } catch (e) {
93
+ const cmd = process.platform === 'win32' ? `rmdir /s /q "${gitFolder}"` : `rm -rf "${gitFolder}"`;
94
+ execSync(cmd);
95
+ }
96
+ }
97
+
98
+ // 4. DISPLAY SURFER MENERJANG OMBAK
99
+ console.log(`\n\n${pc.bold(pc.blue('šŸš€ MISSION ACCOMPLISHED'))}`);
100
+ console.log(surfingArt);
101
+
102
+ console.log(`${pc.gray('Project created at')} ${pc.cyan(`./${projectName}`)}`);
103
+
104
+ console.log(`\n${pc.bold(pc.white('Next steps to surf:'))}`);
105
+ console.log(` ${pc.blue('1.')} cd ${pc.white(projectName)}`);
106
+ console.log(` ${pc.blue('2.')} npm install`);
107
+ console.log(` ${pc.blue('3.')} npm run dev`);
108
+
109
+ console.log(`\n${pc.gray("Happy surfing, Developer!")} šŸ„ā€ā™‚ļø\n`);
110
+
111
+ } catch (error) {
112
+ console.log(`\n${pc.red('āœ–')} ${pc.bold('Wipeout! (Error):')} ${pc.gray(error.message)}`);
18
113
  }
114
+ }
19
115
 
20
- console.log(`\nāœ… Project created! Let's start whiming.\n`);
21
- } catch (error) {
22
- console.log(`\nāŒ Bjir, ada error: ${error.message}`);
23
- }
116
+ init();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-letswhim",
3
- "version": "1.1.6",
4
- "description": "The official human-readable starter for LetsWhim Framework.",
3
+ "version": "2.0.2",
4
+ "description": "The official ultralight CLI to initialize your LetsWhim project in seconds.",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "bin": {
@@ -10,12 +10,22 @@
10
10
  "keywords": [
11
11
  "letswhim",
12
12
  "ssg",
13
+ "l-lang",
13
14
  "terminal-ui",
14
15
  "minimalist-framework",
15
- "human-readable"
16
+ "human-readable",
17
+ "ultralight"
16
18
  ],
17
- "author": "Rifky",
19
+ "author": "Rifky <rifky@keemail.me>",
18
20
  "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/ripkiiii/letswhim-official.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/ripkiiii/letswhim-official/issues"
27
+ },
28
+ "homepage": "https://letswhim.pages.dev",
19
29
  "dependencies": {
20
30
  "picocolors": "^1.0.0",
21
31
  "prompts": "^2.4.2"