@rzfan03/lazycode 1.0.0

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 +84 -0
  2. package/package.json +14 -0
package/index.js ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ const { Select, Input, MultiSelect } = require('enquirer');
3
+ const pc = require('picocolors');
4
+ const figlet = require('figlet');
5
+ const { execSync } = require('child_process');
6
+
7
+ async function main() {
8
+ console.clear();
9
+
10
+ console.log(pc.magenta(figlet.textSync(' LazyCode ', { font: 'Slant' })));
11
+ console.log(pc.cyan(" v1.0\n"));
12
+ console.log(pc.cyan(" Ngapain ngetik kalau bisa milih!\n"));
13
+
14
+ try {
15
+ const folderName = await new Input({
16
+ message: 'Project Name:',
17
+ initial: 'lazy-web-app'
18
+ }).run();
19
+
20
+ const stack = await new Select({
21
+ name: 'stack',
22
+ message: 'Select Web Stack:',
23
+ choices: [
24
+ { name: 'nextjs', message: 'Next.js (Fullstack / App Router)' },
25
+ { name: 'react', message: 'React (Vite + TS)' },
26
+ { name: 'react-js', message: 'React (Vite + JS)' },
27
+ { name: 'express', message: 'Express.js (Backend API)' },
28
+ { role: 'separator' },
29
+ { name: 'exit', message: 'Exit' }
30
+ ]
31
+ }).run();
32
+
33
+ if (stack === 'exit') return;
34
+
35
+ const addons = await new MultiSelect({
36
+ message: 'Addons & UI Libraries (Space to select):',
37
+ choices: [
38
+ { name: 'tailwindcss', message: 'Tailwind CSS' },
39
+ { name: 'shadcn', message: 'Shadcn/UI' },
40
+ { name: 'lucide', message: 'Lucide Icons' },
41
+ { name: 'prisma', message: 'Prisma ORM' },
42
+ { name: 'axios', message: 'Axios' }
43
+ ]
44
+ }).run();
45
+
46
+ console.log(pc.yellow(`\n⚡ Building ${stack.toUpperCase()}...`));
47
+
48
+ const isWindows = process.platform === 'win32';
49
+ const cdCmd = isWindows ? `cd /d ${folderName} &&` : `cd ${folderName} &&`;
50
+
51
+ if (stack === 'nextjs') {
52
+ execSync(`npx create-next-app@latest ${folderName} --ts --tailwind --eslint --app --src-dir --no-git`, { stdio: 'inherit' });
53
+ } else if (stack === 'react') {
54
+ execSync(`npm create vite@latest ${folderName} -- --template react-ts`, { stdio: 'inherit' });
55
+ } else if (stack === 'react-js') {
56
+ execSync(`npm create vite@latest ${folderName} -- --template react`, { stdio: 'inherit' });
57
+ } else if (stack === 'express') {
58
+ execSync(`mkdir ${folderName} && ${cdCmd} npm init -y && npm install express`, { stdio: 'inherit', shell: true });
59
+ }
60
+
61
+ if (addons.length > 0) {
62
+ console.log(pc.blue(`\n📦 Adding libraries: ${addons.join(', ')}`));
63
+ execSync(`${cdCmd} npm install ${addons.join(' ')}`, { stdio: 'inherit', shell: true });
64
+
65
+ if (addons.includes('prisma')) {
66
+ execSync(`${cdCmd} npx prisma init`, { stdio: 'inherit', shell: true });
67
+ }
68
+ if (addons.includes('shadcn')) {
69
+ execSync(`${cdCmd} npx shadcn-ui@latest init -y`, { stdio: 'inherit', shell: true });
70
+ }
71
+ }
72
+
73
+ console.log("\n" + pc.green("✔ Project Berhasil Dibuat!"));
74
+ console.log(pc.dim("--------------------------"));
75
+ console.log(`${pc.white('Lanjut ketik:')} ${pc.cyan(`cd ${folderName}`)}`);
76
+ console.log(`${pc.white('Buka editor:')} ${pc.cyan('code .')}`);
77
+ console.log(pc.dim("--------------------------\n"));
78
+
79
+ } catch (err) {
80
+ console.log(pc.red('\n✖ Batal.'));
81
+ }
82
+ }
83
+
84
+ main();
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "dependencies": {
3
+ "boxen": "^5.1.2",
4
+ "chalk": "^4.1.2",
5
+ "commander": "^14.0.3",
6
+ "enquirer": "^2.4.1",
7
+ "figlet": "^1.10.0",
8
+ "picocolors": "^1.1.1"
9
+ },
10
+ "name": "@rzfan03/lazycode",
11
+ "description": "Tools for lazy programmers",
12
+ "version": "1.0.0",
13
+ "author": "Rzfan03"
14
+ }