@kanjijs/cli 0.2.0-beta.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/README.md +83 -0
- package/dist/index.js +19817 -0
- package/package.json +29 -0
- package/templates/starter/README.md +34 -0
- package/templates/starter/package.json +24 -0
- package/templates/starter/src/app.controller.ts +12 -0
- package/templates/starter/src/app.module.ts +9 -0
- package/templates/starter/src/app.service.ts +8 -0
- package/templates/starter/src/main.ts +12 -0
- package/templates/starter/tsconfig.json +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @kanjijs/cli
|
|
2
|
+
|
|
3
|
+
The official Command Line Interface for [Kanjijs Framework](https://github.com/kanjijs-framework).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Recommended
|
|
9
|
+
bunx @kanjijs/cli <command>
|
|
10
|
+
|
|
11
|
+
# Or global install (not recommended for monorepos)
|
|
12
|
+
# npm i -g @kanjijs/cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
### `new <project-name>`
|
|
18
|
+
Scaffolds a new Kanjijs project with a predefined directory structure (bun + typescript).
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
kanjijs new my-app
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Features included out-of-the-box:
|
|
25
|
+
* **Hono + Bun** set up.
|
|
26
|
+
* **Observability**: `@kanjijs/logger` (JSON logs) + Request ID propagation.
|
|
27
|
+
* **Security**: Rate Limiting enabled by default via `@kanjijs/throttler`.
|
|
28
|
+
* **DI & Decorators**: Ready to use `@Controller` and `@Inject`.
|
|
29
|
+
|
|
30
|
+
### `g resource <name>`
|
|
31
|
+
Generates a new Resource Module (Controller + Service + Module).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
kanjijs g resource products
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
* scaffolds `products.module.ts`, `products.controller.ts`, `products.service.ts`
|
|
38
|
+
* **Auto-updates** `src/app.module.ts` to import the new module! 🚀
|
|
39
|
+
|
|
40
|
+
### `dev`
|
|
41
|
+
Starts the development server via Bun in watch mode.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
kanjijs dev
|
|
45
|
+
# Uses PORT env var if available, defaults to 3000
|
|
46
|
+
PORT=4000 kanjijs dev
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Local Development (Contributing)
|
|
50
|
+
|
|
51
|
+
To hack on the CLI itself:
|
|
52
|
+
|
|
53
|
+
1. Clone the repo and install dependencies.
|
|
54
|
+
2. Link the package globally:
|
|
55
|
+
```bash
|
|
56
|
+
cd packages/cli
|
|
57
|
+
npm link
|
|
58
|
+
```
|
|
59
|
+
3. Run the builder in watch mode:
|
|
60
|
+
```bash
|
|
61
|
+
bun run watch
|
|
62
|
+
```
|
|
63
|
+
4. In another terminal, test your changes:
|
|
64
|
+
```bash
|
|
65
|
+
kanjijs g resource users
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### `openapi`
|
|
71
|
+
Generates an `openapi.json` file by inspecting your application metadata at runtime.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
kanjijs openapi --out openapi.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `client`
|
|
78
|
+
Generates a Type-Safe Client SDK (TypeScript) from your `openapi.json`.
|
|
79
|
+
Uses [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen).
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
kanjijs client --input openapi.json --output src/client
|
|
83
|
+
```
|