create-laju-app 1.0.2 → 1.0.4
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/README.md +2 -1
- package/bin/cli.js +14 -14
- package/package.json +18 -1
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -7,60 +7,60 @@ const path = require('path');
|
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
|
|
9
9
|
program
|
|
10
|
-
.name('create-
|
|
11
|
-
.description('CLI
|
|
10
|
+
.name('create-laju-app')
|
|
11
|
+
.description('CLI to create a new project from template')
|
|
12
12
|
.version('1.0.0');
|
|
13
13
|
|
|
14
14
|
program
|
|
15
|
-
.argument('[project-directory]', '
|
|
15
|
+
.argument('[project-directory]', 'Project directory name')
|
|
16
16
|
.action(async (projectDirectory) => {
|
|
17
17
|
try {
|
|
18
|
-
//
|
|
18
|
+
// If no project name, ask user
|
|
19
19
|
if (!projectDirectory) {
|
|
20
20
|
const response = await prompts({
|
|
21
21
|
type: 'text',
|
|
22
22
|
name: 'projectDirectory',
|
|
23
|
-
message: '
|
|
23
|
+
message: 'Enter project name:'
|
|
24
24
|
});
|
|
25
25
|
projectDirectory = response.projectDirectory;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (!projectDirectory) {
|
|
29
|
-
console.log('
|
|
29
|
+
console.log('Project name is required to continue.');
|
|
30
30
|
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const targetPath = path.resolve(projectDirectory);
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// Check if directory exists
|
|
36
36
|
if (fs.existsSync(targetPath)) {
|
|
37
|
-
console.log(`
|
|
37
|
+
console.log(`Directory ${projectDirectory} already exists. Choose another name.`);
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
console.log(`Creating a new project in ${targetPath}...`);
|
|
42
42
|
|
|
43
|
-
// Clone template
|
|
43
|
+
// Clone template from GitHub
|
|
44
44
|
const emitter = degit('maulanashalihin/laju');
|
|
45
45
|
|
|
46
46
|
await emitter.clone(targetPath);
|
|
47
47
|
|
|
48
|
-
//
|
|
48
|
+
// Read package.json from template
|
|
49
49
|
const packageJsonPath = path.join(targetPath, 'package.json');
|
|
50
50
|
const packageJson = require(packageJsonPath);
|
|
51
51
|
|
|
52
|
-
// Update
|
|
52
|
+
// Update project name in package.json
|
|
53
53
|
packageJson.name = projectDirectory;
|
|
54
54
|
|
|
55
|
-
//
|
|
55
|
+
// Write back package.json
|
|
56
56
|
fs.writeFileSync(
|
|
57
57
|
packageJsonPath,
|
|
58
58
|
JSON.stringify(packageJson, null, 2)
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
-
console.log('✅ Project
|
|
61
|
+
console.log('✅ Project created successfully!');
|
|
62
62
|
console.log('');
|
|
63
|
-
console.log('
|
|
63
|
+
console.log('To get started:');
|
|
64
64
|
console.log(` cd ${projectDirectory}`);
|
|
65
65
|
console.log(' npm install');
|
|
66
66
|
console.log(' npm run dev');
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-laju-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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
|
},
|
|
@@ -8,5 +18,12 @@
|
|
|
8
18
|
"commander": "^11.0.0",
|
|
9
19
|
"degit": "^2.8.4",
|
|
10
20
|
"prompts": "^2.4.2"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://laju.dev",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/maulanashalihin/laju.git"
|
|
11
26
|
}
|
|
27
|
+
|
|
28
|
+
|
|
12
29
|
}
|