adonia 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,64 +1,110 @@
1
- # `@adonia` CLI (`packages/modules`)
1
+ # adonia
2
2
 
3
- npm package name: `adonia`. Bin: `adonia`.
3
+ Your AdonisJS app owns the files. Adonia only copies them in.
4
4
 
5
- In this monorepo, module sources are authored in
6
- `apps/adonis-api-stater/modules/`. Sync before pack/test:
5
+ **Requirements:** Node.js 24+, npm 11+, an AdonisJS app (`adonisrc.ts` and
6
+ `@adonisjs/core`).
7
7
 
8
8
  ```bash
9
- npm run sync-registry -w adonia
10
- npm test -w adonia
9
+ npx adonia@latest init --wire
10
+ npx adonia@latest add auth
11
11
  ```
12
12
 
13
- ## Host install
13
+ ## Quick start
14
+
15
+ From an AdonisJS API app:
14
16
 
15
17
  ```bash
16
- npx adonia@latest init --wire
17
- npx adonia@latest add auth
18
- # optional host scaffolding:
19
- npx adonia@latest add auth --with-adapters
20
- npx adonia@latest add auth --with-stubs
21
- npx adonia@latest add auth --with-routes --wire-routes
22
- # or full kit:
23
- npx adonia@latest init --scaffold
18
+ npx adonia init --wire
19
+ npx adonia add auth
20
+ npx adonia add auth --with-adapters
21
+ npx adonia add auth --with-routes --wire-routes
22
+ npx adonia check
23
+ ```
24
+
25
+ Plain `add` copies the domain slice under `modules/` only. Models,
26
+ migrations, controllers, validators, adapters, and routes are
27
+ opt-in.
28
+
29
+ Every module in one command:
30
+
31
+ ```bash
32
+ npx adonia init --scaffold
24
33
  ```
25
34
 
35
+ That wires the host and copies every feature module with stubs and
36
+ routes.
37
+
26
38
  ## Commands
27
39
 
28
40
  | Command | Role |
29
41
  |---------|------|
30
- | `init` / `init --wire` | `adonia.json` + core; optional host wiring |
42
+ | `init` | Write `adonia.json` and copy the API core |
43
+ | `init --wire` | Also set import aliases, `ctx.respond`, and the JSON exception handler |
31
44
  | `init --scaffold` | Core + all feature modules with stubs and routes (implies `--wire`) |
32
- | `add [names…]` | Copy module files under `modules/`, merge config (no app stubs by default) |
33
- | `list` / `diff` / `check` | Discovery, drift, validation |
45
+ | `add <name…>` | Copy one or more modules (and optional stubs) |
46
+ | `list` | Registry names and install status |
47
+ | `diff <name>` | Compare host files to the registry |
48
+ | `check` | Validate the host install |
34
49
 
35
- ### `add` scaffolding flags
50
+ `check` fails after a plain `add auth` until `#models/user` and
51
+ `#models/password_reset` exist. Pass `--with-models` / `--with-stubs`,
52
+ or add those files yourself.
36
53
 
37
- | Flag | Effect |
54
+ ## Bundled modules
55
+
56
+ | Name | Role |
57
+ |------|------|
58
+ | `api` | Shared envelopes, `ApiService`, `ctx.respond`, exception handler |
59
+ | `types`, `constants`, `contracts` | Core types and the shared `UserStore` port (installed with `api`) |
60
+ | `auth` | Registration, login, verification, password reset |
61
+ | `account` | Profile, email change, password change, deletion |
62
+ | `notification` | Multi-channel dispatcher with a host-owned registry |
63
+ | `creem` | Creem checkout, portal, invoices, webhooks |
64
+ | `subscription` | Subscription state synced from Creem webhooks |
65
+
66
+ `add` walks `registryDependencies`. For example,
67
+ `adonia add subscription` installs `creem` and core first when they
68
+ are missing.
69
+
70
+ ## `add` flags
71
+
72
+ | Flag | Copies |
38
73
  |------|--------|
39
- | `--with-models` | Copy `stubs/models/**` |
40
- | `--with-migrations` | Copy `stubs/migrations/**` |
41
- | `--with-controllers` | Copy `stubs/controllers/**` (implies `--with-adapters`) |
42
- | `--with-validators` | Copy `stubs/validators/**` and `stubs/providers/**` |
43
- | `--with-adapters` | Copy Lucid/SDK adapters → `app/adapters/` |
44
- | `--with-stubs` | Models, migrations, controllers, validators, adapters, Vine provider, limiter stub (not routes) |
45
- | `--with-routes` | Copy `stubs/routes/**` → `start/routes/` and `stubs/start/**` → `start/` |
46
- | `--wire-routes` | Append `import './routes/<name>.js'` in `start/routes.ts` |
47
- | `--with-tests` | Copy colocated module tests |
74
+ | `--with-models` | `stubs/models/` → `app/models/` |
75
+ | `--with-migrations` | `stubs/migrations/` → `database/migrations/` |
76
+ | `--with-controllers` | Controllers (implies adapters) |
77
+ | `--with-validators` | Validators and the Vine provider |
78
+ | `--with-adapters` | Lucid/SDK adapters → `app/adapters/` |
79
+ | `--with-stubs` | Models, migrations, controllers, validators, adapters, Vine provider, limiter stub. **Not** routes |
80
+ | `--with-routes` | `start/routes/<name>.ts` and `start/limiter.ts` |
81
+ | `--wire-routes` | Import that route file from `start/routes.ts` |
82
+ | `--with-tests` | Colocated tests under `modules/<name>/tests/` |
48
83
 
