create-laju-app 1.0.2 → 1.0.5

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 (3) hide show
  1. package/README.md +2 -1
  2. package/bin/cli.js +25 -18
  3. package/package.json +18 -2
package/README.md CHANGED
@@ -318,4 +318,5 @@ npm run dev
318
318
  - Use the Query Builder for complex queries
319
319
  - Include timestamps for tracking record changes
320
320
 
321
- Need help with anything specific? Feel free to ask!
321
+ Need help with anything specific? Feel free to ask!
322
+
package/bin/cli.js CHANGED
@@ -5,66 +5,73 @@ const prompts = require('prompts');
5
5
  const degit = require('degit');
6
6
  const path = require('path');
7
7
  const fs = require('fs');
8
+ const { execSync } = require('child_process');
8
9
 
9
10
  program
10
- .name('create-my-app')
11
- .description('CLI untuk membuat proyek baru dari template')
11
+ .name('create-laju-app')
12
+ .description('CLI to create a new project from template')
12
13
  .version('1.0.0');
13
14
 
14
15
  program
15
- .argument('[project-directory]', 'Nama direktori proyek')
16
+ .argument('[project-directory]', 'Project directory name')
16
17
  .action(async (projectDirectory) => {
17
18
  try {
18
- // Jika tidak ada nama proyek, tanya user
19
+ // If no project name, ask user
19
20
  if (!projectDirectory) {
20
21
  const response = await prompts({
21
22
  type: 'text',
22
23
  name: 'projectDirectory',
23
- message: 'Masukkan nama proyek:'
24
+ message: 'Enter project name:'
24
25
  });
25
26
  projectDirectory = response.projectDirectory;
26
27
  }
27
28
 
28
29
  if (!projectDirectory) {
29
- console.log('Nama proyek diperlukan untuk melanjutkan.');
30
+ console.log('Project name is required to continue.');
30
31
  process.exit(1);
31
32
  }
32
33
 
33
34
  const targetPath = path.resolve(projectDirectory);
34
35
 
35
- // Cek apakah direktori sudah ada
36
+ // Check if directory exists
36
37
  if (fs.existsSync(targetPath)) {
37
- console.log(`Direktori ${projectDirectory} sudah ada. Pilih nama lain.`);
38
+ console.log(`Directory ${projectDirectory} already exists. Choose another name.`);
38
39
  process.exit(1);
39
40
  }
40
41
 
41
42
  console.log(`Creating a new project in ${targetPath}...`);
42
43
 
43
- // Clone template dari GitHub
44
+ // Clone template from GitHub
44
45
  const emitter = degit('maulanashalihin/laju');
45
46
 
46
47
  await emitter.clone(targetPath);
47
48
 
48
- // Baca package.json dari template
49
+ // Read package.json from template
49
50
  const packageJsonPath = path.join(targetPath, 'package.json');
50
51
  const packageJson = require(packageJsonPath);
51
52
 
52
- // Update nama proyek di package.json
53
+ // Update project name in package.json
53
54
  packageJson.name = projectDirectory;
54
55
 
55
- // Tulis kembali package.json
56
+ // Write back package.json
56
57
  fs.writeFileSync(
57
58
  packageJsonPath,
58
59
  JSON.stringify(packageJson, null, 2)
59
60
  );
60
61
 
61
- console.log('✅ Project berhasil dibuat!');
62
+ // Change directory and run setup commands
63
+ process.chdir(targetPath);
64
+ console.log('📦 Installing dependencies...');
65
+ execSync('npm install', { stdio: 'inherit' });
66
+ console.log('📝 Copying environment file...');
67
+ execSync('cp .env.example .env', { stdio: 'inherit' });
68
+ console.log('🔄 Running migrations...');
69
+ execSync('npx knex migrate:latest', { stdio: 'inherit' });
70
+ console.log('🎉 Project created successfully!');
62
71
  console.log('');
63
- console.log('Untuk memulai:');
64
- console.log(` cd ${projectDirectory}`);
65
- console.log(' npm install');
66
- console.log(' npm run dev');
67
-
72
+ console.log('🚀 Your project is ready! You can now start developing.');
73
+ console.log('🔥 npm run dev to start the development server.');
74
+ console.log('📦 npm run build to build the production files.');
68
75
  } catch (error) {
69
76
  console.error('Error:', error.message);
70
77
  process.exit(1);
package/package.json CHANGED
@@ -1,12 +1,28 @@
1
1
  {
2
2
  "name": "create-laju-app",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
+ "keywords": [
5
+ "laju",
6
+ "svelte",
7
+ "tailwindcss",
8
+ "hyper-express",
9
+ "sqlite",
10
+ "boilerplate",
11
+ "template",
12
+ "generator"
13
+ ],
4
14
  "bin": {
5
15
  "create-laju-app": "./bin/cli.js"
6
16
  },
7
17
  "dependencies": {
18
+ "child_process": "^1.0.2",
8
19
  "commander": "^11.0.0",
9
20
  "degit": "^2.8.4",
10
21
  "prompts": "^2.4.2"
22
+ },
23
+ "homepage": "https://laju.dev",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/maulanashalihin/laju.git"
11
27
  }
12
- }
28
+ }