create-hanni 0.5.0 → 1.0.1

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