create-hanni 0.4.0 → 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.
package/index.js CHANGED
@@ -1,35 +1,35 @@
1
1
  #!/usr/bin/env bun
2
- import fs from "fs";
3
- import path from "path";
2
+ import { join } from "path";
4
3
 
5
- const __dirname = path.dirname(import.meta.url.replace("file://", ""));
6
4
  const args = process.argv.slice(2);
7
5
  if (!args[0]) process.exit(1);
8
6
 
9
7
  const projectName = args[0];
10
- const templateDir = path.join(__dirname, "template");
8
+ const templateDir = join(import.meta.dir, "template");
11
9
 
12
10
  async function copyDir(src, dest) {
13
- const entries = fs.readdirSync(src, { withFileTypes: true });
14
- fs.mkdirSync(dest, { recursive: true });
11
+ const entries = Bun.readdirSync(src, { withFileTypes: true });
12
+ Bun.mkdirSync(dest, { recursive: true });
15
13
 
16
14
  for (const entry of entries) {
17
- const srcPath = path.join(src, entry.name);
18
- const destPath = path.join(dest, entry.name);
15
+ const srcPath = join(src, entry.name);
16
+ const destPath = join(dest, entry.name);
19
17
 
20
18
  if (entry.isDirectory()) {
21
19
  await copyDir(srcPath, destPath);
22
20
  } else {
23
- let content = fs.readFileSync(srcPath);
21
+ let content = Bun.readFileSync(srcPath);
24
22
  if (entry.name.endsWith(".json") || entry.name.endsWith(".js")) {
25
- content = content.toString().replace(/\$PROJECT_NAME\$/g, projectName);
23
+ content = new TextDecoder().decode(content);
24
+ content = content.replace(/\$PROJECT_NAME\$/g, projectName);
26
25
  }
27
- fs.writeFileSync(destPath, content);
26
+ Bun.write(destPath, content);
28
27
  }
29
28
  }
30
29
  }
31
30
 
32
- await copyDir(templateDir, path.join(process.cwd(), projectName));
31
+ await copyDir(templateDir, join(process.cwd(), projectName));
32
+
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.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "Bun project template for Hanni.js framework",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,14 +8,8 @@
8
8
  "bin": {
9
9
  "create-hanni": "./index.js"
10
10
  },
11
- "keywords": ["bun", "template", "hanni", "framework"],
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
- },
18
- "engines": {
19
- "bun": ">=1.0.0"
20
- }
21
- }
14
+ "engines": { "bun": ">=1.0.0" }
15
+ }
package/template/index.js CHANGED
File without changes