create-letswhim 1.1.5 → 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 +77 -21
  2. package/package.json +14 -4
package/index.js CHANGED
@@ -1,32 +1,88 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import { execSync } from 'child_process';
4
3
  import path from 'path';
5
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
+ }
26
+ }
27
+ };
28
+ }
6
29
 
7
- const projectName = process.argv[2] || "my-whim-project";
8
- const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git";
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`);
9
34
 
10
- console.log(`\n🚀 Preparing your Lightweight project: ${projectName}...`);
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
+ });
11
42
 
12
- try {
13
- // 1. Clone dari repo Public yang baru
14
- execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
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";
15
46
 
16
- // 2. Hapus folder .git bawaan starter biar user bisa git init sendiri
17
- const targetPath = path.join(process.cwd(), projectName);
18
- const gitFolder = path.join(targetPath, '.git');
19
-
20
- if (fs.existsSync(gitFolder)) {
21
- fs.rmSync(gitFolder, { recursive: true, force: true });
47
+ if (fs.existsSync(targetDir)) {
48
+ console.log(`\n${pc.red('✖')} ${pc.bold('Error:')} Directory ${pc.cyan(projectName)} already exists.`);
49
+ process.exit(1);
22
50
  }
23
51
 
24
- console.log(`\n✅ Project created! Let's start whiming.`);
25
- console.log(`\nNext steps:`);
26
- console.log(` cd ${projectName}`);
27
- console.log(` npm install`);
28
- console.log(` npm run dev\n`);
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}`);
85
+ }
86
+ }
29
87
 
30
- } catch (error) {
31
- console.error(`\n❌ Bjir, ada error: ${error.message}`);
32
- }
88
+ init();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-letswhim",
3
- "version": "1.1.5",
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"