@kanjijs/cli 0.2.0-beta.16 → 0.2.0-beta.18
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 +39 -13
- package/package.json +2 -2
- package/templates/starter/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ bunx @kanjijs/cli <command>
|
|
|
15
15
|
## Commands
|
|
16
16
|
|
|
17
17
|
### `new <project-name>`
|
|
18
|
+
|
|
18
19
|
Scaffolds a new Kanjijs project with a predefined directory structure (bun + typescript).
|
|
19
20
|
|
|
20
21
|
```bash
|
|
@@ -22,22 +23,42 @@ kanjijs new my-app
|
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
Features included out-of-the-box:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
|
|
27
|
+
- **Hono + Bun** set up.
|
|
28
|
+
- **Observability**: `@kanjijs/logger` (JSON logs) + Request ID propagation.
|
|
29
|
+
- **Security**: Rate Limiting enabled by default via `@kanjijs/throttler`.
|
|
30
|
+
- **DI & Decorators**: Ready to use `@Controller` and `@Inject`.
|
|
29
31
|
|
|
30
32
|
### `g resource <name>`
|
|
31
|
-
|
|
33
|
+
|
|
34
|
+
Generates a new Resource Module (Controller + Service + Module + Test).
|
|
32
35
|
|
|
33
36
|
```bash
|
|
34
37
|
kanjijs g resource products
|
|
38
|
+
kanjijs g resource products --repository # With Repository Pattern
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- scaffolds `products.module.ts`, `products.controller.ts`, `products.service.ts`
|
|
42
|
+
- **Auto-generates** `products.controller.spec.ts` for unit testing.
|
|
43
|
+
- **Auto-updates** `src/app.module.ts` to import the new module! 🚀
|
|
44
|
+
|
|
45
|
+
### `g schema <name>`
|
|
46
|
+
|
|
47
|
+
Generates a new Drizzle ORM Table definition.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Default: src/database/schema/users.ts (and updates index.ts)
|
|
51
|
+
kanjijs g schema users
|
|
52
|
+
|
|
53
|
+
# Co-located: src/modules/users/schemas/users.ts
|
|
54
|
+
kanjijs g schema users --module users
|
|
35
55
|
```
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
|
|
57
|
+
- Creates a `pgTable` with default columns (`id`, `createdAt`, `updatedAt`).
|
|
58
|
+
- **Auto-updates** the central barrel file (`src/database/schema/index.ts`) to export the new schema.
|
|
39
59
|
|
|
40
60
|
### `dev`
|
|
61
|
+
|
|
41
62
|
Starts the development server via Bun in watch mode.
|
|
42
63
|
|
|
43
64
|
```bash
|
|
@@ -50,24 +71,28 @@ PORT=4000 kanjijs dev
|
|
|
50
71
|
|
|
51
72
|
To hack on the CLI itself:
|
|
52
73
|
|
|
53
|
-
1.
|
|
54
|
-
2.
|
|
74
|
+
1. Clone the repo and install dependencies.
|
|
75
|
+
2. Link the package globally:
|
|
76
|
+
|
|
55
77
|
```bash
|
|
56
78
|
cd packages/cli
|
|
57
79
|
npm link
|
|
58
80
|
```
|
|
59
|
-
|
|
81
|
+
|
|
82
|
+
3. Run the builder in watch mode:
|
|
83
|
+
|
|
60
84
|
```bash
|
|
61
85
|
bun run watch
|
|
62
86
|
```
|
|
63
|
-
|
|
87
|
+
|
|
88
|
+
4. In another terminal, test your changes:
|
|
89
|
+
|
|
64
90
|
```bash
|
|
65
91
|
kanjijs g resource users
|
|
66
92
|
```
|
|
67
93
|
|
|
68
|
-
|
|
69
|
-
|
|
70
94
|
### `openapi`
|
|
95
|
+
|
|
71
96
|
Generates an `openapi.json` file by inspecting your application metadata at runtime.
|
|
72
97
|
|
|
73
98
|
```bash
|
|
@@ -75,6 +100,7 @@ kanjijs openapi --out openapi.json
|
|
|
75
100
|
```
|
|
76
101
|
|
|
77
102
|
### `client`
|
|
103
|
+
|
|
78
104
|
Generates a Type-Safe Client SDK (TypeScript) from your `openapi.json`.
|
|
79
105
|
Uses [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen).
|
|
80
106
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/cli",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"kanji": "./dist/index.js"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"fs-extra": "^11.3.3",
|
|
22
22
|
"picocolors": "^1.1.1",
|
|
23
23
|
"openapi-typescript-codegen": "^0.25.0",
|
|
24
|
-
"@kanjijs/openapi": "^0.2.0-beta.
|
|
24
|
+
"@kanjijs/openapi": "^0.2.0-beta.18"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/fs-extra": "^11.0.4"
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"start": "bun run src/main.ts"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@kanjijs/core": "^0.2.0-beta.
|
|
11
|
-
"@kanjijs/platform-bun": "^0.2.0-beta.
|
|
12
|
-
"@kanjijs/platform-hono": "^0.2.0-beta.
|
|
13
|
-
"@kanjijs/auth": "^0.2.0-beta.
|
|
14
|
-
"@kanjijs/logger": "^0.2.0-beta.
|
|
15
|
-
"@kanjijs/throttler": "^0.2.0-beta.
|
|
10
|
+
"@kanjijs/core": "^0.2.0-beta.18",
|
|
11
|
+
"@kanjijs/platform-bun": "^0.2.0-beta.18",
|
|
12
|
+
"@kanjijs/platform-hono": "^0.2.0-beta.18",
|
|
13
|
+
"@kanjijs/auth": "^0.2.0-beta.18",
|
|
14
|
+
"@kanjijs/logger": "^0.2.0-beta.18",
|
|
15
|
+
"@kanjijs/throttler": "^0.2.0-beta.18",
|
|
16
16
|
"hono": "^4.0.0",
|
|
17
17
|
"reflect-metadata": "^0.2.0",
|
|
18
18
|
"zod": "^3.0.0"
|