@mgvdev/nestkit-cli 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/dist/.tsbuildinfo +1 -0
- package/dist/commands/add.d.ts +18 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +67 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/build.d.ts +12 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +20 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/clean.d.ts +8 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +18 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/dev.d.ts +21 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +60 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/generate.d.ts +33 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +158 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/graph.d.ts +7 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +38 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +49 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +30 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/migrate.d.ts +7 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +70 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +20 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/typecheck.d.ts +2 -0
- package/dist/commands/typecheck.d.ts.map +1 -0
- package/dist/commands/typecheck.js +12 -0
- package/dist/commands/typecheck.js.map +1 -0
- package/dist/env.d.ts +4 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +30 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/templates.d.ts +6 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +155 -0
- package/dist/templates.js.map +1 -0
- package/package.json +47 -0
- package/skills/nestkit/SKILL.md +96 -0
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mgvdev/nestkit-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "nestkit CLI — modern, package-manager-agnostic NestJS workspace engine.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"nestkit": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"skills"
|
|
15
|
+
],
|
|
16
|
+
"nestBoost": {
|
|
17
|
+
"skills": [
|
|
18
|
+
"skills"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@mgvdev/nestkit-adapter-vite": "^0.1.0",
|
|
26
|
+
"@mgvdev/nestkit-compiler-swc": "^0.1.0",
|
|
27
|
+
"@mgvdev/nestkit-compiler-tsc": "^0.1.0",
|
|
28
|
+
"@mgvdev/nestkit-core": "^0.1.0",
|
|
29
|
+
"citty": "^0.1.6",
|
|
30
|
+
"consola": "^3.2.3"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"typescript": ">=5.0.0"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/mgvdev/nestkit.git",
|
|
41
|
+
"directory": "packages/cli"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/mgvdev/nestkit#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/mgvdev/nestkit/issues"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nestkit
|
|
3
|
+
description: Use when working in a NestJS monorepo managed by nestkit (a nestkit.json exists, or the user asks to create/build/run apps and libraries, wire local dependencies, or set up a package-manager-agnostic Nest workspace without the Nest CLI's Webpack monorepo mode). Covers scaffolding, the project graph, dev/build/typecheck, tsconfig aliases, and common gotchas.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# nestkit
|
|
7
|
+
|
|
8
|
+
nestkit is a modern, package-manager-agnostic NestJS **workspace engine**. It replaces the Nest CLI's
|
|
9
|
+
Webpack monorepo mode with a package-based project graph, using **SWC** for transforms (no Webpack)
|
|
10
|
+
and **tsc** for type checking and `.d.ts` generation. NestJS stays the runtime framework.
|
|
11
|
+
|
|
12
|
+
Detect a nestkit workspace by a per-package `nestkit.json` and/or `@mgvdev/nestkit-cli` in devDependencies.
|
|
13
|
+
Run every command from the **workspace root** with `npx nestkit <cmd>` (or `pnpm/yarn/bun` equivalent).
|
|
14
|
+
|
|
15
|
+
## Project model
|
|
16
|
+
|
|
17
|
+
Each managed package has a `nestkit.json`:
|
|
18
|
+
|
|
19
|
+
```jsonc
|
|
20
|
+
{
|
|
21
|
+
"type": "app" | "lib" | "app-frontend",
|
|
22
|
+
"entry": "src/main.ts", // apps
|
|
23
|
+
"compiler": "swc", // default; "tsc" also valid
|
|
24
|
+
"outDir": "dist", // default
|
|
25
|
+
"adapter": "vite", // app-frontend only
|
|
26
|
+
"assets": ["src/**/*.json"]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **app** — a Nest application, transformed by SWC, run as `node dist/main.js`.
|
|
31
|
+
- **lib** — a library; builds to `dist/` with `.d.ts`; consumed by name as a built package.
|
|
32
|
+
- **app-frontend** — a frontend app driven by the Vite adapter (its own build / dev server + HMR).
|
|
33
|
+
|
|
34
|
+
The project graph is built from real workspace dependencies: an app that uses `@scope/lib` must list
|
|
35
|
+
it in its `package.json` `dependencies`. Layout convention: apps in `apps/`, libraries in `packages/`.
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nestkit init # generate nestkit.json for detected packages (--dry to preview)
|
|
41
|
+
nestkit generate <kind> <name> # scaffold app | lib | app-frontend (alias: g, new)
|
|
42
|
+
nestkit add <lib> --to <app> # add a local lib as an app dependency (+ install + sync)
|
|
43
|
+
nestkit install # install all workspace deps via the detected PM (alias: i)
|
|
44
|
+
nestkit graph [--json] # print the project graph and build order
|
|
45
|
+
nestkit build <project|--all> # build a project (+ local-dep closure) or everything
|
|
46
|
+
nestkit dev <projects…> | --all # run app(s)/frontend(s): watch + restart, labeled output
|
|
47
|
+
nestkit typecheck # tsc --noEmit across apps + libs
|
|
48
|
+
nestkit sync # (re)generate tsconfig.base.json path aliases for libs
|
|
49
|
+
nestkit clean [projects…] # remove build outputs
|
|
50
|
+
nestkit migrate-from-nest-cli # generate nestkit.json from nest-cli.json (--write to apply)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Project refs accept the full package name (`@app/api`), the unscoped name (`api`), or the directory
|
|
54
|
+
name. `dev` takes a comma or space list (`dev api,web`) or `--all`; add `--tui` for split panes.
|
|
55
|
+
|
|
56
|
+
## Typical workflows
|
|
57
|
+
|
|
58
|
+
**New app / lib:**
|
|
59
|
+
```bash
|
|
60
|
+
nestkit generate app api # apps/api (@package/api by default)
|
|
61
|
+
nestkit generate lib billing # packages/billing → BillingModule + BillingService + index.ts
|
|
62
|
+
nestkit generate app-frontend web # runs create-vite (interactive without --template), then wires it
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Use a lib from an app:**
|
|
66
|
+
```bash
|
|
67
|
+
nestkit add billing --to api # adds "@package/billing": "*" to apps/api, installs, syncs aliases
|
|
68
|
+
```
|
|
69
|
+
Then in the app: `import { BillingModule } from '@package/billing'` and add it to `imports: [...]`.
|
|
70
|
+
|
|
71
|
+
**Run everything in dev:**
|
|
72
|
+
```bash
|
|
73
|
+
nestkit dev --all # or: nestkit dev api,web
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Gotchas (fix these when you see them)
|
|
77
|
+
|
|
78
|
+
- **Nest DI needs value imports.** Never `import type { SomeService }` for a constructor-injected
|
|
79
|
+
provider — the class is erased at runtime and Nest fails with "argument Object at index [0]". Use a
|
|
80
|
+
value import: `import { SomeService } from '…'`. Configure Biome/ESLint so they do NOT rewrite
|
|
81
|
+
provider imports to `import type`.
|
|
82
|
+
- **TS6059 "not under rootDir" when importing a lib by alias** → run `nestkit sync`. It maintains
|
|
83
|
+
`tsconfig.base.json` (baseUrl, `rootDir: "."`, and lib `paths`), removes stale aliases, strips
|
|
84
|
+
per-package `rootDir`, and makes each package tsconfig extend the base. Restart the editor's TS
|
|
85
|
+
server afterward.
|
|
86
|
+
- **A lib import type-checks but fails at runtime** → the app is missing the lib in its
|
|
87
|
+
`dependencies`; run `nestkit add <lib> --to <app>` (types come from the alias; the runtime needs the
|
|
88
|
+
workspace symlink to the built `dist/`).
|
|
89
|
+
- **`moduleResolution: "Node"` deprecation** → use `NodeNext` (generated tsconfigs already do).
|
|
90
|
+
- Run `npm install` at the **root**, never inside a sub-package (use `nestkit install`).
|
|
91
|
+
|
|
92
|
+
## Compatibility
|
|
93
|
+
|
|
94
|
+
- Package managers: npm, pnpm, Yarn, Bun (auto-detected from the lockfile / `pnpm-workspace.yaml`).
|
|
95
|
+
- SWC is the default transform (decorator metadata enabled for Nest DI); tsc does `--noEmit` and lib
|
|
96
|
+
`.d.ts`. Bundling (esbuild/rollup/rolldown) is opt-in, never the default.
|