@venizia/ignis-boot 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/dist/cjs/build-info/common/constants.d.ts +0 -8
- package/dist/cjs/build-info/common/constants.d.ts.map +1 -1
- package/dist/cjs/build-info/common/constants.js +1 -10
- package/dist/cjs/build-info/common/constants.js.map +1 -1
- package/dist/cjs/build-info/common/index.d.ts +0 -1
- package/dist/cjs/build-info/common/index.d.ts.map +1 -1
- package/dist/cjs/build-info/common/index.js +0 -1
- package/dist/cjs/build-info/common/index.js.map +1 -1
- package/dist/cjs/build-info/index.d.ts +1 -7
- package/dist/cjs/build-info/index.d.ts.map +1 -1
- package/dist/cjs/build-info/index.js +1 -24
- package/dist/cjs/build-info/index.js.map +1 -1
- package/dist/cjs/build-info/stamp.d.ts +22 -0
- package/dist/cjs/build-info/stamp.d.ts.map +1 -0
- package/dist/cjs/build-info/stamp.js +36 -0
- package/dist/cjs/build-info/stamp.js.map +1 -0
- package/dist/esm/build-info/common/constants.d.ts +0 -8
- package/dist/esm/build-info/common/constants.d.ts.map +1 -1
- package/dist/esm/build-info/common/constants.js +0 -8
- package/dist/esm/build-info/common/constants.js.map +1 -1
- package/dist/esm/build-info/common/index.d.ts +0 -1
- package/dist/esm/build-info/common/index.d.ts.map +1 -1
- package/dist/esm/build-info/common/index.js +0 -1
- package/dist/esm/build-info/common/index.js.map +1 -1
- package/dist/esm/build-info/index.d.ts +1 -7
- package/dist/esm/build-info/index.d.ts.map +1 -1
- package/dist/esm/build-info/index.js +1 -22
- package/dist/esm/build-info/index.js.map +1 -1
- package/dist/esm/build-info/stamp.d.ts +22 -0
- package/dist/esm/build-info/stamp.d.ts.map +1 -0
- package/dist/esm/build-info/stamp.js +32 -0
- package/dist/esm/build-info/stamp.js.map +1 -0
- package/package.json +5 -6
- package/dist/cjs/build-info/common/types.d.ts +0 -16
- package/dist/cjs/build-info/common/types.d.ts.map +0 -1
- package/dist/cjs/build-info/common/types.js +0 -3
- package/dist/cjs/build-info/common/types.js.map +0 -1
- package/dist/cjs/build-info/emitter.d.ts +0 -12
- package/dist/cjs/build-info/emitter.d.ts.map +0 -1
- package/dist/cjs/build-info/emitter.js +0 -26
- package/dist/cjs/build-info/emitter.js.map +0 -1
- package/dist/cjs/clis/build-info.d.ts +0 -3
- package/dist/cjs/clis/build-info.d.ts.map +0 -1
- package/dist/cjs/clis/build-info.js +0 -48
- package/dist/cjs/clis/build-info.js.map +0 -1
- package/dist/esm/build-info/common/types.d.ts +0 -16
- package/dist/esm/build-info/common/types.d.ts.map +0 -1
- package/dist/esm/build-info/common/types.js +0 -2
- package/dist/esm/build-info/common/types.js.map +0 -1
- package/dist/esm/build-info/emitter.d.ts +0 -12
- package/dist/esm/build-info/emitter.d.ts.map +0 -1
- package/dist/esm/build-info/emitter.js +0 -22
- package/dist/esm/build-info/emitter.js.map +0 -1
- package/dist/esm/clis/build-info.d.ts +0 -3
- package/dist/esm/clis/build-info.d.ts.map +0 -1
- package/dist/esm/clis/build-info.js +0 -46
- package/dist/esm/clis/build-info.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @venizia/ignis-boot
|
|
2
2
|
|
|
3
|
-
Build-time tools for an IGNIS application: `ignis-artifacts` writes one static file that registers your decorated classes, and `
|
|
3
|
+
Build-time tools for an IGNIS application: `ignis-artifacts` writes one static file that registers your decorated classes, and `BuildInfoStamp` stamps the build. Install it as a devDependency of the application, or as a dependency if production runs the source unbundled.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -101,22 +101,32 @@ A class lands in the index when all of these hold. The scanner logs a warning fo
|
|
|
101
101
|
|
|
102
102
|
The output is deterministic: imports sorted by path, names sorted within each field, empty fields kept, a field wider than 100 columns wrapped one name per line.
|
|
103
103
|
|
|
104
|
-
##
|
|
104
|
+
## The build stamp
|
|
105
105
|
|
|
106
|
-
A
|
|
106
|
+
A running service cannot say which commit it is. `BuildInfoStamp` (from `@venizia/ignis-boot/build-info`) bakes the commit, branch and build time into a compiled binary, and resolves them from git when you run from source. Nothing is generated, so a clean checkout typechecks, tests and boots.
|
|
107
107
|
|
|
108
|
+
```typescript
|
|
109
|
+
// scripts/compile.ts
|
|
110
|
+
import { BunCompiler } from '@venizia/dev-configs/compilers';
|
|
111
|
+
import { BuildInfoStamp } from '@venizia/ignis-boot/build-info';
|
|
112
|
+
|
|
113
|
+
await BunCompiler.compile({
|
|
114
|
+
entrypoint: './src/index.ts',
|
|
115
|
+
outfile: './dist/service',
|
|
116
|
+
define: await BuildInfoStamp.define(),
|
|
117
|
+
});
|
|
108
118
|
```
|
|
109
|
-
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// src/index.ts
|
|
122
|
+
import { BuildInfoStamp } from '@venizia/ignis-boot/build-info';
|
|
123
|
+
|
|
124
|
+
await BuildInfoStamp.register();
|
|
110
125
|
```
|
|
111
126
|
|
|
112
|
-
|
|
113
|
-
|---|---|---|
|
|
114
|
-
| `--out` | `src/_build_info.ts` | Output file; rewritten on every run |
|
|
115
|
-
| `--root` | `.` | Where `package.json` is read and `git` runs |
|
|
116
|
-
| `--format` | `ts` | `ts` writes an `export const`; `json` writes the same record as JSON |
|
|
117
|
-
| `--export` | `BUILD_INFO` | Name of the exported constant in `ts` format |
|
|
127
|
+
`register()` uses the baked stamp when the compile defined it, else `BuildInfoResolver`, then calls `BuildInfoRegistry.set`. It sets `commit`, `branch` and `builtAt`; `service` and `version` stay with `getAppInfo()`. The health-check component's `/stats` route reports it.
|
|
118
128
|
|
|
119
|
-
|
|
129
|
+
The resolver reads each field from the environment first (first non-blank key wins), then its fallback. A field nothing resolves reads `unspecified`.
|
|
120
130
|
|
|
121
131
|
| Field | Environment keys, in order | Fallback |
|
|
122
132
|
|---|---|---|
|
|
@@ -124,16 +134,7 @@ Each field reads the environment first (first non-blank key wins), then its fall
|
|
|
124
134
|
| `version` | `APP_ENV_BUILD_VERSION`, `APP_BUILD_VERSION`, `CI_COMMIT_TAG`, `GITHUB_REF_NAME` | `package.json` `version` |
|
|
125
135
|
| `commit` | `APP_ENV_BUILD_COMMIT_TAG`, `APP_BUILD_COMMIT`, `CI_COMMIT_SHA`, `GITHUB_SHA`, `COMMIT_SHA` | `git rev-parse --short=12 HEAD` |
|
|
126
136
|
| `branch` | `APP_BUILD_BRANCH`, `CI_COMMIT_REF_NAME`, `GITHUB_REF_NAME`, `BRANCH_NAME` | `git rev-parse --abbrev-ref HEAD` |
|
|
127
|
-
| `builtAt` | `APP_ENV_BUILD_DATE`, `APP_BUILD_DATE` | the time the
|
|
128
|
-
|
|
129
|
-
Register the stamp once at the entry point. The health-check component's `/stats` route reports it:
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
import { BuildInfoRegistry } from '@venizia/ignis-helpers/core';
|
|
133
|
-
import { BUILD_INFO } from './_build_info';
|
|
134
|
-
|
|
135
|
-
BuildInfoRegistry.set({ buildInfo: BUILD_INFO });
|
|
136
|
-
```
|
|
137
|
+
| `builtAt` | `APP_ENV_BUILD_DATE`, `APP_BUILD_DATE` | the time the stamp was resolved |
|
|
137
138
|
|
|
138
139
|
## Entry points
|
|
139
140
|
|
|
@@ -141,12 +142,11 @@ BuildInfoRegistry.set({ buildInfo: BUILD_INFO });
|
|
|
141
142
|
|---|---|---|
|
|
142
143
|
| `@venizia/ignis-boot` | Everything from the two subpaths below | `typescript` |
|
|
143
144
|
| `@venizia/ignis-boot/generator` | `generateArtifactIndex`, `checkArtifactIndex`, `ArtifactScanner`, `ArtifactIndexEmitter`, `ArtifactStereotypes`, `ArtifactTypes`, `ArtifactIndexFields` | `typescript` |
|
|
144
|
-
| `@venizia/ignis-boot/build-info` | `
|
|
145
|
+
| `@venizia/ignis-boot/build-info` | `BuildInfoStamp`, `BuildInfoResolver`, `BuildInfoEnvironmentKeys` | none |
|
|
145
146
|
|
|
146
147
|
| Binary | File |
|
|
147
148
|
|---|---|
|
|
148
149
|
| `ignis-artifacts` | `dist/cjs/clis/artifacts.js` |
|
|
149
|
-
| `ignis-build-info` | `dist/cjs/clis/build-info.js` |
|
|
150
150
|
|
|
151
151
|
The package ships CommonJS and ESM builds. The programmatic API mirrors the CLI:
|
|
152
152
|
|
|
@@ -1,11 +1,3 @@
|
|
|
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
1
|
/**
|
|
10
2
|
* Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
|
|
11
3
|
* organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA;;;;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"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildInfoEnvironmentKeys =
|
|
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;
|
|
3
|
+
exports.BuildInfoEnvironmentKeys = void 0;
|
|
13
4
|
/**
|
|
14
5
|
* Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
|
|
15
6
|
* organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":";;;AAAA;;;;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","sourcesContent":["/**\n * Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this\n * organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before\n * anything provider-specific. The first key carrying a non-blank value wins.\n */\nexport class BuildInfoEnvironmentKeys {\n static readonly VERSION: readonly string[] = [\n 'APP_ENV_BUILD_VERSION',\n 'APP_BUILD_VERSION',\n 'CI_COMMIT_TAG',\n 'GITHUB_REF_NAME',\n ];\n\n static readonly COMMIT: readonly string[] = [\n 'APP_ENV_BUILD_COMMIT_TAG',\n 'APP_BUILD_COMMIT',\n 'CI_COMMIT_SHA',\n 'GITHUB_SHA',\n 'COMMIT_SHA',\n ];\n\n static readonly BRANCH: readonly string[] = [\n 'APP_BUILD_BRANCH',\n 'CI_COMMIT_REF_NAME',\n 'GITHUB_REF_NAME',\n 'BRANCH_NAME',\n ];\n\n static readonly BUILT_AT: readonly string[] = ['APP_ENV_BUILD_DATE', 'APP_BUILD_DATE'];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./constants"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B","sourcesContent":["export * from './constants';\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
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
1
|
export * from './common';
|
|
8
|
-
export * from './emitter';
|
|
9
2
|
export * from './resolver';
|
|
3
|
+
export * from './stamp';
|
|
10
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -14,30 +14,7 @@ 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
|
-
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
17
|
__exportStar(require("./common"), exports);
|
|
41
|
-
__exportStar(require("./emitter"), exports);
|
|
42
18
|
__exportStar(require("./resolver"), exports);
|
|
19
|
+
__exportStar(require("./stamp"), exports);
|
|
43
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './common';\nexport * from './resolver';\nexport * from './stamp';\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from
|
|
3
|
+
* source resolves it from git when the application starts.
|
|
4
|
+
*
|
|
5
|
+
* `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the
|
|
6
|
+
* stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BuildInfoStamp {
|
|
9
|
+
/** The identifier `define()` replaces in the bundle and `register()` reads. */
|
|
10
|
+
static readonly GLOBAL_NAME = "IGNIS_BUILD_INFO";
|
|
11
|
+
/** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */
|
|
12
|
+
static define(opts?: {
|
|
13
|
+
root?: string;
|
|
14
|
+
}): Promise<Record<string, string>>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,
|
|
17
|
+
* else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`
|
|
18
|
+
* stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.
|
|
19
|
+
*/
|
|
20
|
+
static register(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp.d.ts","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,+EAA+E;IAC/E,MAAM,CAAC,QAAQ,CAAC,WAAW,sBAAsB;IAEjD,yHAAyH;WAC5G,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAK9E;;;;OAIG;WACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAUvC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildInfoStamp = void 0;
|
|
4
|
+
const core_1 = require("@venizia/ignis-helpers/core");
|
|
5
|
+
const resolver_1 = require("./resolver");
|
|
6
|
+
/**
|
|
7
|
+
* The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from
|
|
8
|
+
* source resolves it from git when the application starts.
|
|
9
|
+
*
|
|
10
|
+
* `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the
|
|
11
|
+
* stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.
|
|
12
|
+
*/
|
|
13
|
+
class BuildInfoStamp {
|
|
14
|
+
/** The identifier `define()` replaces in the bundle and `register()` reads. */
|
|
15
|
+
static { this.GLOBAL_NAME = 'IGNIS_BUILD_INFO'; }
|
|
16
|
+
/** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */
|
|
17
|
+
static async define(opts) {
|
|
18
|
+
const stamp = await resolver_1.BuildInfoResolver.getInstance().resolve(opts);
|
|
19
|
+
return { [BuildInfoStamp.GLOBAL_NAME]: JSON.stringify(stamp) };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,
|
|
23
|
+
* else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`
|
|
24
|
+
* stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.
|
|
25
|
+
*/
|
|
26
|
+
static async register() {
|
|
27
|
+
const stamp = typeof IGNIS_BUILD_INFO !== 'undefined'
|
|
28
|
+
? IGNIS_BUILD_INFO
|
|
29
|
+
: await resolver_1.BuildInfoResolver.getInstance().resolve();
|
|
30
|
+
core_1.BuildInfoRegistry.set({
|
|
31
|
+
buildInfo: { commit: stamp.commit, branch: stamp.branch, builtAt: stamp.builtAt },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.BuildInfoStamp = BuildInfoStamp;
|
|
36
|
+
//# sourceMappingURL=stamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp.js","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":";;;AAAA,sDAAuF;AACvF,yCAA+C;AAM/C;;;;;;GAMG;AACH,MAAa,cAAc;IACzB,+EAA+E;aAC/D,gBAAW,GAAG,kBAAkB,CAAC;IAEjD,yHAAyH;IACzH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAwB;QAC1C,MAAM,KAAK,GAAG,MAAM,4BAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,OAAO,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ;QACnB,MAAM,KAAK,GACT,OAAO,gBAAgB,KAAK,WAAW;YACrC,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,MAAM,4BAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC;QAEtD,wBAAiB,CAAC,GAAG,CAAC;YACpB,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;SAClF,CAAC,CAAC;IACL,CAAC;;AAxBH,wCAyBC","sourcesContent":["import { BuildInfoRegistry, type TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { BuildInfoResolver } from './resolver';\n\n// A compile bakes the stamp in under this name (`define`); a run from source has no such name.\n// The identifier below must spell the same as `BuildInfoStamp.GLOBAL_NAME`.\ndeclare const IGNIS_BUILD_INFO: TBuildInfoRecord | undefined;\n\n/**\n * The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from\n * source resolves it from git when the application starts.\n *\n * `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the\n * stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.\n */\nexport class BuildInfoStamp {\n /** The identifier `define()` replaces in the bundle and `register()` reads. */\n static readonly GLOBAL_NAME = 'IGNIS_BUILD_INFO';\n\n /** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */\n static async define(opts?: { root?: string }): Promise<Record<string, string>> {\n const stamp = await BuildInfoResolver.getInstance().resolve(opts);\n return { [BuildInfoStamp.GLOBAL_NAME]: JSON.stringify(stamp) };\n }\n\n /**\n * Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,\n * else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`\n * stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.\n */\n static async register(): Promise<void> {\n const stamp =\n typeof IGNIS_BUILD_INFO !== 'undefined'\n ? IGNIS_BUILD_INFO\n : await BuildInfoResolver.getInstance().resolve();\n\n BuildInfoRegistry.set({\n buildInfo: { commit: stamp.commit, branch: stamp.branch, builtAt: stamp.builtAt },\n });\n }\n}\n"]}
|
|
@@ -1,11 +1,3 @@
|
|
|
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
1
|
/**
|
|
10
2
|
* Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
|
|
11
3
|
* organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA;;;;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"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export class BuildInfoFormats {
|
|
2
|
-
static { this.TS = 'ts'; }
|
|
3
|
-
static { this.JSON = 'json'; }
|
|
4
|
-
static { this.SCHEME_SET = new Set([this.TS, this.JSON]); }
|
|
5
|
-
static isValid(value) {
|
|
6
|
-
return this.SCHEME_SET.has(value);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
1
|
/**
|
|
10
2
|
* Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this
|
|
11
3
|
* organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,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","sourcesContent":["/**\n * Each field is spelled differently by every CI provider, and `APP_ENV_*` is what this\n * organisation's pipelines export - so it is read before the generic `APP_BUILD_*` pair and before\n * anything provider-specific. The first key carrying a non-blank value wins.\n */\nexport class BuildInfoEnvironmentKeys {\n static readonly VERSION: readonly string[] = [\n 'APP_ENV_BUILD_VERSION',\n 'APP_BUILD_VERSION',\n 'CI_COMMIT_TAG',\n 'GITHUB_REF_NAME',\n ];\n\n static readonly COMMIT: readonly string[] = [\n 'APP_ENV_BUILD_COMMIT_TAG',\n 'APP_BUILD_COMMIT',\n 'CI_COMMIT_SHA',\n 'GITHUB_SHA',\n 'COMMIT_SHA',\n ];\n\n static readonly BRANCH: readonly string[] = [\n 'APP_BUILD_BRANCH',\n 'CI_COMMIT_REF_NAME',\n 'GITHUB_REF_NAME',\n 'BRANCH_NAME',\n ];\n\n static readonly BUILT_AT: readonly string[] = ['APP_ENV_BUILD_DATE', 'APP_BUILD_DATE'];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC","sourcesContent":["export * from './constants';\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { type IBuildInfoOptions, type IBuildInfoResult } from './common/index.js';
|
|
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
1
|
export * from './common/index.js';
|
|
8
|
-
export * from './emitter.js';
|
|
9
2
|
export * from './resolver.js';
|
|
3
|
+
export * from './stamp.js';
|
|
10
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { BuildInfoFormats } from './common/index.js';
|
|
4
|
-
import { BuildInfoEmitter } from './emitter.js';
|
|
5
|
-
import { BuildInfoResolver } from './resolver.js';
|
|
6
|
-
/**
|
|
7
|
-
* Writes the stamp. Unlike the artifact index this ALWAYS writes: `builtAt` changes every run, so
|
|
8
|
-
* an unchanged-content short-circuit would be dead code that hides a stale timestamp.
|
|
9
|
-
*/
|
|
10
|
-
export const generateBuildInfo = async (opts) => {
|
|
11
|
-
const buildInfo = await BuildInfoResolver.getInstance().resolve({ root: opts.root });
|
|
12
|
-
const content = BuildInfoEmitter.render({
|
|
13
|
-
buildInfo,
|
|
14
|
-
format: opts.format ?? BuildInfoFormats.TS,
|
|
15
|
-
exportName: opts.exportName ?? BuildInfoEmitter.DEFAULT_EXPORT_NAME,
|
|
16
|
-
});
|
|
17
|
-
const out = resolve(opts.out);
|
|
18
|
-
mkdirSync(dirname(out), { recursive: true });
|
|
19
|
-
writeFileSync(out, content);
|
|
20
|
-
return { buildInfo, content, out };
|
|
21
|
-
};
|
|
22
1
|
export * from './common/index.js';
|
|
23
|
-
export * from './emitter.js';
|
|
24
2
|
export * from './resolver.js';
|
|
3
|
+
export * from './stamp.js';
|
|
25
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './common';\nexport * from './resolver';\nexport * from './stamp';\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from
|
|
3
|
+
* source resolves it from git when the application starts.
|
|
4
|
+
*
|
|
5
|
+
* `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the
|
|
6
|
+
* stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BuildInfoStamp {
|
|
9
|
+
/** The identifier `define()` replaces in the bundle and `register()` reads. */
|
|
10
|
+
static readonly GLOBAL_NAME = "IGNIS_BUILD_INFO";
|
|
11
|
+
/** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */
|
|
12
|
+
static define(opts?: {
|
|
13
|
+
root?: string;
|
|
14
|
+
}): Promise<Record<string, string>>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,
|
|
17
|
+
* else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`
|
|
18
|
+
* stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.
|
|
19
|
+
*/
|
|
20
|
+
static register(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp.d.ts","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,+EAA+E;IAC/E,MAAM,CAAC,QAAQ,CAAC,WAAW,sBAAsB;IAEjD,yHAAyH;WAC5G,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAK9E;;;;OAIG;WACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAUvC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BuildInfoRegistry } from '@venizia/ignis-helpers/core';
|
|
2
|
+
import { BuildInfoResolver } from './resolver.js';
|
|
3
|
+
/**
|
|
4
|
+
* The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from
|
|
5
|
+
* source resolves it from git when the application starts.
|
|
6
|
+
*
|
|
7
|
+
* `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the
|
|
8
|
+
* stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.
|
|
9
|
+
*/
|
|
10
|
+
export class BuildInfoStamp {
|
|
11
|
+
/** The identifier `define()` replaces in the bundle and `register()` reads. */
|
|
12
|
+
static { this.GLOBAL_NAME = 'IGNIS_BUILD_INFO'; }
|
|
13
|
+
/** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */
|
|
14
|
+
static async define(opts) {
|
|
15
|
+
const stamp = await BuildInfoResolver.getInstance().resolve(opts);
|
|
16
|
+
return { [BuildInfoStamp.GLOBAL_NAME]: JSON.stringify(stamp) };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,
|
|
20
|
+
* else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`
|
|
21
|
+
* stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.
|
|
22
|
+
*/
|
|
23
|
+
static async register() {
|
|
24
|
+
const stamp = typeof IGNIS_BUILD_INFO !== 'undefined'
|
|
25
|
+
? IGNIS_BUILD_INFO
|
|
26
|
+
: await BuildInfoResolver.getInstance().resolve();
|
|
27
|
+
BuildInfoRegistry.set({
|
|
28
|
+
buildInfo: { commit: stamp.commit, branch: stamp.branch, builtAt: stamp.builtAt },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=stamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp.js","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAM/C;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,+EAA+E;aAC/D,gBAAW,GAAG,kBAAkB,CAAC;IAEjD,yHAAyH;IACzH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAwB;QAC1C,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,OAAO,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ;QACnB,MAAM,KAAK,GACT,OAAO,gBAAgB,KAAK,WAAW;YACrC,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC;QAEtD,iBAAiB,CAAC,GAAG,CAAC;YACpB,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;SAClF,CAAC,CAAC;IACL,CAAC","sourcesContent":["import { BuildInfoRegistry, type TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { BuildInfoResolver } from './resolver';\n\n// A compile bakes the stamp in under this name (`define`); a run from source has no such name.\n// The identifier below must spell the same as `BuildInfoStamp.GLOBAL_NAME`.\ndeclare const IGNIS_BUILD_INFO: TBuildInfoRecord | undefined;\n\n/**\n * The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from\n * source resolves it from git when the application starts.\n *\n * `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the\n * stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.\n */\nexport class BuildInfoStamp {\n /** The identifier `define()` replaces in the bundle and `register()` reads. */\n static readonly GLOBAL_NAME = 'IGNIS_BUILD_INFO';\n\n /** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */\n static async define(opts?: { root?: string }): Promise<Record<string, string>> {\n const stamp = await BuildInfoResolver.getInstance().resolve(opts);\n return { [BuildInfoStamp.GLOBAL_NAME]: JSON.stringify(stamp) };\n }\n\n /**\n * Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,\n * else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`\n * stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.\n */\n static async register(): Promise<void> {\n const stamp =\n typeof IGNIS_BUILD_INFO !== 'undefined'\n ? IGNIS_BUILD_INFO\n : await BuildInfoResolver.getInstance().resolve();\n\n BuildInfoRegistry.set({\n buildInfo: { commit: stamp.commit, branch: stamp.branch, builtAt: stamp.builtAt },\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-boot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Build-time artifact index generator for IGNIS applications: scans decorated classes with the TypeScript AST and emits one static registration file per package, so bun build --compile sees plain imports.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"artifact-index",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"test:watch": "NODE_ENV=test bun test --watch --env-file=.env.test"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@venizia/ignis-helpers": "0.3.
|
|
101
|
-
"@venizia/ignis-inversion": "0.3.
|
|
100
|
+
"@venizia/ignis-helpers": "0.3.3",
|
|
101
|
+
"@venizia/ignis-inversion": "0.3.4"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@types/bun": "^1.4.1",
|
|
105
|
-
"@venizia/dev-configs": "0.3.
|
|
105
|
+
"@venizia/dev-configs": "0.3.3",
|
|
106
106
|
"eslint": "^10.10.0",
|
|
107
107
|
"oxfmt": "0.73.0",
|
|
108
108
|
"oxlint": "1.88.0",
|
|
@@ -114,7 +114,6 @@
|
|
|
114
114
|
"typescript": "^5.0.0 || ^6.0.0"
|
|
115
115
|
},
|
|
116
116
|
"bin": {
|
|
117
|
-
"ignis-artifacts": "./dist/cjs/clis/artifacts.js"
|
|
118
|
-
"ignis-build-info": "./dist/cjs/clis/build-info.js"
|
|
117
|
+
"ignis-artifacts": "./dist/cjs/clis/artifacts.js"
|
|
119
118
|
}
|
|
120
119
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/build-info/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport type { TBuildInfoFormat } from './constants';\n\nexport interface IBuildInfoOptions {\n out: string;\n /** Where `package.json` is read from and where `git` is asked; default the cwd. */\n root?: string;\n format?: TBuildInfoFormat;\n /** Name of the exported constant in `ts` format; default `BUILD_INFO`. */\n exportName?: string;\n}\n\nexport interface IBuildInfoResult {\n buildInfo: TBuildInfoRecord;\n content: string;\n out: string;\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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","sourcesContent":["import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { BuildInfoFormats, type TBuildInfoFormat } from './common';\n\n/** 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. */\nexport class BuildInfoEmitter {\n static readonly DEFAULT_EXPORT_NAME = 'BUILD_INFO';\n\n static render(opts: {\n buildInfo: TBuildInfoRecord;\n format: TBuildInfoFormat;\n exportName: string;\n }): string {\n const { buildInfo, format, exportName } = opts;\n\n if (format === BuildInfoFormats.JSON) {\n return `${JSON.stringify(buildInfo, null, 2)}\\n`;\n }\n\n const fields = Object.entries(buildInfo)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)},`)\n .join('\\n');\n\n return [\n '// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-build-info generate',\n `export const ${exportName} = {`,\n fields,\n '} as const;',\n '',\n ].join('\\n');\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-info.d.ts","sourceRoot":"","sources":["../../../src/clis/build-info.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
require("../common/install-quiet-logger");
|
|
5
|
-
const node_util_1 = require("node:util");
|
|
6
|
-
const build_info_1 = require("../build-info");
|
|
7
|
-
const USAGE = 'ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]';
|
|
8
|
-
const { positionals, values } = (0, node_util_1.parseArgs)({
|
|
9
|
-
args: process.argv.slice(2),
|
|
10
|
-
allowPositionals: true,
|
|
11
|
-
options: {
|
|
12
|
-
out: { type: 'string', default: 'src/_build_info.ts' },
|
|
13
|
-
root: { type: 'string', default: '.' },
|
|
14
|
-
format: { type: 'string', default: build_info_1.BuildInfoFormats.TS },
|
|
15
|
-
export: { type: 'string', default: build_info_1.BuildInfoEmitter.DEFAULT_EXPORT_NAME },
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/** Exit code of the command, so the process exits in exactly one place. */
|
|
19
|
-
const run = async () => {
|
|
20
|
-
if (positionals[0] !== 'generate') {
|
|
21
|
-
console.error(USAGE);
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
if (!build_info_1.BuildInfoFormats.isValid(values.format)) {
|
|
25
|
-
console.error(`invalid --format '${values.format}' | expected one of: ${[...build_info_1.BuildInfoFormats.SCHEME_SET].join(', ')}`);
|
|
26
|
-
return 1;
|
|
27
|
-
}
|
|
28
|
-
// Narrowed by comparison, never asserted: `isValid` above already refused everything else.
|
|
29
|
-
const format = values.format === build_info_1.BuildInfoFormats.JSON ? build_info_1.BuildInfoFormats.JSON : build_info_1.BuildInfoFormats.TS;
|
|
30
|
-
const result = await (0, build_info_1.generateBuildInfo)({
|
|
31
|
-
out: values.out,
|
|
32
|
-
root: values.root,
|
|
33
|
-
format,
|
|
34
|
-
exportName: values.export,
|
|
35
|
-
});
|
|
36
|
-
const { service, version, commit, branch } = result.buildInfo;
|
|
37
|
-
console.log(`wrote ${values.out} | ${service}@${version} | ${commit} (${branch})`);
|
|
38
|
-
return 0;
|
|
39
|
-
};
|
|
40
|
-
run()
|
|
41
|
-
.then(code => {
|
|
42
|
-
process.exit(code);
|
|
43
|
-
})
|
|
44
|
-
.catch(error => {
|
|
45
|
-
console.error(error);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=build-info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../../../src/clis/build-info.ts"],"names":[],"mappings":";;;AACA,0CAAwC;AACxC,yCAAsC;AACtC,8CAAsF;AAEtF,MAAM,KAAK,GACT,0GAA0G,CAAC;AAE7G,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAS,EAAC;IACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE;QACtD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,6BAAgB,CAAC,EAAE,EAAE;QACxD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,6BAAgB,CAAC,mBAAmB,EAAE;KAC1E;CACF,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,GAAG,GAAG,KAAK,IAAqB,EAAE;IACtC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,6BAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,CACX,qBAAqB,MAAM,CAAC,MAAM,wBAAwB,CAAC,GAAG,6BAAgB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxG,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,2FAA2F;IAC3F,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,KAAK,6BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,6BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,6BAAgB,CAAC,EAAE,CAAC;IAExF,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAiB,EAAC;QACrC,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,MAAM;KAC1B,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,OAAO,IAAI,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC;IAEnF,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,GAAG,EAAE;KACF,IAAI,CAAC,IAAI,CAAC,EAAE;IACX,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;KACD,KAAK,CAAC,KAAK,CAAC,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport '../common/install-quiet-logger';\nimport { parseArgs } from 'node:util';\nimport { BuildInfoEmitter, BuildInfoFormats, generateBuildInfo } from '../build-info';\n\nconst USAGE =\n 'ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]';\n\nconst { positionals, values } = parseArgs({\n args: process.argv.slice(2),\n allowPositionals: true,\n options: {\n out: { type: 'string', default: 'src/_build_info.ts' },\n root: { type: 'string', default: '.' },\n format: { type: 'string', default: BuildInfoFormats.TS },\n export: { type: 'string', default: BuildInfoEmitter.DEFAULT_EXPORT_NAME },\n },\n});\n\n/** Exit code of the command, so the process exits in exactly one place. */\nconst run = async (): Promise<number> => {\n if (positionals[0] !== 'generate') {\n console.error(USAGE);\n return 1;\n }\n\n if (!BuildInfoFormats.isValid(values.format)) {\n console.error(\n `invalid --format '${values.format}' | expected one of: ${[...BuildInfoFormats.SCHEME_SET].join(', ')}`,\n );\n return 1;\n }\n\n // Narrowed by comparison, never asserted: `isValid` above already refused everything else.\n const format =\n values.format === BuildInfoFormats.JSON ? BuildInfoFormats.JSON : BuildInfoFormats.TS;\n\n const result = await generateBuildInfo({\n out: values.out,\n root: values.root,\n format,\n exportName: values.export,\n });\n\n const { service, version, commit, branch } = result.buildInfo;\n console.log(`wrote ${values.out} | ${service}@${version} | ${commit} (${branch})`);\n\n return 0;\n};\n\nrun()\n .then(code => {\n process.exit(code);\n })\n .catch(error => {\n console.error(error);\n process.exit(1);\n });\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';
|
|
2
|
-
import type { TBuildInfoFormat } from './constants.js';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/build-info/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport type { TBuildInfoFormat } from './constants';\n\nexport interface IBuildInfoOptions {\n out: string;\n /** Where `package.json` is read from and where `git` is asked; default the cwd. */\n root?: string;\n format?: TBuildInfoFormat;\n /** Name of the exported constant in `ts` format; default `BUILD_INFO`. */\n exportName?: string;\n}\n\nexport interface IBuildInfoResult {\n buildInfo: TBuildInfoRecord;\n content: string;\n out: string;\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';
|
|
2
|
-
import { type TBuildInfoFormat } from './common/index.js';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BuildInfoFormats } from './common/index.js';
|
|
2
|
-
/** 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. */
|
|
3
|
-
export class BuildInfoEmitter {
|
|
4
|
-
static { this.DEFAULT_EXPORT_NAME = 'BUILD_INFO'; }
|
|
5
|
-
static render(opts) {
|
|
6
|
-
const { buildInfo, format, exportName } = opts;
|
|
7
|
-
if (format === BuildInfoFormats.JSON) {
|
|
8
|
-
return `${JSON.stringify(buildInfo, null, 2)}\n`;
|
|
9
|
-
}
|
|
10
|
-
const fields = Object.entries(buildInfo)
|
|
11
|
-
.map(([key, value]) => ` ${key}: ${JSON.stringify(value)},`)
|
|
12
|
-
.join('\n');
|
|
13
|
-
return [
|
|
14
|
-
'// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-build-info generate',
|
|
15
|
-
`export const ${exportName} = {`,
|
|
16
|
-
fields,
|
|
17
|
-
'} as const;',
|
|
18
|
-
'',
|
|
19
|
-
].join('\n');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=emitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/build-info/emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,UAAU,CAAC;AAEnE,+HAA+H;AAC/H,MAAM,OAAO,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,gBAAgB,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","sourcesContent":["import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { BuildInfoFormats, type TBuildInfoFormat } from './common';\n\n/** 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. */\nexport class BuildInfoEmitter {\n static readonly DEFAULT_EXPORT_NAME = 'BUILD_INFO';\n\n static render(opts: {\n buildInfo: TBuildInfoRecord;\n format: TBuildInfoFormat;\n exportName: string;\n }): string {\n const { buildInfo, format, exportName } = opts;\n\n if (format === BuildInfoFormats.JSON) {\n return `${JSON.stringify(buildInfo, null, 2)}\\n`;\n }\n\n const fields = Object.entries(buildInfo)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)},`)\n .join('\\n');\n\n return [\n '// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-build-info generate',\n `export const ${exportName} = {`,\n fields,\n '} as const;',\n '',\n ].join('\\n');\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-info.d.ts","sourceRoot":"","sources":["../../../src/clis/build-info.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import '../common/install-quiet-logger.js';
|
|
3
|
-
import { parseArgs } from 'node:util';
|
|
4
|
-
import { BuildInfoEmitter, BuildInfoFormats, generateBuildInfo } from '../build-info/index.js';
|
|
5
|
-
const USAGE = 'ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]';
|
|
6
|
-
const { positionals, values } = parseArgs({
|
|
7
|
-
args: process.argv.slice(2),
|
|
8
|
-
allowPositionals: true,
|
|
9
|
-
options: {
|
|
10
|
-
out: { type: 'string', default: 'src/_build_info.ts' },
|
|
11
|
-
root: { type: 'string', default: '.' },
|
|
12
|
-
format: { type: 'string', default: BuildInfoFormats.TS },
|
|
13
|
-
export: { type: 'string', default: BuildInfoEmitter.DEFAULT_EXPORT_NAME },
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
/** Exit code of the command, so the process exits in exactly one place. */
|
|
17
|
-
const run = async () => {
|
|
18
|
-
if (positionals[0] !== 'generate') {
|
|
19
|
-
console.error(USAGE);
|
|
20
|
-
return 1;
|
|
21
|
-
}
|
|
22
|
-
if (!BuildInfoFormats.isValid(values.format)) {
|
|
23
|
-
console.error(`invalid --format '${values.format}' | expected one of: ${[...BuildInfoFormats.SCHEME_SET].join(', ')}`);
|
|
24
|
-
return 1;
|
|
25
|
-
}
|
|
26
|
-
// Narrowed by comparison, never asserted: `isValid` above already refused everything else.
|
|
27
|
-
const format = values.format === BuildInfoFormats.JSON ? BuildInfoFormats.JSON : BuildInfoFormats.TS;
|
|
28
|
-
const result = await generateBuildInfo({
|
|
29
|
-
out: values.out,
|
|
30
|
-
root: values.root,
|
|
31
|
-
format,
|
|
32
|
-
exportName: values.export,
|
|
33
|
-
});
|
|
34
|
-
const { service, version, commit, branch } = result.buildInfo;
|
|
35
|
-
console.log(`wrote ${values.out} | ${service}@${version} | ${commit} (${branch})`);
|
|
36
|
-
return 0;
|
|
37
|
-
};
|
|
38
|
-
run()
|
|
39
|
-
.then(code => {
|
|
40
|
-
process.exit(code);
|
|
41
|
-
})
|
|
42
|
-
.catch(error => {
|
|
43
|
-
console.error(error);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=build-info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../../../src/clis/build-info.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEtF,MAAM,KAAK,GACT,0GAA0G,CAAC;AAE7G,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE;QACtD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE;QACxD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,EAAE;KAC1E;CACF,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,GAAG,GAAG,KAAK,IAAqB,EAAE;IACtC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,CACX,qBAAqB,MAAM,CAAC,MAAM,wBAAwB,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxG,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,2FAA2F;IAC3F,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,KAAK,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAExF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;QACrC,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,MAAM;KAC1B,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,OAAO,IAAI,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC;IAEnF,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,GAAG,EAAE;KACF,IAAI,CAAC,IAAI,CAAC,EAAE;IACX,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;KACD,KAAK,CAAC,KAAK,CAAC,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport '../common/install-quiet-logger';\nimport { parseArgs } from 'node:util';\nimport { BuildInfoEmitter, BuildInfoFormats, generateBuildInfo } from '../build-info';\n\nconst USAGE =\n 'ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]';\n\nconst { positionals, values } = parseArgs({\n args: process.argv.slice(2),\n allowPositionals: true,\n options: {\n out: { type: 'string', default: 'src/_build_info.ts' },\n root: { type: 'string', default: '.' },\n format: { type: 'string', default: BuildInfoFormats.TS },\n export: { type: 'string', default: BuildInfoEmitter.DEFAULT_EXPORT_NAME },\n },\n});\n\n/** Exit code of the command, so the process exits in exactly one place. */\nconst run = async (): Promise<number> => {\n if (positionals[0] !== 'generate') {\n console.error(USAGE);\n return 1;\n }\n\n if (!BuildInfoFormats.isValid(values.format)) {\n console.error(\n `invalid --format '${values.format}' | expected one of: ${[...BuildInfoFormats.SCHEME_SET].join(', ')}`,\n );\n return 1;\n }\n\n // Narrowed by comparison, never asserted: `isValid` above already refused everything else.\n const format =\n values.format === BuildInfoFormats.JSON ? BuildInfoFormats.JSON : BuildInfoFormats.TS;\n\n const result = await generateBuildInfo({\n out: values.out,\n root: values.root,\n format,\n exportName: values.export,\n });\n\n const { service, version, commit, branch } = result.buildInfo;\n console.log(`wrote ${values.out} | ${service}@${version} | ${commit} (${branch})`);\n\n return 0;\n};\n\nrun()\n .then(code => {\n process.exit(code);\n })\n .catch(error => {\n console.error(error);\n process.exit(1);\n });\n"]}
|