49
- `diff` accepts the same `--with-*` flags; without them it diffs the
50
- module tree only.
84
+ `--with-stubs` does not copy routes. Combine with `--with-routes`.
51
85
 
52
- Adonis kits used by stubs (`@adonisjs/mail`, `@adonisjs/drive`,
53
- `@adonisjs/limiter`) are not installed by `adonia add`. The CLI assumes
54
- they are already configured, or `add` / `check` prints
55
- `node ace add @adonisjs/<pkg>`.
86
+ Adonis packages used by stubs (`@adonisjs/mail`, `@adonisjs/drive`,
87
+ `@adonisjs/limiter`) are not installed for you. `add` and `check`
88
+ print `node ace add @adonisjs/<pkg>` when a copied stub needs a
89
+ missing package.
56
90
 
57
- Shared flags: `--yes`, `--dry-run`, `--cwd`, `--registry`, `--overwrite`.
91
+ ## Shared flags
58
92
 
59
- ## Developing in the monorepo
93
+ | Flag | Effect |
94
+ |------|--------|
95
+ | `--cwd <dir>` | Host app directory |
96
+ | `-y`, `--yes` | Hide “continuing” log lines (does not prompt) |
97
+ | `--dry-run` | Print the plan; write nothing |
98
+ | `--registry <dir>` | Local registry path |
99
+ | `--overwrite` | Replace host files whose contents differ |
60
100
 
61
- ```bash
62
- node packages/modules/build/cli.js add auth \
63
- --registry apps/adonis-api-stater/modules
64
- ```
101
+ ## Documentation
102
+
103
+ - [Getting started](https://github.com/britzdylan/adonia/blob/main/apps/docs/guide/getting-started.md)
104
+ - [CLI](https://github.com/britzdylan/adonia/blob/main/apps/docs/cli/overview.md)
105
+ - [Modules](https://github.com/britzdylan/adonia/blob/main/apps/docs/modules/overview.md)
106
+ - [Source](https://github.com/britzdylan/adonia)
107
+
108
+ ## License
109
+
110
+ MIT
package/build/cli.js CHANGED
@@ -10,7 +10,7 @@ import { packageVersion } from './host.js';
10
10
  const program = new Command();
11
11
  program
12
12
  .name('adonia')
13
- .description('Adonia modules for AdonisJS')
13
+ .description('A CLI that copies AdonisJS modules from a registry into your app.')
14
14
  .version(packageVersion());
15
15
  function shared(cmd) {
16
16
  const opts = cmd.optsWithGlobals();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "adonia",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "Adonia modules for AdonisJS \u2014 CLI and bundled registry",
6
+ "description": "A CLI that copies AdonisJS modules from a registry into your app.",
7
7
  "bin": {
8
8
  "adonia": "./build/cli.js"
9
9
  },
@@ -17,7 +17,8 @@
17
17
  "registry"
18
18
  ],
19
19
  "engines": {
20
- "node": ">=20"
20
+ "node": ">=24",
21
+ "npm": ">=11"
21
22
  },
22
23
  "scripts": {
23
24
  "build": "tsc",
@@ -10,7 +10,7 @@ npx adonia@latest add auth
10
10
  npx adonia@latest add auth --with-adapters
11
11
  npx adonia@latest add auth --with-stubs
12
12
  npx adonia@latest add auth --with-routes --wire-routes
13
- # or full kit:
13
+ # or every module:
14
14
  npx adonia@latest init --scaffold
15
15
  ```
16
16
 
@@ -49,9 +49,9 @@ Each feature module (and `api`) ships a manifest:
49
49
  them. `--with-adapters` copies Lucid/SDK adapters to `app/adapters/`.
50
50
  `--with-controllers` and `--with-stubs` imply adapters. `--with-validators`
51
51
  also copies `providers/`; `--with-routes` and `--with-stubs` also copy
52
- `start/` (limiter example). Adonis kits (`@adonisjs/mail`,
52
+ `start/` (limiter example). Adonis packages (`@adonisjs/mail`,
53
53
  `@adonisjs/drive`, `@adonisjs/limiter`) are not stubbed with no-ops.
54
- `add` and `check` warn when a copied stub needs a kit that is missing
54
+ `add` and `check` warn when a copied stub needs a package that is missing
55
55
  from `package.json` and print `node ace add @adonisjs/<pkg>`.
56
56
  - **dependencies** — npm packages this module imports.
57
57
  - **registryDependencies** — other modules that must already be present.