@venizia/ignis-boot 0.2.0-2 → 0.2.0-21

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 (245) hide show
  1. package/README.md +127 -151
  2. package/dist/cjs/build-info/common/constants.d.ts +20 -0
  3. package/dist/cjs/build-info/common/constants.d.ts.map +1 -0
  4. package/dist/cjs/build-info/common/constants.js +41 -0
  5. package/dist/cjs/build-info/common/constants.js.map +1 -0
  6. package/dist/{esm → cjs/build-info}/common/index.d.ts +1 -1
  7. package/dist/cjs/build-info/common/index.d.ts.map +1 -0
  8. package/dist/cjs/{common → build-info/common}/index.js +1 -1
  9. package/dist/cjs/build-info/common/index.js.map +1 -0
  10. package/dist/cjs/build-info/common/types.d.ts +16 -0
  11. package/dist/cjs/build-info/common/types.d.ts.map +1 -0
  12. package/dist/cjs/build-info/common/types.js +3 -0
  13. package/dist/cjs/build-info/common/types.js.map +1 -0
  14. package/dist/cjs/build-info/emitter.d.ts +12 -0
  15. package/dist/cjs/build-info/emitter.d.ts.map +1 -0
  16. package/dist/cjs/build-info/emitter.js +26 -0
  17. package/dist/cjs/build-info/emitter.js.map +1 -0
  18. package/dist/cjs/build-info/index.d.ts +10 -0
  19. package/dist/cjs/build-info/index.d.ts.map +1 -0
  20. package/dist/cjs/build-info/index.js +43 -0
  21. package/dist/cjs/build-info/index.js.map +1 -0
  22. package/dist/cjs/build-info/resolver.d.ts +25 -0
  23. package/dist/cjs/build-info/resolver.d.ts.map +1 -0
  24. package/dist/cjs/build-info/resolver.js +105 -0
  25. package/dist/cjs/build-info/resolver.js.map +1 -0
  26. package/dist/cjs/clis/artifacts.d.ts +3 -0
  27. package/dist/cjs/clis/artifacts.d.ts.map +1 -0
  28. package/dist/cjs/clis/artifacts.js +60 -0
  29. package/dist/cjs/clis/artifacts.js.map +1 -0
  30. package/dist/cjs/clis/build-info.d.ts +3 -0
  31. package/dist/cjs/clis/build-info.d.ts.map +1 -0
  32. package/dist/cjs/clis/build-info.js +48 -0
  33. package/dist/cjs/clis/build-info.js.map +1 -0
  34. package/dist/cjs/common/install-quiet-logger.d.ts +2 -0
  35. package/dist/cjs/common/install-quiet-logger.d.ts.map +1 -0
  36. package/dist/cjs/common/install-quiet-logger.js +7 -0
  37. package/dist/cjs/common/install-quiet-logger.js.map +1 -0
  38. package/dist/cjs/common/quiet-logger.d.ts +18 -0
  39. package/dist/cjs/common/quiet-logger.d.ts.map +1 -0
  40. package/dist/cjs/common/quiet-logger.js +46 -0
  41. package/dist/cjs/common/quiet-logger.js.map +1 -0
  42. package/dist/cjs/generator/common/constants.d.ts +46 -0
  43. package/dist/cjs/generator/common/constants.d.ts.map +1 -0
  44. package/dist/cjs/generator/common/constants.js +87 -0
  45. package/dist/cjs/generator/common/constants.js.map +1 -0
  46. package/dist/cjs/{common → generator/common}/index.d.ts +1 -1
  47. package/dist/cjs/generator/common/index.d.ts.map +1 -0
  48. package/dist/cjs/{base → generator/common}/index.js +2 -1
  49. package/dist/cjs/generator/common/index.js.map +1 -0
  50. package/dist/cjs/generator/common/types.d.ts +18 -0
  51. package/dist/cjs/generator/common/types.d.ts.map +1 -0
  52. package/dist/cjs/generator/common/types.js +3 -0
  53. package/dist/cjs/generator/common/types.js.map +1 -0
  54. package/dist/cjs/generator/emitter.d.ts +29 -0
  55. package/dist/cjs/generator/emitter.d.ts.map +1 -0
  56. package/dist/cjs/generator/emitter.js +65 -0
  57. package/dist/cjs/generator/emitter.js.map +1 -0
  58. package/dist/cjs/generator/index.d.ts +24 -0
  59. package/dist/cjs/generator/index.d.ts.map +1 -0
  60. package/dist/cjs/generator/index.js +62 -0
  61. package/dist/cjs/generator/index.js.map +1 -0
  62. package/dist/cjs/generator/scanner.d.ts +24 -0
  63. package/dist/cjs/generator/scanner.d.ts.map +1 -0
  64. package/dist/cjs/generator/scanner.js +199 -0
  65. package/dist/cjs/generator/scanner.js.map +1 -0
  66. package/dist/cjs/index.d.ts +2 -6
  67. package/dist/cjs/index.d.ts.map +1 -1
  68. package/dist/cjs/index.js +2 -6
  69. package/dist/cjs/index.js.map +1 -1
  70. package/dist/esm/build-info/common/constants.d.ts +20 -0
  71. package/dist/esm/build-info/common/constants.d.ts.map +1 -0
  72. package/dist/esm/build-info/common/constants.js +36 -0
  73. package/dist/esm/build-info/common/constants.js.map +1 -0
  74. package/dist/esm/build-info/common/index.d.ts +3 -0
  75. package/dist/esm/build-info/common/index.d.ts.map +1 -0
  76. package/dist/esm/{common → build-info/common}/index.js +1 -1
  77. package/dist/esm/build-info/common/index.js.map +1 -0
  78. package/dist/esm/build-info/common/types.d.ts +16 -0
  79. package/dist/esm/build-info/common/types.d.ts.map +1 -0
  80. package/dist/esm/build-info/common/types.js +2 -0
  81. package/dist/esm/build-info/common/types.js.map +1 -0
  82. package/dist/esm/build-info/emitter.d.ts +12 -0
  83. package/dist/esm/build-info/emitter.d.ts.map +1 -0
  84. package/dist/esm/build-info/emitter.js +22 -0
  85. package/dist/esm/build-info/emitter.js.map +1 -0
  86. package/dist/esm/build-info/index.d.ts +10 -0
  87. package/dist/esm/build-info/index.d.ts.map +1 -0
  88. package/dist/esm/build-info/index.js +25 -0
  89. package/dist/esm/build-info/index.js.map +1 -0
  90. package/dist/esm/build-info/resolver.d.ts +25 -0
  91. package/dist/esm/build-info/resolver.d.ts.map +1 -0
  92. package/dist/esm/build-info/resolver.js +101 -0
  93. package/dist/esm/build-info/resolver.js.map +1 -0
  94. package/dist/esm/clis/artifacts.d.ts +3 -0
  95. package/dist/esm/clis/artifacts.d.ts.map +1 -0
  96. package/dist/esm/clis/artifacts.js +58 -0
  97. package/dist/esm/clis/artifacts.js.map +1 -0
  98. package/dist/esm/clis/build-info.d.ts +3 -0
  99. package/dist/esm/clis/build-info.d.ts.map +1 -0
  100. package/dist/esm/clis/build-info.js +46 -0
  101. package/dist/esm/clis/build-info.js.map +1 -0
  102. package/dist/esm/common/install-quiet-logger.d.ts +2 -0
  103. package/dist/esm/common/install-quiet-logger.d.ts.map +1 -0
  104. package/dist/esm/common/install-quiet-logger.js +5 -0
  105. package/dist/esm/common/install-quiet-logger.js.map +1 -0
  106. package/dist/esm/common/quiet-logger.d.ts +18 -0
  107. package/dist/esm/common/quiet-logger.d.ts.map +1 -0
  108. package/dist/esm/common/quiet-logger.js +42 -0
  109. package/dist/esm/common/quiet-logger.js.map +1 -0
  110. package/dist/esm/generator/common/constants.d.ts +46 -0
  111. package/dist/esm/generator/common/constants.d.ts.map +1 -0
  112. package/dist/esm/generator/common/constants.js +81 -0
  113. package/dist/esm/generator/common/constants.js.map +1 -0
  114. package/dist/esm/generator/common/index.d.ts +3 -0
  115. package/dist/esm/generator/common/index.d.ts.map +1 -0
  116. package/dist/esm/generator/common/index.js +3 -0
  117. package/dist/esm/generator/common/index.js.map +1 -0
  118. package/dist/esm/generator/common/types.d.ts +18 -0
  119. package/dist/esm/generator/common/types.d.ts.map +1 -0
  120. package/dist/esm/generator/common/types.js +2 -0
  121. package/dist/esm/generator/common/types.js.map +1 -0
  122. package/dist/esm/generator/emitter.d.ts +29 -0
  123. package/dist/esm/generator/emitter.d.ts.map +1 -0
  124. package/dist/esm/generator/emitter.js +61 -0
  125. package/dist/esm/generator/emitter.js.map +1 -0
  126. package/dist/esm/generator/index.d.ts +24 -0
  127. package/dist/esm/generator/index.d.ts.map +1 -0
  128. package/dist/esm/generator/index.js +43 -0
  129. package/dist/esm/generator/index.js.map +1 -0
  130. package/dist/esm/generator/scanner.d.ts +24 -0
  131. package/dist/esm/generator/scanner.d.ts.map +1 -0
  132. package/dist/esm/generator/scanner.js +192 -0
  133. package/dist/esm/generator/scanner.js.map +1 -0
  134. package/dist/esm/index.d.ts +2 -6
  135. package/dist/esm/index.d.ts.map +1 -1
  136. package/dist/esm/index.js +2 -6
  137. package/dist/esm/index.js.map +1 -1
  138. package/package.json +34 -46
  139. package/dist/cjs/base/base-artifact-booter.d.ts +0 -18
  140. package/dist/cjs/base/base-artifact-booter.d.ts.map +0 -1
  141. package/dist/cjs/base/base-artifact-booter.js +0 -85
  142. package/dist/cjs/base/base-artifact-booter.js.map +0 -1
  143. package/dist/cjs/base/index.d.ts +0 -2
  144. package/dist/cjs/base/index.d.ts.map +0 -1
  145. package/dist/cjs/base/index.js.map +0 -1
  146. package/dist/cjs/boot.mixin.d.ts +0 -65
  147. package/dist/cjs/boot.mixin.d.ts.map +0 -1
  148. package/dist/cjs/boot.mixin.js +0 -29
  149. package/dist/cjs/boot.mixin.js.map +0 -1
  150. package/dist/cjs/booters/controller.booter.d.ts +0 -10
  151. package/dist/cjs/booters/controller.booter.d.ts.map +0 -1
  152. package/dist/cjs/booters/controller.booter.js +0 -45
  153. package/dist/cjs/booters/controller.booter.js.map +0 -1
  154. package/dist/cjs/booters/datasource.booter.d.ts +0 -10
  155. package/dist/cjs/booters/datasource.booter.d.ts.map +0 -1
  156. package/dist/cjs/booters/datasource.booter.js +0 -45
  157. package/dist/cjs/booters/datasource.booter.js.map +0 -1
  158. package/dist/cjs/booters/index.d.ts +0 -5
  159. package/dist/cjs/booters/index.d.ts.map +0 -1
  160. package/dist/cjs/booters/index.js +0 -21
  161. package/dist/cjs/booters/index.js.map +0 -1
  162. package/dist/cjs/booters/repository.booter.d.ts +0 -10
  163. package/dist/cjs/booters/repository.booter.d.ts.map +0 -1
  164. package/dist/cjs/booters/repository.booter.js +0 -45
  165. package/dist/cjs/booters/repository.booter.js.map +0 -1
  166. package/dist/cjs/booters/service.booter.d.ts +0 -10
  167. package/dist/cjs/booters/service.booter.d.ts.map +0 -1
  168. package/dist/cjs/booters/service.booter.js +0 -45
  169. package/dist/cjs/booters/service.booter.js.map +0 -1
  170. package/dist/cjs/bootstrapper.d.ts +0 -14
  171. package/dist/cjs/bootstrapper.d.ts.map +0 -1
  172. package/dist/cjs/bootstrapper.js +0 -121
  173. package/dist/cjs/bootstrapper.js.map +0 -1
  174. package/dist/cjs/common/constants.d.ts +0 -6
  175. package/dist/cjs/common/constants.d.ts.map +0 -1
  176. package/dist/cjs/common/constants.js +0 -10
  177. package/dist/cjs/common/constants.js.map +0 -1
  178. package/dist/cjs/common/index.d.ts.map +0 -1
  179. package/dist/cjs/common/index.js.map +0 -1
  180. package/dist/cjs/common/types.d.ts +0 -52
  181. package/dist/cjs/common/types.d.ts.map +0 -1
  182. package/dist/cjs/common/types.js +0 -5
  183. package/dist/cjs/common/types.js.map +0 -1
  184. package/dist/cjs/utilities/boot.utility.d.ts +0 -9
  185. package/dist/cjs/utilities/boot.utility.d.ts.map +0 -1
  186. package/dist/cjs/utilities/boot.utility.js +0 -51
  187. package/dist/cjs/utilities/boot.utility.js.map +0 -1
  188. package/dist/cjs/utilities/index.d.ts +0 -2
  189. package/dist/cjs/utilities/index.d.ts.map +0 -1
  190. package/dist/cjs/utilities/index.js +0 -18
  191. package/dist/cjs/utilities/index.js.map +0 -1
  192. package/dist/esm/base/base-artifact-booter.d.ts +0 -18
  193. package/dist/esm/base/base-artifact-booter.d.ts.map +0 -1
  194. package/dist/esm/base/base-artifact-booter.js +0 -81
  195. package/dist/esm/base/base-artifact-booter.js.map +0 -1
  196. package/dist/esm/base/index.d.ts +0 -2
  197. package/dist/esm/base/index.d.ts.map +0 -1
  198. package/dist/esm/base/index.js +0 -2
  199. package/dist/esm/base/index.js.map +0 -1
  200. package/dist/esm/boot.mixin.d.ts +0 -65
  201. package/dist/esm/boot.mixin.d.ts.map +0 -1
  202. package/dist/esm/boot.mixin.js +0 -25
  203. package/dist/esm/boot.mixin.js.map +0 -1
  204. package/dist/esm/booters/controller.booter.d.ts +0 -10
  205. package/dist/esm/booters/controller.booter.d.ts.map +0 -1
  206. package/dist/esm/booters/controller.booter.js +0 -42
  207. package/dist/esm/booters/controller.booter.js.map +0 -1
  208. package/dist/esm/booters/datasource.booter.d.ts +0 -10
  209. package/dist/esm/booters/datasource.booter.d.ts.map +0 -1
  210. package/dist/esm/booters/datasource.booter.js +0 -42
  211. package/dist/esm/booters/datasource.booter.js.map +0 -1
  212. package/dist/esm/booters/index.d.ts +0 -5
  213. package/dist/esm/booters/index.d.ts.map +0 -1
  214. package/dist/esm/booters/index.js +0 -5
  215. package/dist/esm/booters/index.js.map +0 -1
  216. package/dist/esm/booters/repository.booter.d.ts +0 -10
  217. package/dist/esm/booters/repository.booter.d.ts.map +0 -1
  218. package/dist/esm/booters/repository.booter.js +0 -42
  219. package/dist/esm/booters/repository.booter.js.map +0 -1
  220. package/dist/esm/booters/service.booter.d.ts +0 -10
  221. package/dist/esm/booters/service.booter.d.ts.map +0 -1
  222. package/dist/esm/booters/service.booter.js +0 -42
  223. package/dist/esm/booters/service.booter.js.map +0 -1
  224. package/dist/esm/bootstrapper.d.ts +0 -14
  225. package/dist/esm/bootstrapper.d.ts.map +0 -1
  226. package/dist/esm/bootstrapper.js +0 -118
  227. package/dist/esm/bootstrapper.js.map +0 -1
  228. package/dist/esm/common/constants.d.ts +0 -6
  229. package/dist/esm/common/constants.d.ts.map +0 -1
  230. package/dist/esm/common/constants.js +0 -6
  231. package/dist/esm/common/constants.js.map +0 -1
  232. package/dist/esm/common/index.d.ts.map +0 -1
  233. package/dist/esm/common/index.js.map +0 -1
  234. package/dist/esm/common/types.d.ts +0 -52
  235. package/dist/esm/common/types.d.ts.map +0 -1
  236. package/dist/esm/common/types.js +0 -2
  237. package/dist/esm/common/types.js.map +0 -1
  238. package/dist/esm/utilities/boot.utility.d.ts +0 -9
  239. package/dist/esm/utilities/boot.utility.d.ts.map +0 -1
  240. package/dist/esm/utilities/boot.utility.js +0 -46
  241. package/dist/esm/utilities/boot.utility.js.map +0 -1
  242. package/dist/esm/utilities/index.d.ts +0 -2
  243. package/dist/esm/utilities/index.d.ts.map +0 -1
  244. package/dist/esm/utilities/index.js +0 -2
  245. package/dist/esm/utilities/index.js.map +0 -1
