create-hanni 0.2.0 → 0.4.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.
- package/index.js +6 -6
- package/package.json +8 -4
package/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { join } from "path";
|
|
3
2
|
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
4
|
|
|
5
|
+
const __dirname = path.dirname(import.meta.url.replace("file://", ""));
|
|
5
6
|
const args = process.argv.slice(2);
|
|
6
7
|
if (!args[0]) process.exit(1);
|
|
7
8
|
|
|
8
9
|
const projectName = args[0];
|
|
9
|
-
const templateDir = join(
|
|
10
|
+
const templateDir = path.join(__dirname, "template");
|
|
10
11
|
|
|
11
12
|
async function copyDir(src, dest) {
|
|
12
13
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
13
14
|
fs.mkdirSync(dest, { recursive: true });
|
|
14
15
|
|
|
15
16
|
for (const entry of entries) {
|
|
16
|
-
const srcPath = join(src, entry.name);
|
|
17
|
-
const destPath = join(dest, entry.name);
|
|
17
|
+
const srcPath = path.join(src, entry.name);
|
|
18
|
+
const destPath = path.join(dest, entry.name);
|
|
18
19
|
|
|
19
20
|
if (entry.isDirectory()) {
|
|
20
21
|
await copyDir(srcPath, destPath);
|
|
@@ -28,8 +29,7 @@ async function copyDir(src, dest) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
await copyDir(templateDir, join(process.cwd(), projectName));
|
|
32
|
-
|
|
32
|
+
await copyDir(templateDir, path.join(process.cwd(), projectName));
|
|
33
33
|
console.log(`Project "${projectName}" created successfully.`);
|
|
34
34
|
console.log(`cd ${projectName} && bun install`);
|
|
35
35
|
console.log(`bun start`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-hanni",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Bun project template for Hanni.js framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
"keywords": ["bun", "template", "hanni", "framework"],
|
|
12
12
|
"author": "2matheww",
|
|
13
13
|
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"minimist": "^1.2.8",
|
|
16
|
+
"prompts": "^2.4.2"
|
|
17
|
+
},
|
|
14
18
|
"engines": {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
19
|
+
"bun": ">=1.0.0"
|
|
20
|
+
}
|
|
21
|
+
}
|