@antelopejs/core 1.19.0 → 1.20.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.
Files changed (228) hide show
  1. package/README.md +51 -27
  2. package/dist/cli/catalog-manifest.d.ts +29 -0
  3. package/dist/cli/catalog-manifest.js +175 -0
  4. package/dist/cli/catalog-manifest.js.map +1 -0
  5. package/dist/cli/command-runner.js +2 -4
  6. package/dist/cli/command-runner.js.map +1 -1
  7. package/dist/cli/commands/config/get-action.js +3 -4
  8. package/dist/cli/commands/config/get-action.js.map +1 -1
  9. package/dist/cli/commands/config/keys.d.ts +1 -1
  10. package/dist/cli/commands/config/keys.js +2 -3
  11. package/dist/cli/commands/config/keys.js.map +1 -1
  12. package/dist/cli/commands/config/show-action.js +2 -3
  13. package/dist/cli/commands/config/show-action.js.map +1 -1
  14. package/dist/cli/commands/module/create-module.d.ts +9 -0
  15. package/dist/cli/commands/module/create-module.js +135 -0
  16. package/dist/cli/commands/module/create-module.js.map +1 -0
  17. package/dist/cli/commands/module/init-action.d.ts +1 -1
  18. package/dist/cli/commands/module/init-action.js +28 -105
  19. package/dist/cli/commands/module/init-action.js.map +1 -1
  20. package/dist/cli/commands/module/init.js +1 -1
  21. package/dist/cli/commands/module/init.js.map +1 -1
  22. package/dist/cli/commands/module/test-action.js +3 -2
  23. package/dist/cli/commands/module/test-action.js.map +1 -1
  24. package/dist/cli/commands/project/dev-action.js +0 -8
  25. package/dist/cli/commands/project/dev-action.js.map +1 -1
  26. package/dist/cli/commands/project/init-action.d.ts +1 -0
  27. package/dist/cli/commands/project/init-action.js +5 -2
  28. package/dist/cli/commands/project/init-action.js.map +1 -1
  29. package/dist/cli/commands/project/init.js +6 -1
  30. package/dist/cli/commands/project/init.js.map +1 -1
  31. package/dist/cli/commands/project/logging/show-action.js +2 -2
  32. package/dist/cli/commands/project/logging/show-action.js.map +1 -1
  33. package/dist/cli/commands/project/modules/add-action.js +4 -1
  34. package/dist/cli/commands/project/modules/add-action.js.map +1 -1
  35. package/dist/cli/commands/project/modules/install-action.js +3 -2
  36. package/dist/cli/commands/project/modules/install-action.js.map +1 -1
  37. package/dist/cli/commands/project/modules/list-action.js +38 -28
  38. package/dist/cli/commands/project/modules/list-action.js.map +1 -1
  39. package/dist/cli/commands/project/modules/module-locks.js +1 -1
  40. package/dist/cli/commands/project/modules/module-locks.js.map +1 -1
  41. package/dist/cli/commands/project/modules/update-action.js +11 -6
  42. package/dist/cli/commands/project/modules/update-action.js.map +1 -1
  43. package/dist/cli/commands/shared/project-command.js +3 -1
  44. package/dist/cli/commands/shared/project-command.js.map +1 -1
  45. package/dist/cli/common.d.ts +5 -1
  46. package/dist/cli/common.js +31 -5
  47. package/dist/cli/common.js.map +1 -1
  48. package/dist/cli/core-version.js +3 -1
  49. package/dist/cli/core-version.js.map +1 -1
  50. package/dist/cli/full-cli.js +1 -1
  51. package/dist/cli/full-cli.js.map +1 -1
  52. package/dist/cli/git-operations.d.ts +4 -25
  53. package/dist/cli/git-operations.js +17 -4
  54. package/dist/cli/git-operations.js.map +1 -1
  55. package/dist/cli/options.d.ts +1 -0
  56. package/dist/cli/options.js +7 -1
  57. package/dist/cli/options.js.map +1 -1
  58. package/dist/cli/plugin-arguments.js +4 -1
  59. package/dist/cli/plugin-arguments.js.map +1 -1
  60. package/dist/cli/plugin-management.js +11 -5
  61. package/dist/cli/plugin-management.js.map +1 -1
  62. package/dist/cli/plugin-package.js +27 -1
  63. package/dist/cli/plugin-package.js.map +1 -1
  64. package/dist/cli/plugin-registry.js +16 -11
  65. package/dist/cli/plugin-registry.js.map +1 -1
  66. package/dist/cli/process-runner.js +2 -2
  67. package/dist/cli/process-runner.js.map +1 -1
  68. package/dist/cli/production-start.d.ts +1 -2
  69. package/dist/cli/production-start.js.map +1 -1
  70. package/dist/cli/version-check.js +5 -5
  71. package/dist/cli/version-check.js.map +1 -1
  72. package/dist/core/cli/public.d.ts +1 -1
  73. package/dist/core/cli/public.js.map +1 -1
  74. package/dist/core/config/config-editor.d.ts +2 -2
  75. package/dist/core/config/config-editor.js.map +1 -1
  76. package/dist/core/config/config-fields.d.ts +16 -0
  77. package/dist/core/config/config-fields.js +161 -0
  78. package/dist/core/config/config-fields.js.map +1 -0
  79. package/dist/core/config/config-loader.d.ts +2 -10
  80. package/dist/core/config/config-loader.js +32 -10
  81. package/dist/core/config/config-loader.js.map +1 -1
  82. package/dist/core/config/config-parser.d.ts +6 -4
  83. package/dist/core/config/config-parser.js +50 -53
  84. package/dist/core/config/config-parser.js.map +1 -1
  85. package/dist/core/config/config-var-store.d.ts +1 -1
  86. package/dist/core/config/config-var-store.js.map +1 -1
  87. package/dist/core/config/config-vars.d.ts +3 -3
  88. package/dist/core/config/config-vars.js +12 -3
  89. package/dist/core/config/config-vars.js.map +1 -1
  90. package/dist/core/config/index.d.ts +1 -0
  91. package/dist/core/config/index.js +4 -1
  92. package/dist/core/config/index.js.map +1 -1
  93. package/dist/core/config/project-env.js +5 -9
  94. package/dist/core/config/project-env.js.map +1 -1
  95. package/dist/core/downloaders/git.js.map +1 -1
  96. package/dist/core/downloaders/package.js +23 -7
  97. package/dist/core/downloaders/package.js.map +1 -1
  98. package/dist/core/downloaders/registry.d.ts +1 -1
  99. package/dist/core/downloaders/registry.js +2 -1
  100. package/dist/core/downloaders/registry.js.map +1 -1
  101. package/dist/core/downloaders/utils.js +9 -13
  102. package/dist/core/downloaders/utils.js.map +1 -1
  103. package/dist/core/embedded/runtime.d.ts +4 -3
  104. package/dist/core/embedded/runtime.js +14 -8
  105. package/dist/core/embedded/runtime.js.map +1 -1
  106. package/dist/core/embedded/types.d.ts +2 -0
  107. package/dist/core/modules/build-artifact.d.ts +4 -4
  108. package/dist/core/modules/build-artifact.js +58 -1
  109. package/dist/core/modules/build-artifact.js.map +1 -1
  110. package/dist/core/modules/index.d.ts +1 -0
  111. package/dist/core/modules/index.js +1 -0
  112. package/dist/core/modules/index.js.map +1 -1
  113. package/dist/core/modules/interface-registry.js.map +1 -1
  114. package/dist/core/modules/module-cache.js +11 -3
  115. package/dist/core/modules/module-cache.js.map +1 -1
  116. package/dist/core/modules/module-errors.d.ts +2 -3
  117. package/dist/core/modules/module-errors.js +5 -3
  118. package/dist/core/modules/module-errors.js.map +1 -1
  119. package/dist/core/modules/module-lifecycle.d.ts +0 -3
  120. package/dist/core/modules/module-lifecycle.js +16 -19
  121. package/dist/core/modules/module-lifecycle.js.map +1 -1
  122. package/dist/core/modules/module-manager-construction.d.ts +2 -3
  123. package/dist/core/modules/module-manager-construction.js +8 -8
  124. package/dist/core/modules/module-manager-construction.js.map +1 -1
  125. package/dist/core/modules/module-manager-context.d.ts +2 -3
  126. package/dist/core/modules/module-manager-context.js +2 -118
  127. package/dist/core/modules/module-manager-context.js.map +1 -1
  128. package/dist/core/modules/module-manager-operations.d.ts +7 -0
  129. package/dist/core/modules/module-manager-operations.js +196 -0
  130. package/dist/core/modules/module-manager-operations.js.map +1 -0
  131. package/dist/core/modules/module-manager-packages.js +2 -1
  132. package/dist/core/modules/module-manager-packages.js.map +1 -1
  133. package/dist/core/modules/module-manager.js +2 -2
  134. package/dist/core/modules/module-manager.js.map +1 -1
  135. package/dist/core/modules/module-manifest.d.ts +2 -20
  136. package/dist/core/modules/module-manifest.js +6 -9
  137. package/dist/core/modules/module-manifest.js.map +1 -1
  138. package/dist/core/modules/module-package-json.d.ts +20 -0
  139. package/dist/core/modules/module-package-json.js +158 -0
  140. package/dist/core/modules/module-package-json.js.map +1 -0
  141. package/dist/core/modules/module.d.ts +1 -1
  142. package/dist/core/modules/module.js.map +1 -1
  143. package/dist/core/modules/resolver-detour.js +4 -4
  144. package/dist/core/modules/resolver-detour.js.map +1 -1
  145. package/dist/core/modules/resolver.js +3 -1
  146. package/dist/core/modules/resolver.js.map +1 -1
  147. package/dist/core/modules/version-checker.js +9 -6
  148. package/dist/core/modules/version-checker.js.map +1 -1
  149. package/dist/core/output/boundary.js +10 -13
  150. package/dist/core/output/boundary.js.map +1 -1
  151. package/dist/core/output/cancellation.d.ts +5 -2
  152. package/dist/core/output/cancellation.js.map +1 -1
  153. package/dist/core/output/child-process.js +1 -1
  154. package/dist/core/output/child-process.js.map +1 -1
  155. package/dist/core/output/command.js.map +1 -1
  156. package/dist/core/output/data.d.ts +4 -4
  157. package/dist/core/output/data.js.map +1 -1
  158. package/dist/core/output/failures.d.ts +2 -2
  159. package/dist/core/output/failures.js +23 -32
  160. package/dist/core/output/failures.js.map +1 -1
  161. package/dist/core/output/help.js.map +1 -1
  162. package/dist/core/output/logging-utils.js.map +1 -1
  163. package/dist/core/output/package-manager.js +10 -4
  164. package/dist/core/output/package-manager.js.map +1 -1
  165. package/dist/core/output/prompt.js.map +1 -1
  166. package/dist/core/output/translations.d.ts +2 -2
  167. package/dist/core/output/translations.js +19 -14
  168. package/dist/core/output/translations.js.map +1 -1
  169. package/dist/core/output/types.d.ts +4 -1
  170. package/dist/core/output/ui.js.map +1 -1
  171. package/dist/core/repl/repl-session.d.ts +5 -2
  172. package/dist/core/repl/repl-session.js +1 -1
  173. package/dist/core/repl/repl-session.js.map +1 -1
  174. package/dist/core/resolution/binding-graph.js.map +1 -1
  175. package/dist/core/resolution/interface-dependencies.js +13 -5
  176. package/dist/core/resolution/interface-dependencies.js.map +1 -1
  177. package/dist/core/resolution/stub-interface-runtime.d.ts +3 -1
  178. package/dist/core/resolution/stub-interface-runtime.js +9 -5
  179. package/dist/core/resolution/stub-interface-runtime.js.map +1 -1
  180. package/dist/core/runtime/build-refresh.d.ts +1 -2
  181. package/dist/core/runtime/build-refresh.js +11 -7
  182. package/dist/core/runtime/build-refresh.js.map +1 -1
  183. package/dist/core/runtime/core-module-interface.js +6 -7
  184. package/dist/core/runtime/core-module-interface.js.map +1 -1
  185. package/dist/core/runtime/dev-server-registry.d.ts +1 -1
  186. package/dist/core/runtime/dev-server-registry.js +9 -6
  187. package/dist/core/runtime/dev-server-registry.js.map +1 -1
  188. package/dist/core/runtime/module-interfaces.js +3 -1
  189. package/dist/core/runtime/module-interfaces.js.map +1 -1
  190. package/dist/core/runtime/module-load-failure.d.ts +1 -1
  191. package/dist/core/runtime/module-load-failure.js +4 -4
  192. package/dist/core/runtime/module-load-failure.js.map +1 -1
  193. package/dist/core/runtime/module-loading.d.ts +2 -2
  194. package/dist/core/runtime/module-loading.js +2 -5
  195. package/dist/core/runtime/module-loading.js.map +1 -1
  196. package/dist/core/runtime/runtime-bootstrap.js +9 -8
  197. package/dist/core/runtime/runtime-bootstrap.js.map +1 -1
  198. package/dist/core/runtime/shutdown/process-tree.js +2 -2
  199. package/dist/core/runtime/shutdown/process-tree.js.map +1 -1
  200. package/dist/core/runtime/watch/file-watcher.js +2 -5
  201. package/dist/core/runtime/watch/file-watcher.js.map +1 -1
  202. package/dist/core/test/stub-interface.d.ts +13 -1
  203. package/dist/core/test/stub-interface.js +4 -2
  204. package/dist/core/test/stub-interface.js.map +1 -1
  205. package/dist/core/test/test-module.js +22 -4
  206. package/dist/core/test/test-module.js.map +1 -1
  207. package/dist/index.d.ts +1 -1
  208. package/dist/index.js.map +1 -1
  209. package/dist/logging/index.js +5 -7
  210. package/dist/logging/index.js.map +1 -1
  211. package/dist/logging/log-template.js +11 -9
  212. package/dist/logging/log-template.js.map +1 -1
  213. package/dist/utils/field-checks.d.ts +25 -0
  214. package/dist/utils/field-checks.js +94 -0
  215. package/dist/utils/field-checks.js.map +1 -0
  216. package/dist/utils/index.d.ts +1 -0
  217. package/dist/utils/index.js +1 -0
  218. package/dist/utils/index.js.map +1 -1
  219. package/dist/utils/object.d.ts +5 -7
  220. package/dist/utils/object.js +36 -18
  221. package/dist/utils/object.js.map +1 -1
  222. package/dist/utils/package-resolution.d.ts +2 -2
  223. package/dist/utils/package-resolution.js +26 -1
  224. package/dist/utils/package-resolution.js.map +1 -1
  225. package/dist/utils/promise.d.ts +5 -5
  226. package/dist/utils/promise.js.map +1 -1
  227. package/package.json +16 -6
  228. package/skills/ajs-cli/SKILL.md +2 -2