package/README.md CHANGED
@@ -4,216 +4,195 @@
4
4
 
5
5
  # :fire: IGNIS - `@venizia/ignis-boot`
6
6
 
7
- **Convention-based discovery and bootstrapping.**
7
+ **Generates one static registration file from your decorated classes.**
8
8
 
9
9
  [![Docs](https://img.shields.io/badge/Docs-ignis.venizia.ai-2563EB.svg?style=flat-square)](https://ignis.venizia.ai/references/base/bootstrapping)
10
10
  [![npm](https://img.shields.io/npm/v/@venizia/ignis-boot.svg?style=flat-square&color=cb3837&label=@venizia/ignis-boot)](https://www.npmjs.com/package/@venizia/ignis-boot)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-3DA639.svg?style=flat-square)](LICENSE.md)
12
12
  [![TypeScript](https://img.shields.io/badge/TypeScript-6.x-3178C6.svg?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
13
13
 
14
- [Bootstrapping reference](https://ignis.venizia.ai/references/base/bootstrapping) •
15
- [Application](https://ignis.venizia.ai/references/base/application) •
16
- [Dependency injection](https://ignis.venizia.ai/references/base/dependency-injection)
14
+ [Artifact registration reference](https://ignis.venizia.ai/references/base/bootstrapping) •
15
+ [Registering artifacts guide](https://ignis.venizia.ai/guides/core-concepts/application/bootstrapping) •
16
+ [Changelog](https://ignis.venizia.ai/changelogs/2026-09-03-deprecated-boot-api-removed)
17
17
 
18
18
  </div>
19
19
 
20
20
  ---
21
21
 
22
- Finds your controllers, services, repositories, and datasources by filename, then binds each one into
23
- the IoC container - so you never maintain a registration list that drifts from the files on disk.
22
+ `ignis-artifacts` walks a source root with the TypeScript compiler API, finds every named,
23
+ non-abstract class that carries an IGNIS stereotype decorator (`@service`, `@controller`, ...), and
24
+ writes one file of plain static imports: `src/generated/artifacts.ts`. The application passes that
25
+ file as `configs.artifacts`; `@venizia/ignis`'s `registerArtifacts` boot step binds it.
24
26
 
25
- **Most applications never import this package.** `BaseApplication` from `@venizia/ignis` already depends
26
- on it, registers the four built-in booters, and exposes `boot()`. You reach for it directly only to
27
- write a custom booter for an artifact type of your own.
27
+ **This package runs at build time only.** No decorator runs and no class is imported while
28
+ scanning - detection reads source text, so a datasource that opens a pool at import stays inert.
28
29
 
29
30
  ## Install
30
31
 
31
32
  ```bash
32
- bun add @venizia/ignis-boot
33
+ bun add -d @venizia/ignis-boot
33
34
  ```
34
35
 
35
- Already a transitive dependency of `@venizia/ignis`.
36
+ `ignis-artifacts` runs at build time; the generated file imports nothing from this package, so a
37
+ deployed application installs nothing extra for it at runtime.
36
38
 
37
39
  ## Use it
38
40
 
39
- Convention boot is opt-in: call `boot()` before `start()`.
41
+ Decorate the classes you want registered:
40
42
 
41
43
  ```typescript
42
- import { BaseApplication, IApplicationInfo } from '@venizia/ignis';
44
+ import { component, service } from '@venizia/ignis';
43
45
 
44
- class App extends BaseApplication {
45
- getAppInfo(): IApplicationInfo {
46
- return { name: 'my-app', version: '1.0.0', description: 'My app' };
47
- }
48
-
49
- staticConfigure() {}
50
- preConfigure() {}
51
- postConfigure() {}
52
- setupMiddlewares() {}
53
- }
46
+ @service()
47
+ export class PricingService extends BaseService {}
54
48
 
55
- const application = new App({
56
- scope: 'App',
57
- config: {
58
- host: '0.0.0.0',
59
- port: 3000,
60
- path: { base: '/api', isStrict: false },
61
- bootOptions: {}, // the defaults cover the conventional layout
62
- },
63
- });
64
-
65
- await application.boot(); // discover and bind every artifact
66
- await application.start();
49
+ @component()
50
+ export class MetricsComponent extends BaseComponent {}
67
51
  ```
68
52
 
69
- Given the layout below, `boot()` binds `datasources.PostgresDataSource`, `repositories.UserRepository`,
70
- `services.UserService`, and `controllers.UserController` - no further code.
53
+ Add the generator scripts and run one:
71
54
 
55
+ ```json
56
+ {
57
+ "scripts": {
58
+ "generate:artifacts": "ignis-artifacts generate --root src --out src/generated/artifacts.ts",
59
+ "check:artifacts": "ignis-artifacts check --root src --out src/generated/artifacts.ts"
60
+ }
61
+ }
72
62
  ```
73
- <projectRoot>/
74
- datasources/postgres.datasource.js
75
- repositories/user.repository.js
76
- services/user.service.js
77
- controllers/user.controller.js
63
+
64
+ ```bash
65
+ bun run generate:artifacts
78
66
  ```
79
67
 
80
- ## Discovery conventions
68
+ Pass the generated index to your application:
81
69
 
82
- Each booter has a default directory and a default file suffix, and binds into its own namespace.
70
+ ```typescript
71
+ import { GeneratedArtifacts } from './generated/artifacts';
83
72
 
84
- | Booter | Default dir | Default suffix | Binding key | Tag | Scope |
85
- | :--- | :--- | :--- | :--- | :--- | :--- |
86
- | `DatasourceBooter` | `datasources` | `.datasource.js` | `datasources.<ClassName>` | `datasources` | singleton |
87
- | `RepositoryBooter` | `repositories` | `.repository.js` | `repositories.<ClassName>` | `repositories` | transient |
88
- | `ServiceBooter` | `services` | `.service.js` | `services.<ClassName>` | `services` | transient |
89
- | `ControllerBooter` | `controllers` | `.controller.js` | `controllers.<ClassName>` | `controllers` | transient |
73
+ export const configs: IApplicationConfigs = {
74
+ path: { base: '/api', isStrict: true },
75
+ artifacts: GeneratedArtifacts,
76
+ };
77
+ ```
90
78
 
91
- Datasources are singletons because a connection pool must be shared; everything else resolves per use.
92
- Directories resolve relative to the application's `getProjectRoot()`, which defaults to `process.cwd()`.
93
- Subdirectories are included - `isNested` defaults to `true`.
79
+ Commit the generated file; never edit it by hand - the next `generate` overwrites it. Full
80
+ walkthrough: [Registering artifacts](https://ignis.venizia.ai/guides/core-concepts/application/bootstrapping).
94
81
 
95
- Booters are registered datasources -> repositories -> services -> controllers, so a repository can
96
- always resolve the datasource it injects.
82
+ ## CLI
97
83
 
98
- > [!IMPORTANT]
99
- > **The default suffixes end in `.js`, not `.ts`.** Discovery globs files on disk and `import`s them, and
100
- > it is designed to run against your **compiled output**. Build first, and have `getProjectRoot()` point
101
- > at the built directory - returning `__dirname` from the compiled entrypoint does exactly that. If
102
- > `boot()` reports zero artifacts, this is almost always why. To boot from TypeScript sources instead,
103
- > set the extensions explicitly: `{ controllers: { extensions: ['.controller.ts'] } }`.
84
+ Shipped as the `ignis-artifacts` binary. Requires `typescript >= 5` (peer dependency) and runs
85
+ under bun.
104
86
 
105
- ## Phases
87
+ ```
88
+ ignis-artifacts <generate|check> [--root src] [--out src/generated/artifacts.ts] [--ignore a,b] [--export GeneratedArtifacts]
89
+ ```
106
90
 
107
- `Bootstrapper.boot()` runs three phases across **all** booters - phase by phase, not booter by booter.
91
+ | Flag | Default | Meaning |
92
+ | :--- | :--- | :--- |
93
+ | `--root` | `src` | Directory to scan, recursively |
94
+ | `--out` | `src/generated/artifacts.ts` | Output path; import paths are relative to it |
95
+ | `--ignore` | `**/__tests__/**`, `**/*.test.ts`, `**/*.spec.ts`, `**/generated/**` | Comma-separated globs, merged with the default ignore list - never replaces it |
96
+ | `--export` | `GeneratedArtifacts` | Name of the exported constant |
108
97
 
109
- | Phase | What happens |
110
- | :--- | :--- |
111
- | `configure` | Fill in defaults for `dirs`, `extensions`, `isNested`, then build the glob pattern |
112
- | `discover` | Run the glob under the project root, collecting absolute file paths |
113
- | `load` | `import()` each file, keep the exported classes, bind them into the container |
98
+ | Command | Effect | Exit code |
99
+ | :--- | :--- | :--- |
100
+ | `generate` | Writes `--out` when its content changed | `0` |
101
+ | `check` | Renders in memory and compares with `--out`; fails a stale index | `0` fresh, `1` stale |
114
102
 
115
- `boot()` resolves to an `IBootReport`: the booter class names that ran, per-phase `durationMs`, and
116
- `totalDurationMs`. A throw in any phase is rewrapped naming both the phase and the booter, with the
117
- original error kept as `cause`.
103
+ Default ignore list: `**/__tests__/**`, `**/*.test.ts`, `**/*.spec.ts`, `**/generated/**`.
118
104
 
119
- ## Configuring discovery
105
+ ## Detection rules
120
106
 
121
- Pass `bootOptions` in the application config. Every artifact type takes the same `IArtifactOptions`.
107
+ A class is emitted when every rule holds. Every miss is logged with its reason.
122
108
 
123
- | Option | Type | Meaning |
124
- | :--- | :--- | :--- |
125
- | `dirs` | `string[]` | Directories to scan, relative to the project root |
126
- | `extensions` | `string[]` | File suffixes to match |
127
- | `isNested` | `boolean` | Include subdirectories - default `true` |
128
- | `glob` | `string` | Raw glob pattern; overrides the three above |
109
+ - Named export (`export class`), not `export default`, not module-private.
110
+ - Not `abstract`.
111
+ - Decorated with `component`, `controller`, `service`, `repository` or `datasource`, imported from
112
+ `@venizia/ignis` or `@venizia/ignis-kernel` (import aliases resolved) - or with
113
+ `injectable({ type })` where `type` is a string literal or `ArtifactTypes.<NAME>`.
129
114
 
130
- ```typescript
131
- bootOptions: {
132
- controllers: { dirs: ['controllers', 'api'], extensions: ['.controller.js'] },
133
- services: { glob: 'modules/**/*.service.js' },
134
- }
135
- ```
115
+ `model` classes are recognised and never emitted - a model is reached through its repository.
136
116
 
137
- A key that is present but `undefined` - the shape `dirs: process.env.APP_DIRS?.split(',')` produces - is
138
- treated as not provided and falls back to the default. An empty `dirs` or `extensions` array is not: it
139
- throws when the pattern is built.
117
+ ## Programmatic API
140
118
 
141
- ## Custom booters
119
+ `@venizia/ignis-boot/generator` exports the same machinery as functions, for a caller that is not
120
+ a shell script.
142
121
 
143
- Extend `BaseArtifactBooter` and implement its three hooks. The base class handles configure, discover,
144
- and load; you decide only where to look and what to bind.
122
+ | Export | What it is |
123
+ | :--- | :--- |
124
+ | `generateArtifactIndex(opts)` | Renders and writes `opts.out` when the content changed |
125
+ | `checkArtifactIndex(opts)` | Renders in memory and compares with `opts.out`, without writing |
126
+ | `IGenerateOptions` | `{ root, out, ignore?, exportName? }` - shared options for both |
127
+ | `ArtifactScanner.getInstance().scan({ root, ignore? })` | The scan step alone, as `IScannedArtifact[]` |
128
+ | `ArtifactIndexEmitter.render({ artifacts, outFile, exportName })` | The render step alone, as text |
129
+ | `ArtifactStereotypes`, `ArtifactTypes`, `ArtifactIndexFields` | The decorator-to-type map and the emitted field names |
145
130
 
146
131
  ```typescript
147
- import { BaseArtifactBooter, IApplication, IBootOptions } from '@venizia/ignis-boot';
148
- import { BindingKeys, inject } from '@venizia/ignis-inversion';
149
-
150
- export class ObserverBooter extends BaseArtifactBooter {
151
- constructor(
152
- @inject({ key: '@app/project_root' }) root: string,
153
- @inject({ key: '@app/instance' }) private readonly application: IApplication,
154
- @inject({ key: '@app/boot-options' }) bootOptions: IBootOptions,
155
- ) {
156
- super({ scope: ObserverBooter.name, root, artifactOptions: bootOptions.observers ?? {} });
157
- }
132
+ import { checkArtifactIndex } from '@venizia/ignis-boot/generator';
158
133
 
159
- protected override getDefaultDirs(): string[] {
160
- return ['observers'];
161
- }
134
+ const { isFresh } = checkArtifactIndex({ root: 'src', out: 'src/generated/artifacts.ts' });
135
+ ```
162
136
 
163
- protected override getDefaultExtensions(): string[] {
164
- return ['.observer.js'];
165
- }
137
+ ## `ignis-build-info` - stamp the build
138
+
139
+ A second binary in the same package. It resolves what a running service should be able to say
140
+ about itself - service, version, commit, branch, build time - at BUILD time, and writes it as a
141
+ static file the bundle bakes in. Nothing is read back at run time: a `bun build --compile` binary
142
+ ships no `node_modules`, no `.git` and no readable `package.json`, and a Distroless image has no
143
+ `git` to spawn, so a runtime resolver would report blanks in exactly the deployment that matters.
166
144
 
167
- protected override async bind(): Promise<void> {
168
- for (const cls of this.loadedClasses) {
169
- const key = BindingKeys.build({ namespace: 'observers', key: cls.name });
170
- this.application.bind({ key }).toClass(cls).setTags('observers');
171
- }
172
- }
173
- }
145
+ ```
146
+ ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]
174
147
  ```
175
148
 
176
- `IBootOptions` carries an index signature, so `bootOptions.observers` type-checks with no change to the
177
- framework. Booters are found by the `booter` tag, so registering is all that remains - and it must
178
- happen before `boot()` runs, which is earlier than `preConfigure()`:
149
+ | Flag | Default | Meaning |
150
+ | :--- | :--- | :--- |
151
+ | `--out` | `src/_build_info.ts` | Output path; always rewritten - `builtAt` changes every run |
152
+ | `--root` | `.` | Where `package.json` is read and where `git` is asked |
153
+ | `--format` | `ts` | `ts` - a static `export const`; `json` - the same record, for a Vite app or a Tauri shell |
154
+ | `--export` | `BUILD_INFO` | Name of the exported constant in `ts` format |
179
155
 
180
- ```typescript
181
- override async boot() {
182
- this.booter(ObserverBooter);
183
- return super.boot();
184
- }
185
- ```
156
+ Each field is read from the environment first, then `git`, then `package.json`; anything left reads
157
+ `unspecified`, so a pipeline that forgot a variable is visible rather than silent.
186
158
 
187
- Every constructor parameter must carry `@inject` - a container-instantiated class with one bare
188
- parameter is refused at boot.
159
+ | Field | Environment, first present wins | Fallback |
160
+ | :--- | :--- | :--- |
161
+ | `version` | `APP_ENV_BUILD_VERSION`, `APP_BUILD_VERSION`, `CI_COMMIT_TAG`, `GITHUB_REF_NAME` | `package.json#version` |
162
+ | `commit` | `APP_ENV_BUILD_COMMIT_TAG`, `APP_BUILD_COMMIT`, `CI_COMMIT_SHA`, `GITHUB_SHA`, `COMMIT_SHA` | `git rev-parse --short=12 HEAD` |
163
+ | `branch` | `APP_BUILD_BRANCH`, `CI_COMMIT_REF_NAME`, `GITHUB_REF_NAME`, `BRANCH_NAME` | `git rev-parse --abbrev-ref HEAD` |
164
+ | `builtAt` | `APP_ENV_BUILD_DATE`, `APP_BUILD_DATE` | the moment the generator ran |
165
+ | `service` | - | `package.json#name` |
189
166
 
190
- ## What you must know
167
+ Register the stamp once at the entrypoint, and `GET /health/stats` reports it:
191
168
 
192
- - **Every exported class in a matched file is bound**, not only the one whose name matches the file.
193
- Keep helper classes out of `*.controller.js` and friends, or move them to their own module.
194
- - **Discovery is filename-driven, not decorator-driven.** A correctly decorated controller in the wrong
195
- directory is invisible to it - register that one manually with `this.controller(...)`.
196
- - Calling `boot()` twice does not double-register: the bootstrapper resets its booter list on each run.
197
- - `reflect-metadata` must be imported once at your entrypoint, and `experimentalDecorators` plus
198
- `emitDecoratorMetadata` must be `true` **inline** in your `tsconfig.json` - Bun does not resolve them
199
- through `extends`, and `@inject` is silently dropped without them.
169
+ ```typescript
170
+ import { BUILD_INFO } from './_build_info';
171
+ import { BuildInfoRegistry } from '@venizia/ignis-helpers/core';
200
172
 
201
- ## Surface
173
+ BuildInfoRegistry.set({ buildInfo: BUILD_INFO });
174
+ ```
202
175
 
203
- | Export | What it is |
204
- | :--- | :--- |
205
- | `BaseArtifactBooter` | Abstract base implementing the three phases; extend it for custom artifacts |
206
- | `Bootstrapper` | Runs the phases across every `booter`-tagged binding and returns the report |
207
- | `BootMixin` | Adds `boot()`, `bootOptions`, and the four built-in booters to a raw `Container` |
208
- | `ControllerBooter` / `ServiceBooter` / `RepositoryBooter` / `DatasourceBooter` | The built-in booters |
209
- | `discoverFiles` / `loadClasses` | The glob and dynamic-import primitives, usable standalone |
210
- | `BootPhases` | `configure`, `discover`, `load` |
211
- | `IBootOptions` / `IArtifactOptions` / `IBootReport` / `IBooter` | Public types |
176
+ `git` runs through Bun Shell, so the binary needs bun (it carries a `bun` shebang). Under plain
177
+ Node the `git` fields degrade to `unspecified` and the build still succeeds; set the variables
178
+ above if a Node invocation has to be exact.
179
+
180
+ Programmatic: `@venizia/ignis-boot/build-info` exports `generateBuildInfo(opts)`,
181
+ `BuildInfoResolver.getInstance().resolve({ root })`, `BuildInfoEmitter.render({ buildInfo, format, exportName })`,
182
+ `BuildInfoFormats` and `BuildInfoEnvironmentKeys`.
212
183
 
213
- `BootMixin` is for applications not built on `BaseApplication` - it wires the same four booters onto any
214
- `Container`. `BaseApplication` does its own registration and does not use the mixin.
184
+ ## What you must know
215
185
 
216
- Full detail: [Bootstrapping reference](https://ignis.venizia.ai/references/base/bootstrapping).
186
+ - **Output is deterministic.** Imports sorted by path, class names sorted within each field, one
187
+ field per kind, empty arrays kept. A field wider than 100 columns wraps one name per line, so the
188
+ file passes the repo's `prettier -l` unchanged.
189
+ - **The scanner never executes a module.** No decorator runs and no import side effect fires while
190
+ scanning, so a stereotype re-exported through a local wrapper module is not recognised - the
191
+ import must name an IGNIS module directly.
192
+ - **`check` belongs where lint runs**, not only in CI - a stale index should fail locally before a
193
+ push reaches the pipeline.
194
+
195
+ Full detail: [Artifact registration reference](https://ignis.venizia.ai/references/base/bootstrapping).
217
196
 
218
197
  ## Links
219
198
 
@@ -223,8 +202,5 @@ Full detail: [Bootstrapping reference](https://ignis.venizia.ai/references/base/
223
202
  [Best practices](https://ignis.venizia.ai/best-practices/) &#8226;
224
203
  [Changelog](https://ignis.venizia.ai/changelogs/)
225
204
 
226
- Inspired by [LoopBack 4's boot system](https://loopback.io/doc/en/lb4/Booting-an-Application.html).
227
-
228
205
  MIT licensed - see [LICENSE.md](LICENSE.md).
229
206
  Questions: [GitHub Issues](https://github.com/VENIZIA-AI/ignis/issues) &#8226; developer@venizia.ai
230
- </content>
@@ -0,0 +1,20 @@
1
+ import type { TConstValue } from '@venizia/ignis-helpers';
2
+ export declare class BuildInfoFormats {
3
+ static readonly TS = "ts";
4
+ static readonly JSON = "json";
5
+ static readonly SCHEME_SET: Set<string>;
6
+ static isValid(value: string): boolean;
7
+ }
8
+ export type TBuildInfoFormat = TConstValue<typeof BuildInfoFormats>;
9
+ /**
10
+ * Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
11
+ * organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
12
+ * anything provider-specific. The first key carrying a non-blank value wins.
13
+ */
14
+ export declare class BuildInfoEnvironmentKeys {
15
+ static readonly VERSION: readonly string[];
16
+ static readonly COMMIT: readonly string[];
17
+ static readonly BRANCH: readonly string[];
18
+ static readonly BUILT_AT: readonly string[];
19
+ }
20
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAyC;IAEnE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,qBAAa,wBAAwB;IACnC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAKxC;IAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAMvC;IAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAKvC;IAEF,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAA4C;CACxF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildInfoEnvironmentKeys = exports.BuildInfoFormats = void 0;
4
+ class BuildInfoFormats {
5
+ static { this.TS = 'ts'; }
6
+ static { this.JSON = 'json'; }
7
+ static { this.SCHEME_SET = new Set([this.TS, this.JSON]); }
8
+ static isValid(value) {
9
+ return this.SCHEME_SET.has(value);
10
+ }
11
+ }
12
+ exports.BuildInfoFormats = BuildInfoFormats;
13
+ /**
14
+ * Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
15
+ * organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
16
+ * anything provider-specific. The first key carrying a non-blank value wins.
17
+ */
18
+ class BuildInfoEnvironmentKeys {
19
+ static { this.VERSION = [
20
+ 'APP_ENV_BUILD_VERSION',
21
+ 'APP_BUILD_VERSION',
22
+ 'CI_COMMIT_TAG',
23
+ 'GITHUB_REF_NAME',
24
+ ]; }
25
+ static { this.COMMIT = [
26
+ 'APP_ENV_BUILD_COMMIT_TAG',
27
+ 'APP_BUILD_COMMIT',
28
+ 'CI_COMMIT_SHA',
29
+ 'GITHUB_SHA',
30
+ 'COMMIT_SHA',
31
+ ]; }
32
+ static { this.BRANCH = [
33
+ 'APP_BUILD_BRANCH',
34
+ 'CI_COMMIT_REF_NAME',
35
+ 'GITHUB_REF_NAME',
36
+ 'BRANCH_NAME',
37
+ ]; }
38
+ static { this.BUILT_AT = ['APP_ENV_BUILD_DATE', 'APP_BUILD_DATE']; }
39
+ }
40
+ exports.BuildInfoEnvironmentKeys = BuildInfoEnvironmentKeys;
41
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;aACX,OAAE,GAAG,IAAI,CAAC;aACV,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,4CASC;AAID;;;;GAIG;AACH,MAAa,wBAAwB;aACnB,YAAO,GAAsB;QAC3C,uBAAuB;QACvB,mBAAmB;QACnB,eAAe;QACf,iBAAiB;KAClB,CAAC;aAEc,WAAM,GAAsB;QAC1C,0BAA0B;QAC1B,kBAAkB;QAClB,eAAe;QACf,YAAY;QACZ,YAAY;KACb,CAAC;aAEc,WAAM,GAAsB;QAC1C,kBAAkB;QAClB,oBAAoB;QACpB,iBAAiB;QACjB,aAAa;KACd,CAAC;aAEc,aAAQ,GAAsB,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;;AAvBzF,4DAwBC"}
@@ -1,3 +1,3 @@
1
- export * from './types';
2
1
  export * from './constants';
2
+ export * from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./constants"), exports);
18
+ __exportStar(require("./types"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB"}
@@ -0,0 +1,16 @@
1
+ import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';
2
+ import type { TBuildInfoFormat } from './constants';
3
+ export interface IBuildInfoOptions {
4
+ out: string;
5
+ /** Where `package.json` is read from and where `git` is asked; default the cwd. */
6
+ root?: string;
7
+ format?: TBuildInfoFormat;
8
+ /** Name of the exported constant in `ts` format; default `BUILD_INFO`. */
9
+ exportName?: string;
10
+ }
11
+ export interface IBuildInfoResult {
12
+ buildInfo: TBuildInfoRecord;
13
+ content: string;
14
+ out: string;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/build-info/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';
2
+ import { type TBuildInfoFormat } from './common';
3
+ /** Renders the stamp: a static `ts` const a bundler bakes in, or the same record as `json` for a Vite app or a Tauri shell. */
4
+ export declare class BuildInfoEmitter {
5
+ static readonly DEFAULT_EXPORT_NAME = "BUILD_INFO";
6
+ static render(opts: {
7
+ buildInfo: TBuildInfoRecord;
8
+ format: TBuildInfoFormat;
9
+ exportName: string;
10
+ }): string;
11
+ }
12
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/build-info/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnE,+HAA+H;AAC/H,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,mBAAmB,gBAAgB;IAEnD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,MAAM,EAAE,gBAAgB,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,MAAM;CAmBX"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildInfoEmitter = void 0;
4
+ const common_1 = require("./common");
5
+ /** Renders the stamp: a static `ts` const a bundler bakes in, or the same record as `json` for a Vite app or a Tauri shell. */
6
+ class BuildInfoEmitter {
7
+ static { this.DEFAULT_EXPORT_NAME = 'BUILD_INFO'; }
8
+ static render(opts) {
9
+ const { buildInfo, format, exportName } = opts;
10
+ if (format === common_1.BuildInfoFormats.JSON) {
11
+ return `${JSON.stringify(buildInfo, null, 2)}\n`;
12
+ }
13
+ const fields = Object.entries(buildInfo)
14
+ .map(([key, value]) => ` ${key}: ${JSON.stringify(value)},`)
15
+ .join('\n');
16
+ return [
17
+ '// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-build-info generate',
18
+ `export const ${exportName} = {`,
19
+ fields,
20
+ '} as const;',
21
+ '',
22
+ ].join('\n');
23
+ }
24
+ }
25
+ exports.BuildInfoEmitter = BuildInfoEmitter;
26
+ //# sourceMappingURL=emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/build-info/emitter.ts"],"names":[],"mappings":";;;AACA,qCAAmE;AAEnE,+HAA+H;AAC/H,MAAa,gBAAgB;aACX,wBAAmB,GAAG,YAAY,CAAC;IAEnD,MAAM,CAAC,MAAM,CAAC,IAIb;QACC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAE/C,IAAI,MAAM,KAAK,yBAAgB,CAAC,IAAI,EAAE,CAAC;YACrC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;aAC5D,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO;YACL,+FAA+F;YAC/F,gBAAgB,UAAU,MAAM;YAChC,MAAM;YACN,aAAa;YACb,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;;AAzBH,4CA0BC"}
@@ -0,0 +1,10 @@
1
+ import { type IBuildInfoOptions, type IBuildInfoResult } from './common';
2
+ /**
3
+ * Writes the stamp. Unlike the artifact index this ALWAYS writes: `builtAt` changes every run, so
4
+ * an unchanged-content short-circuit would be dead code that hides a stale timestamp.
5
+ */
6
+ export declare const generateBuildInfo: (opts: IBuildInfoOptions) => Promise<IBuildInfoResult>;
7
+ export * from './common';
8
+ export * from './emitter';
9
+ export * from './resolver';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI3F;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAU,MAAM,iBAAiB,KAAG,OAAO,CAAC,gBAAgB,CAazF,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,43 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.generateBuildInfo = void 0;
18
+ const node_fs_1 = require("node:fs");
19
+ const node_path_1 = require("node:path");
20
+ const common_1 = require("./common");
21
+ const emitter_1 = require("./emitter");
22
+ const resolver_1 = require("./resolver");
23
+ /**
24
+ * Writes the stamp. Unlike the artifact index this ALWAYS writes: `builtAt` changes every run, so
25
+ * an unchanged-content short-circuit would be dead code that hides a stale timestamp.
26
+ */
27
+ const generateBuildInfo = async (opts) => {
28
+ const buildInfo = await resolver_1.BuildInfoResolver.getInstance().resolve({ root: opts.root });
29
+ const content = emitter_1.BuildInfoEmitter.render({
30
+ buildInfo,
31
+ format: opts.format ?? common_1.BuildInfoFormats.TS,
32
+ exportName: opts.exportName ?? emitter_1.BuildInfoEmitter.DEFAULT_EXPORT_NAME,
33
+ });
34
+ const out = (0, node_path_1.resolve)(opts.out);
35
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(out), { recursive: true });
36
+ (0, node_fs_1.writeFileSync)(out, content);
37
+ return { buildInfo, content, out };
38
+ };
39
+ exports.generateBuildInfo = generateBuildInfo;
40
+ __exportStar(require("./common"), exports);
41
+ __exportStar(require("./emitter"), exports);
42
+ __exportStar(require("./resolver"), exports);
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAmD;AACnD,yCAA6C;AAC7C,qCAA2F;AAC3F,uCAA6C;AAC7C,yCAA+C;AAE/C;;;GAGG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAuB,EAA6B,EAAE;IAC5F,MAAM,SAAS,GAAG,MAAM,4BAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACrF,MAAM,OAAO,GAAG,0BAAgB,CAAC,MAAM,CAAC;QACtC,SAAS;QACT,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,yBAAgB,CAAC,EAAE;QAC1C,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,0BAAgB,CAAC,mBAAmB;KACpE,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAA,mBAAS,EAAC,IAAA,mBAAO,EAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,IAAA,uBAAa,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AACrC,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B;AAEF,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B"}
@@ -0,0 +1,25 @@
1
+ import { BaseHelper } from '@venizia/ignis-helpers';
2
+ import { type TBuildInfoRecord } from '@venizia/ignis-helpers/core';
3
+ /**
4
+ * Resolves the stamp: environment first (CI knows the release tag), then `git`, then the
5
+ * manifest. Every miss is logged with its reason and degrades one field to
6
+ * {@link BuildInfoRegistry.UNSPECIFIED} - a Distroless image has no `git` and an exported tarball
7
+ * has no manifest, and a build must not die over a stamp.
8
+ */
9
+ export declare class BuildInfoResolver extends BaseHelper {
10
+ private static instance?;
11
+ private constructor();
12
+ static getInstance(): BuildInfoResolver;
13
+ resolve(opts?: {
14
+ root?: string;
15
+ }): Promise<TBuildInfoRecord>;
16
+ private resolveEnvironmentValue;
17
+ /**
18
+ * `nothrow()` covers a nonzero exit; the `catch` covers `git` being absent and also `Bun` being
19
+ * absent - under plain Node the `ReferenceError` degrades the field instead of killing the build.
20
+ */
21
+ private resolveGitValue;
22
+ /** `JSON.parse` promises nothing about the shape, so a manifest holding `{ "name": 42 }` must not become a numeric `service`. */
23
+ private resolveManifest;
24
+ }
25
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/build-info/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAQvF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAoB;IAE5C,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,iBAAiB;IAIjC,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkClE,OAAO,CAAC,uBAAuB;IAW/B;;;OAGG;YACW,eAAe;IA4B7B,iIAAiI;IACjI,OAAO,CAAC,eAAe;CAyBxB"}