create-letswhim 1.1.6 → 2.0.1

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 +78 -13
  2. package/package.json +14 -4
package/index.js CHANGED
@@ -2,22 +2,87 @@
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
+ // --- 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);
8
16
 
9
- console.log(`\n🚀 Preparing your Lightweight project: ${projectName}...`);
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
+ }
26
+ }
27
+ };
28
+ }
10
29
 
11
- try {
12
- // CLONE TANPA -b starter
13
- execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
30
+ async function init() {
31
+ // Header - NASA Blue Style
32
+ console.log(`\n${pc.bold(pc.blue('🌊 LETSWHIM'))} ${pc.gray('v1.1.6')}`);
33
+ console.log(`${pc.white('The Ultralight Web Engine for Modern Logic')}\n`);
14
34
 
15
- const gitFolder = path.join(process.cwd(), projectName, '.git');
16
- if (fs.existsSync(gitFolder)) {
17
- fs.rmSync(gitFolder, { recursive: true, force: true });
35
+ // 1. Tanya nama project (Interaktif ala Astro)
36
+ const response = await prompts({
37
+ type: 'text',
38
+ name: 'projectName',
39
+ message: pc.cyan('?') + ' Project name:',
40
+ initial: process.argv[2] || 'my-whim-project'
41
+ });
42
+
43
+ const projectName = response.projectName || 'my-whim-project';
44
+ const targetDir = path.join(process.cwd(), projectName);
45
+ const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git";
46
+
47
+ if (fs.existsSync(targetDir)) {
48
+ console.log(`\n${pc.red('✖')} ${pc.bold('Error:')} Directory ${pc.cyan(projectName)} already exists.`);
49
+ process.exit(1);
50
+ }
51
+
52
+ console.log(''); // Spasi baris
53
+
54
+ // 2. Mulai Animasi "Gerak" (Spinning)
55
+ const loader = createSpinner('Syncing LetsWhim template...');
56
+
57
+ try {
58
+ // Proses Clone
59
+ execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
60
+
61
+ // Bersihkan Git lama
62
+ const gitFolder = path.join(targetDir, '.git');
63
+ if (fs.existsSync(gitFolder)) {
64
+ fs.rmSync(gitFolder, { recursive: true, force: true });
65
+ }
66
+
67
+ // Stop animasi dengan tanda sukses
68
+ loader.stop(true);
69
+
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}`)}`);
73
+
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`);
78
+
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`);
81
+
82
+ } catch (error) {
83
+ loader.stop(false);
84
+ console.log(`\n${pc.red('✖')} ${pc.bold('Launch aborted:')} ${error.message}`);
18
85
  }
86
+ }
19
87
 
20
- console.log(`\n✅ Project created! Let's start whiming.\n`);
21
- } catch (error) {
22
- console.log(`\n❌ Bjir, ada error: ${error.message}`);
23
- }
88
+ 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.1",
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"