package/README.md CHANGED
@@ -1,34 +1,44 @@
1
1
  <div align="center">
2
- <img src="./.github/assets/logo.png" alt="AntelopeJS logo" width="88">
2
+ <img data-illustration src="./.github/assets/logo.png" alt="AntelopeJS logo" width="88">
3
3
  <h1>AntelopeJS</h1>
4
4
  <p><strong>Hexagonal architecture, beyond your own code.</strong></p>
5
5
 
6
- <a href="https://www.npmjs.com/package/@antelopejs/core"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/core?style=for-the-badge&labelColor=000000&color=000000"></a>
7
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/core?style=for-the-badge&labelColor=000000&color=000000"></a>
8
- <a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
9
- <a href="https://framework.antelopejs.com/docs/get-started/introduction"><img alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
6
+ <a href="https://www.npmjs.com/package/@antelopejs/core"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/core?style=for-the-badge&labelColor=000000&color=000000"></a>
7
+ <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/core?style=for-the-badge&labelColor=000000&color=000000"></a>
8
+ <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
9
+ <a href="https://framework.antelopejs.com/docs/get-started/introduction"><img data-illustration alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
10
+
11
+ [Docs](https://framework.antelopejs.com/docs/get-started/introduction) · [Quick start](#quick-start) · [Discord](https://discord.gg/g4pFt6eXqu)
12
+
13
+ If AntelopeJS saves you work, a ⭐ helps other developers find it.
10
14
 
11
15
  </div>
12
16
 
17
+ <img data-illustration alt="Screen recording from the AntelopeJS framework film. A hexagon labelled your code is surrounded by auth, mail, queue, database, payment and storage modules under the caption Hexagonal architecture, beyond your own code. In antelope.config.ts the nodemailer provider is replaced by brevo under the caption Change providers in one file. git diff --stat then reports 1 file changed, and a grid of the project's source files stays marked unchanged under the caption Your code stays the same." src="./.github/assets/swap.gif">
18
+
19
+ **The AntelopeJS framework (3:41).** Contracts, providers you can swap, your own modules and one CLI.
20
+
21
+ https://github.com/user-attachments/assets/c632616c-e48d-4c7e-9306-22ad0f4a6351
22
+
13
23
  AntelopeJS is a TypeScript framework and CLI for Node.js applications. It extends the ports-and-adapters model from your own code to the modules you install: business modules depend on contracts, provider modules implement them, and the application picks which provider runs. The open-source back office [AntelopeJS DMS](https://github.com/AntelopeJS/dms) is built on it.
14
24
 
25
+ ## Why AntelopeJS
26
+
15
27
  <p align="center">
16
- <img src="./.github/assets/contract-model.svg" alt="A business module depends on the database contract; the MongoDB and RethinkDB modules implement it; antelope.config.ts selects MongoDB." width="880">
28
+ <img data-illustration src="./.github/assets/contract-model.svg" alt="A business module depends on the database contract; the MongoDB and RethinkDB modules implement it; antelope.config.ts selects MongoDB." width="880">
17
29
  </p>
18
30
 
19
- ## Why AntelopeJS
20
-
21
31
  - **Contracts, not imports.** A module imports interface packages such as [`@antelopejs/interface-database`](https://github.com/AntelopeJS/interface-database), never another module's files.
22
- - **Providers you can swap.** [`@antelopejs/postgres`](https://github.com/AntelopeJS/postgres), [`@antelopejs/mongodb`](https://github.com/AntelopeJS/mongodb) and [`@antelopejs/rethinkdb`](https://github.com/AntelopeJS/rethinkdb) implement the same database contract; `antelope.config.ts` chooses one, from npm, Git or a local folder.
23
- - **A runtime that wires them.** The core binds every interface to its provider, queues calls until the provider is ready, and runs each module's `construct`, `start`, `stop` and `destroy` steps.
32
+ - **Providers you can swap.** [`@antelopejs/postgres`](https://github.com/AntelopeJS/postgres), [`@antelopejs/mongodb`](https://github.com/AntelopeJS/mongodb), and [`@antelopejs/rethinkdb`](https://github.com/AntelopeJS/rethinkdb) implement the same database contract. `antelope.config.ts` chooses one, from npm, Git, or a local folder.
33
+ - **A runtime that wires them.** The core binds every interface to its provider, queues calls until the provider is ready, and runs each module's `construct`, `start`, `stop`, and `destroy` steps.
24
34
  - **Hot reload in development.** `ajs project dev --watch` reloads a changed module without restarting the others.
25
- - **One CLI.** `ajs` creates projects and modules, adds providers, runs tests, and builds and starts the application. It can also run embedded in a host application through `createRuntime`.
35
+ - **One CLI.** `ajs` creates projects and modules, adds providers, runs tests, and builds and starts the application. A host application can also embed the runtime through `createRuntime`.
26
36
 
27
- A replacement provider leaves consuming code unchanged only when it supports the contract version and behavior that code relies on. Configuration, credentials and data migrations still need your attention.
37
+ A replacement provider leaves consuming code unchanged only when it supports the contract version and behavior that code relies on. You still handle its configuration, credentials, and data migrations.
28
38
 
29
39
  ## Install
30
40
 
31
- AntelopeJS requires Node.js 20.19 or later. Install the CLI globally:
41
+ The Node.js versions AntelopeJS supports are the `engines` field of its [`package.json`](./package.json). Run `npm view @antelopejs/core engines` to read them for a published release. There is nothing to install first: the quick start below runs the CLI with `npx`. To get the `ajs` command on your `PATH`, install the CLI globally:
32
42
 
33
43
  ```bash
34
44
  pnpm add -g @antelopejs/core
@@ -36,19 +46,21 @@ pnpm add -g @antelopejs/core
36
46
 
37
47
  ## Quick start
38
48
 
39
- Create a project with a first module, then run it in development mode:
49
+ Create a project with a first module, then run it in development mode. Inside a project that lists `@antelopejs/core` as a dependency, npx runs that installed copy:
40
50
 
41
51
  ```bash
42
- ajs project init my-app
52
+ npx @antelopejs/core project init my-app --template blank-typescript --pm pnpm --no-git-init
43
53
  cd my-app
44
- ajs project dev --watch
54
+ npx @antelopejs/core project dev --watch
45
55
  ```
46
56
 
47
- Add a provider for an interface your module uses, or let the CLI find one for every unresolved interface:
57
+ Leave out the flags to choose a template interactively. Templates are named by slug, for example `blank-typescript` and `dms-demo`.
58
+
59
+ Add a provider for an interface your module uses. `ajs project modules install` adds one for every interface that no module implements yet:
48
60
 
49
61
  ```bash
50
- ajs project modules add @antelopejs/mongodb
51
- ajs project modules install
62
+ npx @antelopejs/core project modules add @antelopejs/mongodb
63
+ npx @antelopejs/core project modules install
52
64
  ```
53
65
 
54
66
  ## Plugins
@@ -57,19 +69,19 @@ Official plugins add command groups to `ajs` and ship as separate global package
57
69
 
58
70
  | Command | Package | Purpose |
59
71
  | --------- | ------------------------------------------------------------------------ | ------------------------------------------ |
60
- | `ajs dms` | [`@antelopejs/dms-frontend`](https://github.com/AntelopeJS/dms-frontend) | Develop, build and deploy the DMS frontend |
72
+ | `ajs dms` | [`@antelopejs/dms-frontend`](https://github.com/AntelopeJS/dms-frontend) | Develop, build, and deploy the DMS frontend |
61
73
 
62
- When a plugin is missing, `ajs` offers to install it with the package manager that installed the CLI. `ajs plugins` lists the official plugins and `ajs update` updates the CLI with every installed plugin.
74
+ When a plugin is missing, `ajs` offers to install it with the package manager that installed the CLI. `ajs plugins` lists the official plugins. `ajs update` updates the CLI and every official plugin installed globally.
63
75
 
64
76
  ## Agent skills
65
77
 
66
- `@antelopejs/core` ships the framework's agent skills in `skills/`, declared under `antelopeJs.skills`: `antelopejs` (the mental model and router), `ajs-cli`, `ajs-consume-interface` and `ajs-author-interface`. They follow the core version a project installs. The [AntelopeJS agent skills](https://github.com/AntelopeJS/agent-skills) sync links them, like every package-shipped skill, into a project's `.claude/skills/` and `.agents/skills/`, and the DMS assistant (`@antelopejs/dms-ai`) loads them on its own.
78
+ `@antelopejs/core` ships the framework's agent skills in `skills/`, declared under `antelopeJs.skills`: `antelopejs` (the mental model and router), `ajs-cli`, `ajs-consume-interface`, and `ajs-author-interface`. Each project gets the skills of the core version it installs. The [AntelopeJS agent skills](https://github.com/AntelopeJS/agent-skills) sync links them into a project's `.claude/skills/` and `.agents/skills/`, as it does for every skill a package ships. The DMS assistant (`@antelopejs/dms-ai`) loads them on its own.
67
79
 
68
80
  ## Documentation
69
81
 
70
82
  - [Introduction](https://framework.antelopejs.com/docs/get-started/introduction): why the same boundaries matter across your application and its dependencies
71
83
  - [Quick start](https://framework.antelopejs.com/docs/get-started/quick-start): create and run your first project
72
- - [Architecture](https://framework.antelopejs.com/docs/get-started/architecture): contracts, implementations and application assembly
84
+ - [Architecture](https://framework.antelopejs.com/docs/get-started/architecture): contracts, implementations, and application assembly
73
85
  - [Interfaces](https://framework.antelopejs.com/docs/concepts/interfaces) and [modules](https://framework.antelopejs.com/docs/concepts/modules): define and implement a capability
74
86
  - [Configuration](https://framework.antelopejs.com/docs/concepts/configuration): select module sources and configure providers
75
87
  - [CLI cheat sheet](https://framework.antelopejs.com/docs/cli/cheat-sheet): every `ajs` command
@@ -77,10 +89,15 @@ When a plugin is missing, `ajs` offers to install it with the package manager th
77
89
 
78
90
  ## Compatibility
79
91
 
80
- | Requirement | Version |
81
- | ---------------------------------------------------------------------------- | ---------------- |
82
- | Node.js | `>=20.19` |
83
- | [`@antelopejs/interface-core`](https://github.com/AntelopeJS/interface-core) | `>=0.3.0 <0.4.0` |
92
+ <!-- antelopejs-docs-compat:start -->
93
+
94
+ | Package | Supported | Tested with |
95
+ | ---------------------------- | ---------------- | ----------- |
96
+ | `@antelopejs/interface-core` | `>=0.4.0 <0.5.0` | `0.4.0` |
97
+
98
+ <!-- antelopejs-docs-compat:end -->
99
+
100
+ The `engines` field of [`package.json`](./package.json) holds the supported Node.js range. The contract that `@antelopejs/core` implements is [`@antelopejs/interface-core`](https://github.com/AntelopeJS/interface-core), whose range the table above lists.
84
101
 
85
102
  ## Contributing
86
103
 
@@ -95,3 +112,10 @@ pnpm test
95
112
  ## License
96
113
 
97
114
  [Apache-2.0](./LICENSE)
115
+
116
+ ## Requirements
117
+
118
+ <!-- antelopejs-docs-node:start -->
119
+
120
+ This package requires Node.js `^20.19.0 || >=22.12.0`.
121
+ <!-- antelopejs-docs-node:end -->
@@ -0,0 +1,29 @@
1
+ import type { ModuleSource } from "@antelopejs/interface-core/config";
2
+ import { type NextStep, type PackageManagerName } from "../core/output";
3
+ export interface GitManifest {
4
+ interfaces?: Record<string, string>;
5
+ starredInterfaces?: string[];
6
+ templates?: Template[];
7
+ projectTemplates?: Template[];
8
+ }
9
+ export interface Template {
10
+ name: string;
11
+ repository: string;
12
+ branch: string;
13
+ description?: string;
14
+ packageManager?: PackageManagerName;
15
+ install?: boolean;
16
+ nextSteps?: NextStep[];
17
+ }
18
+ export interface InterfaceManifest {
19
+ description?: string;
20
+ package?: string;
21
+ modules?: ModuleInterfaceInfo[];
22
+ }
23
+ export interface ModuleInterfaceInfo {
24
+ name: string;
25
+ source: ModuleSource;
26
+ }
27
+ export declare function decodeGitManifest(text: string, where: string): GitManifest;
28
+ export declare function decodeInterfaceManifest(text: string, where: string): InterfaceManifest;
29
+ export declare function requireCatalogMember<K extends keyof GitManifest>(manifest: GitManifest, member: K, where: string): NonNullable<GitManifest[K]>;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeGitManifest = decodeGitManifest;
4
+ exports.decodeInterfaceManifest = decodeInterfaceManifest;
5
+ exports.requireCatalogMember = requireCatalogMember;
6
+ const output_1 = require("../core/output");
7
+ const utils_1 = require("../utils");
8
+ const MODULE_SOURCE_TYPES = [
9
+ "local",
10
+ "git",
11
+ "package",
12
+ "local-folder",
13
+ ];
14
+ function isModuleSourceType(value) {
15
+ return MODULE_SOURCE_TYPES.some((type) => type === value);
16
+ }
17
+ function isPackageManagerName(value) {
18
+ return output_1.PACKAGE_MANAGER_NAMES.some((name) => name === value);
19
+ }
20
+ class CatalogReader {
21
+ where;
22
+ constructor(where) {
23
+ this.where = where;
24
+ }
25
+ refuse(member, expected) {
26
+ return new Error(`Invalid catalog manifest '${this.where}': ${member} must be ${expected}.`);
27
+ }
28
+ optionalString(member, value) {
29
+ if (value !== undefined && !(0, utils_1.isString)(value)) {
30
+ throw this.refuse(member, "a string");
31
+ }
32
+ }
33
+ optionalBoolean(member, value) {
34
+ if (value !== undefined && typeof value !== "boolean") {
35
+ throw this.refuse(member, "true or false");
36
+ }
37
+ }
38
+ string(member, value) {
39
+ if (!(0, utils_1.isString)(value)) {
40
+ throw this.refuse(member, "a string");
41
+ }
42
+ }
43
+ list(member, value) {
44
+ if (value !== undefined && !Array.isArray(value)) {
45
+ throw this.refuse(member, "a list");
46
+ }
47
+ }
48
+ object(member, value) {
49
+ if (!(0, utils_1.isObject)(value)) {
50
+ throw this.refuse(member, "an object");
51
+ }
52
+ }
53
+ interfaceFolders(manifest) {
54
+ const value = manifest.interfaces;
55
+ if (value === undefined) {
56
+ return undefined;
57
+ }
58
+ if (value === null) {
59
+ throw this.refuse("interfaces", "an object");
60
+ }
61
+ if (!(0, utils_1.isObject)(value)) {
62
+ return {};
63
+ }
64
+ return Object.fromEntries(Object.entries(value).map(([name, folder]) => {
65
+ this.string(`interfaces.${name}`, folder);
66
+ return [name, folder];
67
+ }));
68
+ }
69
+ starredInterfaces(manifest) {
70
+ const value = manifest.starredInterfaces;
71
+ this.list("starredInterfaces", value);
72
+ return value?.map((entry, index) => {
73
+ this.string(`starredInterfaces[${index}]`, entry);
74
+ return entry;
75
+ });
76
+ }
77
+ templates(member, manifest) {
78
+ const value = manifest[member];
79
+ this.list(member, value);
80
+ return value?.map((entry, index) => {
81
+ const at = `${member}[${index}]`;
82
+ this.object(at, entry);
83
+ return this.template(at, entry);
84
+ });
85
+ }
86
+ nextStep(at, step) {
87
+ this.string(`${at}.command`, step.command);
88
+ this.optionalString(`${at}.description`, step.description);
89
+ return { command: step.command, description: step.description };
90
+ }
91
+ template(at, template) {
92
+ if (template.packageManager !== undefined &&
93
+ !isPackageManagerName(template.packageManager)) {
94
+ throw this.refuse(`${at}.packageManager`, `one of ${output_1.PACKAGE_MANAGER_NAMES.join(", ")}`);
95
+ }
96
+ this.string(`${at}.name`, template.name);
97
+ this.string(`${at}.repository`, template.repository);
98
+ this.string(`${at}.branch`, template.branch);
99
+ this.optionalString(`${at}.description`, template.description);
100
+ this.optionalBoolean(`${at}.install`, template.install);
101
+ const nextSteps = template.nextSteps;
102
+ this.list(`${at}.nextSteps`, nextSteps);
103
+ return {
104
+ name: template.name,
105
+ repository: template.repository,
106
+ branch: template.branch,
107
+ description: template.description,
108
+ packageManager: template.packageManager,
109
+ install: template.install,
110
+ nextSteps: nextSteps?.map((step, index) => {
111
+ const stepAt = `${at}.nextSteps[${index}]`;
112
+ this.object(stepAt, step);
113
+ return this.nextStep(stepAt, step);
114
+ }),
115
+ };
116
+ }
117
+ module(at, entry) {
118
+ const { source } = entry;
119
+ if (!(0, utils_1.isObject)(source)) {
120
+ throw this.refuse(`${at}.source`, "an object");
121
+ }
122
+ if (!isModuleSourceType(source.type)) {
123
+ throw this.refuse(`${at}.source.type`, `one of ${MODULE_SOURCE_TYPES.join(", ")}`);
124
+ }
125
+ this.string(`${at}.name`, entry.name);
126
+ this.optionalString(`${at}.source.id`, source.id);
127
+ return {
128
+ name: entry.name,
129
+ source: { ...source, type: source.type, id: source.id },
130
+ };
131
+ }
132
+ }
133
+ function decodeGitManifest(text, where) {
134
+ const reader = new CatalogReader(where);
135
+ const manifest = JSON.parse(text);
136
+ reader.object("the file", manifest);
137
+ return {
138
+ interfaces: reader.interfaceFolders(manifest),
139
+ starredInterfaces: reader.starredInterfaces(manifest),
140
+ templates: reader.templates("templates", manifest),
141
+ projectTemplates: reader.templates("projectTemplates", manifest),
142
+ };
143
+ }
144
+ function decodeInterfaceManifest(text, where) {
145
+ const reader = new CatalogReader(where);
146
+ const document = JSON.parse(text);
147
+ if (!(0, utils_1.isObject)(document)) {
148
+ return {};
149
+ }
150
+ const { modules } = document;
151
+ if (modules !== null) {
152
+ reader.list("modules", modules);
153
+ }
154
+ return {
155
+ description: (0, utils_1.isString)(document.description)
156
+ ? document.description
157
+ : undefined,
158
+ package: (0, utils_1.isString)(document.package) ? document.package : undefined,
159
+ modules: modules === null
160
+ ? undefined
161
+ : modules?.map((entry, index) => {
162
+ const at = `modules[${index}]`;
163
+ reader.object(at, entry);
164
+ return reader.module(at, entry);
165
+ }),
166
+ };
167
+ }
168
+ function requireCatalogMember(manifest, member, where) {
169
+ const value = manifest[member];
170
+ if (value === undefined) {
171
+ throw new CatalogReader(where).refuse(member, "present");
172
+ }
173
+ return value;
174
+ }
175
+ //# sourceMappingURL=catalog-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-manifest.js","sourceRoot":"","sources":["../../src/cli/catalog-manifest.ts"],"names":[],"mappings":";;AAoPA,8CAUC;AASD,0DA2BC;AAOD,oDAUC;AAjTD,2CAIwB;AACxB,oCAA8C;AAsC9C,MAAM,mBAAmB,GAAoC;IAC3D,OAAO;IACP,KAAK;IACL,SAAS;IACT,cAAc;CACf,CAAC;AA6BF,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IAC1C,OAAO,8BAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,aAAa;IACY;IAA7B,YAA6B,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAE9C,MAAM,CAAC,MAAc,EAAE,QAAgB;QACrC,OAAO,IAAI,KAAK,CACd,6BAA6B,IAAI,CAAC,KAAK,MAAM,MAAM,YAAY,QAAQ,GAAG,CAC3E,CAAC;IACJ,CAAC;IAED,cAAc,CACZ,MAAc,EACd,KAAc;QAEd,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED,eAAe,CACb,MAAc,EACd,KAAc;QAEd,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACtD,MAAM,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CAAC;YAClC,CAAC,CAAC;KACT,CAAC;AACJ,CAAC;AAOD,SAAgB,oBAAoB,CAClC,QAAqB,EACrB,MAAS,EACT,KAAa;IAEb,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -5,15 +5,13 @@ exports.runGlobalInstall = runGlobalInstall;
5
5
  const output_1 = require("../core/output");
6
6
  const global_package_manager_1 = require("./global-package-manager");
7
7
  const process_runner_1 = require("./process-runner");
8
- function describeError(error) {
9
- return error instanceof Error ? error.message : String(error);
10
- }
11
8
  async function runCommand(executable, args, output, processOptions = {}) {
12
9
  try {
13
10
  return await (0, process_runner_1.runInheritedProcess)(executable, args, processOptions);
14
11
  }
15
12
  catch (error) {
16
- output.error(`Failed to run ${executable}: ${describeError(error)}`);
13
+ const reason = error instanceof Error ? error.message : String(error);
14
+ output.error(`Failed to run ${executable}: ${reason}`);
17
15
  return output_1.FAILURE_EXIT_CODE;
18
16
  }
19
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"command-runner.js","sourceRoot":"","sources":["../../src/cli/command-runner.ts"],"names":[],"mappings":";;AA2BA,gCAYC;AAED,4CAmBC;AA3DD,2CAAmD;AACnD,qEAGkC;AAClC,qDAG0B;AAc1B,SAAS,aAAa,CAAC,KAAsC;IAC3D,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAEM,KAAK,UAAU,UAAU,CAC9B,UAAkB,EAClB,IAAc,EACd,MAAqB,EACrB,iBAA0C,EAAE;IAE5C,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,oCAA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CAAC;QACtE,MAAM,CAAC,KAAK,CAAC,iBAAiB,UAAU,KAAK,MAAM,EAAE,CAAC,CAAC;QACvD,OAAO,0BAAiB,CAAC;IAC3B,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,gBAAgB,CACpC,OAA6B;IAE7B,MAAM,OAAO,GAAG,IAAA,gDAAuB,EACrC,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,cAAc,EAAE,QAAQ,CACjC,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,4CAAmB,EAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC,CAAC;IAC7C,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,MAAM,UAAU,CACxB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,cAAc,CACvB;KACF,CAAC;AACJ,CAAC"}
@@ -19,12 +19,11 @@ function renderValue(key, value, ui) {
19
19
  ui.value(value);
20
20
  }
21
21
  async function getConfigValue(key, options, ui) {
22
- if (!keys_1.CONFIG_KEYS.includes(key)) {
22
+ if (!(0, keys_1.isConfigKey)(key)) {
23
23
  throw (0, keys_1.invalidConfigKeyError)(key);
24
24
  }
25
- const values = { ...(await (0, common_1.readUserConfig)()) };
26
- const config = values;
27
- if (!(key in config)) {
25
+ const config = await (0, common_1.readUserConfig)();
26
+ if (!Object.hasOwn(config, key)) {
28
27
  throw missingKeyError(key);
29
28
  }
30
29
  const value = config[key];
@@ -1 +1 @@
1
- {"version":3,"file":"get-action.js","sourceRoot":"","sources":["../../../../src/cli/commands/config/get-action.ts"],"names":[],"mappings":";;AAmDA,0CAEC;AArDD,iDAK8B;AAC9B,yCAA8C;AAC9C,iCAA4D;AAM5D,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,SAAS,eAAe,CAAC,GAAW;IAClC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AAW,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC;KACpD,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,eAAe,CAAC,KAAS,IAAA,qBAAY,GAAE;IACrD,OAAO,CAAC,GAAW,EAAE,OAAmB,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC"}
@@ -12,5 +12,5 @@ export type ConfigKey = keyof typeof CONFIG_VALUE_RULES;
12
12
  export declare const CONFIG_KEYS: string[];
13
13
  export declare function isConfigKey(key: string): key is ConfigKey;
14
14
  export declare function invalidConfigKeyError(key: string): CliError;
15
- export declare function invalidConfigValueError(key: string, value: string): CliError | undefined;
15
+ export declare function invalidConfigValueError(key: ConfigKey, value: string): CliError | undefined;
16
16
  export {};
@@ -25,9 +25,8 @@ function invalidConfigKeyError(key) {
25
25
  });
26
26
  }
27
27
  function invalidConfigValueError(key, value) {
28
- const rules = CONFIG_VALUE_RULES;
29
- const rule = rules[key];
30
- if (!rule || rule.isValid(value)) {
28
+ const rule = CONFIG_VALUE_RULES[key];
29
+ if (rule.isValid(value)) {
31
30
  return undefined;
32
31
  }
33
32
  return new output_1.CliError({
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../src/cli/commands/config/keys.ts"],"names":[],"mappings":";;;AAwBA,kCAEC;AAED,sDAKC;AAMD,0DAgBC;AAvDD,iDAAiE;AACjE,2CAAmD;AASnD,MAAM,kBAAkB,GAAG;IACzB,GAAG,EAAE;QACH,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,4BAAkB;QAC3B,QAAQ,EACN,sFAAsF;QACxF,OAAO,EAAE,wCAAwC;KAClD;CACwC,CAAC;AAI/B,QAAA,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAE3D,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,mBAAW,CAAC,QAAQ,CAAC,GAAG,CA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AAC;AAED,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,EAAE,8BAA8B,GAAG,GAAG;QAC3C,MAAM,EAAE,eAAe,mBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAChD,CAAC,CAAC;AACL,CAAC;AAMD,SAAgB,uBAAuB,CACrC,GAAc,EACd,KAAa;IAEb,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,EAAE,WAAW,IAAI,CAAC,IAAI,KAAK,KAAK,GAAG;QACxC,MAAM,EAAE,YAAY,IAAI,CAAC,QAAQ,GAAG;QACpC,KAAK,EAAE,CAAC,2CAA2C,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACzE,QAAQ,EAAE,wBAAe;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.showConfigAction = showConfigAction;
4
4
  const output_1 = require("../../../core/output");
5
5
  const common_1 = require("../../common");
6
+ const keys_1 = require("./keys");
6
7
  const NOT_SET = "not set";
7
8
  const CUSTOM_MARKER = "(custom)";
8
9
  function describeValue(key, value) {
9
10
  if (!value) {
10
11
  return NOT_SET;
11
12
  }
12
- const defaultValues = { ...(0, common_1.getDefaultUserConfig)() };
13
- const defaults = defaultValues;
14
- const isCustom = key in defaults && defaults[key] !== value;
13
+ const isCustom = (0, keys_1.isConfigKey)(key) && (0, common_1.getDefaultUserConfig)()[key] !== value;
15
14
  return isCustom ? `${value} ${CUSTOM_MARKER}` : value;
16
15
  }
17
16
  function renderConfig(config, ui) {
@@ -1 +1 @@
1
- {"version":3,"file":"show-action.js","sourceRoot":"","sources":["../../../../src/cli/commands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AE,CAAC,OAAO,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;QAClD,OAAO;IACT,CAAC;IACD,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACtB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAAoB,EAAE,EAAM;IACpD,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,MAAM,IAAA,uBAAc,GAAE,CAAC,EAAE,CAAC;IAC/C,IAAA,kBAAS,EAAC,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;KACjD,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAS,IAAA,qBAAY,GAAE;IACtD,OAAO,CAAC,OAAoB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type PackageManagerName } from "../../../core/output";
2
+ import { type InterfaceInfo, type Template } from "../../git-operations";
3
+ export interface ModuleInitAnswers {
4
+ template: Template;
5
+ interfaces: InterfaceInfo[];
6
+ packageManager?: PackageManagerName;
7
+ isGitInitialized: boolean;
8
+ }
9
+ export declare function createModule(modulePath: string, answers: ModuleInitAnswers): Promise<void>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.createModule = createModule;
40
+ const childProcess = __importStar(require("node:child_process"));
41
+ const node_fs_1 = require("node:fs");
42
+ const node_path_1 = __importDefault(require("node:path"));
43
+ const output_1 = require("../../../core/output");
44
+ const utils_1 = require("../../../utils");
45
+ const git_operations_1 = require("../../git-operations");
46
+ const LATEST_VERSION = "latest";
47
+ const JSON_INDENTATION = 2;
48
+ function unusableManifest(pkgJsonPath, reason) {
49
+ return new output_1.CliError({
50
+ title: `Cannot add the chosen interfaces to ${(0, output_1.displayPath)(pkgJsonPath)}`,
51
+ reason,
52
+ fixes: [
53
+ "Make the template's package.json a JSON object whose dependencies, when it has any, are an object of package names and version ranges",
54
+ ],
55
+ });
56
+ }
57
+ function addInterfaceDependencies(modulePath, interfaces) {
58
+ const packages = interfaces
59
+ .map((entry) => entry.manifest.package)
60
+ .filter((name) => Boolean(name));
61
+ if (packages.length === 0) {
62
+ return;
63
+ }
64
+ const pkgJsonPath = node_path_1.default.resolve(modulePath, "package.json");
65
+ const pkgJson = JSON.parse((0, node_fs_1.readFileSync)(pkgJsonPath, "utf8"));
66
+ if (!(0, utils_1.isObject)(pkgJson)) {
67
+ throw unusableManifest(pkgJsonPath, "The file must hold a JSON object.");
68
+ }
69
+ const dependencies = pkgJson.dependencies ?? {};
70
+ if (!(0, utils_1.isObject)(dependencies)) {
71
+ throw unusableManifest(pkgJsonPath, "Its dependencies field must be a JSON object.");
72
+ }
73
+ pkgJson.dependencies = dependencies;
74
+ packages.forEach((name) => {
75
+ dependencies[name] ??= LATEST_VERSION;
76
+ });
77
+ (0, node_fs_1.writeFileSync)(pkgJsonPath, `${JSON.stringify(pkgJson, null, JSON_INDENTATION)}\n`);
78
+ (0, output_1.success)(`Added ${interfaces.length} interface(s) to dependencies`);
79
+ }
80
+ async function installDependencies(modulePath, packageManager, template) {
81
+ if (packageManager === undefined) {
82
+ (0, output_1.info)(`Skipped the dependency install: ${template.name} installs its dependencies itself`);
83
+ return;
84
+ }
85
+ const moduleRoot = node_path_1.default.resolve(modulePath);
86
+ (0, output_1.savePackageManagerToPackageJson)(packageManager, moduleRoot);
87
+ const installSpinner = new output_1.Spinner("Installing dependencies");
88
+ await installSpinner.start();
89
+ const installCmd = await (0, output_1.getInstallCommand)(moduleRoot, false, undefined, "update");
90
+ await (0, output_1.ExecuteCMD)(installCmd, { cwd: moduleRoot });
91
+ await installSpinner.succeed("Dependencies installed");
92
+ }
93
+ async function initializeGitRepository(modulePath) {
94
+ const gitInitSpinner = new output_1.Spinner("Initializing git repository");
95
+ await gitInitSpinner.start();
96
+ try {
97
+ childProcess.execSync("git init", {
98
+ cwd: node_path_1.default.resolve(modulePath),
99
+ stdio: "ignore",
100
+ });
101
+ await gitInitSpinner.succeed("Git repository initialized");
102
+ }
103
+ catch (gitErr) {
104
+ await gitInitSpinner.fail("Failed to initialize git repository");
105
+ (0, output_1.warning)("Could not initialize git repository. You can do it manually later.");
106
+ if (gitErr instanceof Error) {
107
+ (0, output_1.warning)(gitErr);
108
+ }
109
+ }
110
+ }
111
+ async function populateModule(modulePath, answers) {
112
+ const copySpinner = new output_1.Spinner(`Creating module from template`);
113
+ await copySpinner.start();
114
+ await (0, git_operations_1.copyTemplate)(answers.template, modulePath);
115
+ await copySpinner.succeed(`Module created successfully at ${(0, output_1.getProcessPalette)().dim(node_path_1.default.resolve(modulePath))}`);
116
+ addInterfaceDependencies(modulePath, answers.interfaces);
117
+ await installDependencies(modulePath, answers.packageManager, answers.template);
118
+ if (answers.isGitInitialized) {
119
+ await initializeGitRepository(modulePath);
120
+ }
121
+ }
122
+ async function createModule(modulePath, answers) {
123
+ const isNewDirectory = !(0, node_fs_1.existsSync)(modulePath);
124
+ try {
125
+ await populateModule(modulePath, answers);
126
+ }
127
+ catch (error) {
128
+ if (isNewDirectory) {
129
+ (0, node_fs_1.rmSync)(node_path_1.default.resolve(modulePath), { recursive: true, force: true });
130
+ (0, output_1.info)(`Removed the incomplete directory ${(0, output_1.displayPath)(node_path_1.default.resolve(modulePath))}`);
131
+ }
132
+ throw error;
133
+ }
134
+ }
135
+ //# sourceMappingURL=create-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-module.js","sourceRoot":"","sources":["../../../../src/cli/commands/module/create-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoJA,oCAgBC;AApKD,iEAAmD;AACnD,qCAA0E;AAC1E,0DAA6B;AAE7B,iDAY8B;AAC9B,0CAA0C;AAC1C,yDAI8B;AAS9B,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,SAAS,gBAAgB,CAAC,WAAmB,EAAE,MAAc;IAC3D,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,EAAE,uCAAuC,IAAA,oBAAW,EAAC,WAAW,CAAC,EAAE;QACxE,MAAM;QACN,KAAK,EAAE;YACL,uIAAuI;SACxI;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,w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