create-letswhim 1.1.4 → 1.1.6
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 +12 -42
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,53 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
2
5
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const fs = require('fs');
|
|
6
|
+
const projectName = process.argv[2] || "my-whim-project";
|
|
7
|
+
const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git"; // URL BARU
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
const pc = {
|
|
9
|
-
blue: (s) => `\x1b[34m${s}\x1b[0m`,
|
|
10
|
-
green: (s) => `\x1b[32m${s}\x1b[0m`,
|
|
11
|
-
dim: (s) => `\x1b[2m${s}\x1b[0m`,
|
|
12
|
-
bold: (s) => `\x1b[1m${s}\x1b[0m`,
|
|
13
|
-
cyan: (s) => `\x1b[36m${s}\x1b[0m`
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const projectName = process.argv[2] || 'my-whim-project';
|
|
17
|
-
const targetPath = path.join(process.cwd(), projectName);
|
|
18
|
-
|
|
19
|
-
console.log(`\n${pc.bold('LETSWHIM')} ${pc.dim('v1.1.0')}`);
|
|
20
|
-
console.log(`${pc.blue('“Let’s just start.”')}\n`);
|
|
9
|
+
console.log(`\n🚀 Preparing your Lightweight project: ${projectName}...`);
|
|
21
10
|
|
|
22
11
|
try {
|
|
23
|
-
//
|
|
24
|
-
if (fs.existsSync(targetPath)) {
|
|
25
|
-
console.error(`\x1b[31m❌ Error:\x1b[0m Folder ${projectName} sudah ada.`);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// 2. Clone dari REPO STARTER BARU (Public)
|
|
30
|
-
console.log(`${pc.dim('📦 Fetching the minimalist engine...')}`);
|
|
31
|
-
|
|
32
|
-
// Ganti URL ini dengan URL Repo Starter Public lo yang baru
|
|
33
|
-
const repoUrl = "https://github.com/ripkiiii/letswhim-starter.git";
|
|
34
|
-
|
|
12
|
+
// CLONE TANPA -b starter
|
|
35
13
|
execSync(`git clone ${repoUrl} "${projectName}"`, { stdio: 'ignore' });
|
|
36
14
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
fs.rmSync(gitDir, { recursive: true, force: true });
|
|
15
|
+
const gitFolder = path.join(process.cwd(), projectName, '.git');
|
|
16
|
+
if (fs.existsSync(gitFolder)) {
|
|
17
|
+
fs.rmSync(gitFolder, { recursive: true, force: true });
|
|
41
18
|
}
|
|
42
19
|
|
|
43
|
-
|
|
44
|
-
console.log(`\n${pc.green('✨ Project created successfully!')}`);
|
|
45
|
-
console.log(`\n${pc.bold('Next steps:')}`);
|
|
46
|
-
console.log(` ${pc.cyan(`cd ${projectName}`)}`);
|
|
47
|
-
console.log(` ${pc.cyan('npm install')}`);
|
|
48
|
-
console.log(` ${pc.cyan('npm run dev')}\n`);
|
|
49
|
-
|
|
20
|
+
console.log(`\n✅ Project created! Let's start whiming.\n`);
|
|
50
21
|
} catch (error) {
|
|
51
|
-
console.
|
|
52
|
-
process.exit(1);
|
|
22
|
+
console.log(`\n❌ Bjir, ada error: ${error.message}`);
|
|
53
23
|
}
|