create-hanni 0.1.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 ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bun
2
+ import { join } from "path";
3
+
4
+ const args = process.argv.slice(2);
5
+ if (!args[0]) process.exit(1);
6
+
7
+ const projectName = args[0];
8
+ const templateDir = join(import.meta.dir, "template");
9
+
10
+ async function copyDir(src, dest) {
11
+ const entries = Bun.readdirSync(src, { withFileTypes: true });
12
+ Bun.mkdirSync(dest, { recursive: true });
13
+
14
+ for (const entry of entries) {
15
+ const srcPath = join(src, entry.name);
16
+ const destPath = join(dest, entry.name);
17
+
18
+ if (entry.isDirectory()) {
19
+ await copyDir(srcPath, destPath);
20
+ } else {
21
+ let content = Bun.readFileSync(srcPath);
22
+ if (entry.name.endsWith(".json") || entry.name.endsWith(".js")) {
23
+ content = new TextDecoder().decode(content);
24
+ content = content.replace(/\$PROJECT_NAME\$/g, projectName);
25
+ }
26
+ Bun.write(destPath, content);
27
+ }
28
+ }
29
+ }
30
+
31
+ await copyDir(templateDir, join(process.cwd(), projectName));
32
+
33
+ console.log(`Project "${projectName}" created successfully.`);
34
+ console.log(`cd ${projectName} && bun install`);
35
+ console.log(`bun start`);
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "create-hanni",
3
+ "version": "0.1.0",
4
+ "description": "Bun project template for Hanni.js framework",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "files": ["template"],
8
+ "bin": {
9
+ "create-hanni": "./index.js"
10
+ },
11
+ "keywords": ["bun","template","hanni","framework"],
12
+ "author": "2matheww",
13
+ "license": "MIT",
14
+ "engines": { "bun": ">=1.0.0" }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "configVersion": 1,
4
+ "workspaces": {
5
+ "": {
6
+ "name": "my-hanni-app",
7
+ "dependencies": {
8
+ "hanni": "1",
9
+ },
10
+ },
11
+ },
12
+ "packages": {
13
+ "hanni": ["hanni@1.0.2", "", {}, "sha512-C1BQ1FTvmLVDpLV5DM95Rm3BlOVwU9WF+DoxeUhd8Dkjcoam/aO9D6xMtMTnekLv0iIOXBcelRw+/ow7zdnGaQ=="],
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ import { Hanni } from 'hanni'
2
+
3
+ const app = Hanni({
4
+ swagger: {
5
+ path: '/docs',
6
+ title: 'My Hanni App',
7
+ version: '1.0.0'
8
+ }
9
+ })
10
+
11
+ app.get('/', c => c.text('Hello Hanni!'))
12
+
13
+ app.listen(3000)
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "$PROJECT_NAME$",
3
+ "version": "0.1.0",
4
+ "description": "Minimal Hanni.js project with Swagger, Tailwind and Font Awesome",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "start": "bun index.js"
9
+ },
10
+ "dependencies": {
11
+ "hanni": "1"
12
+ },
13
+ "engines": {
14
+ "bun": ">=1.0.0"
15
+ },
16
+ "author": "2matheww",
17
+ "license": "MIT"
18
+ }