@venizia/ignis 0.3.3 → 0.3.5

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 (23) hide show
  1. package/dist/vulcan-preset/app/files/.configs/builders/Dockerfile +64 -0
  2. package/dist/vulcan-preset/app/files/.configs/builders/compile.ts +10 -0
  3. package/dist/vulcan-preset/{files → app/files}/src/application.ts +6 -0
  4. package/dist/vulcan-preset/{files → app/files}/src/index.ts +2 -0
  5. package/dist/vulcan-preset/app/files/tsconfig.json +19 -0
  6. package/dist/vulcan-preset/{preset.json → app/preset.json} +10 -10
  7. package/dist/vulcan-preset/lib/files/.configs/formatters/oxfmt.config.mts +4 -0
  8. package/dist/vulcan-preset/lib/files/.configs/lints/eslint.config.mjs +4 -0
  9. package/dist/vulcan-preset/lib/files/.configs/lints/oxlint.config.mts +4 -0
  10. package/dist/vulcan-preset/lib/files/src/index.ts +1 -0
  11. package/dist/vulcan-preset/lib/files/src/services/greeting.service.test.ts +8 -0
  12. package/dist/vulcan-preset/lib/files/src/services/greeting.service.ts +12 -0
  13. package/dist/vulcan-preset/{files → lib/files}/tsconfig.json +2 -2
  14. package/dist/vulcan-preset/lib/preset.json +45 -0
  15. package/package.json +10 -9
  16. package/dist/vulcan-preset/files/README.md +0 -5
  17. package/dist/vulcan-preset/files/scripts/lint.sh +0 -17
  18. /package/dist/vulcan-preset/{files/.configs → app/files/.configs/formatters}/oxfmt.config.mts +0 -0
  19. /package/dist/vulcan-preset/{files/.configs → app/files/.configs/lints}/eslint.config.mjs +0 -0
  20. /package/dist/vulcan-preset/{files/.configs → app/files/.configs/lints}/oxlint.config.mts +0 -0
  21. /package/dist/vulcan-preset/{files → app/files}/_env.example +0 -0
  22. /package/dist/vulcan-preset/{files → app/files}/src/controllers/hello.controller.ts +0 -0
  23. /package/dist/vulcan-preset/{files → app/files}/src/smoke.test.ts +0 -0
@@ -0,0 +1,64 @@
1
+ # {{app}}: a compiled IGNIS binary on Alpine. Build from the project root:
2
+ # docker build -f {{appPath}}/.configs/builders/Dockerfile -t {{app}} \
3
+ # --build-arg APP_BUILD_COMMIT="$(git rev-parse HEAD)" \
4
+ # --build-arg APP_BUILD_BRANCH="$(git rev-parse --abbrev-ref HEAD)" .
5
+ # The whole project is the build context (trimmed by the root .dockerignore), because the preset
6
+ # cannot know which workspace packages the app imports. List them by hand for better layer caching.
7
+
8
+ FROM docker.io/oven/bun:1.4.3-alpine AS base
9
+
10
+ # A private npm mirror, if the build has no access to the public registry.
11
+ ARG BUN_CONFIG_REGISTRY=
12
+ ENV BUN_CONFIG_REGISTRY=${BUN_CONFIG_REGISTRY}
13
+
14
+ WORKDIR /home/bun/project
15
+ RUN chown bun:bun /home/bun/project
16
+ USER bun
17
+
18
+ # -------------------------------------------------------------------------------
19
+ # Build stage: install the workspace, compile the app to dist/bin
20
+ # -------------------------------------------------------------------------------
21
+ FROM base AS builder
22
+
23
+ # The image has no .git, so the build stamp reads the commit and the branch from these. A build
24
+ # without the commit stops here: an image must always say which commit it runs.
25
+ ARG APP_BUILD_COMMIT=
26
+ ARG APP_BUILD_BRANCH=
27
+ ARG APP_BUILD_VERSION=
28
+ RUN test -n "$APP_BUILD_COMMIT" || { echo "Pass --build-arg APP_BUILD_COMMIT=\$(git rev-parse HEAD)" >&2; exit 1; }
29
+
30
+ COPY --chown=bun . .
31
+ # A .env in the context puts its secrets in the layer above: refuse the build and name the files.
32
+ RUN leaked="$(find . -name '.env*' ! -name '.env.example' -not -path '*/node_modules/*')"; \
33
+ if [ -n "$leaked" ]; then \
34
+ echo "Secrets in the build context: $leaked - add **/.env and **/.env.* to the root .dockerignore" >&2; \
35
+ exit 1; \
36
+ fi
37
+ RUN bun install --frozen-lockfile --ignore-scripts
38
+
39
+ WORKDIR /home/bun/project/{{appPath}}
40
+ # Alpine is musl: the binary targets bun-linux-<arch>-musl, for the architecture the image builds on.
41
+ RUN BUN_TARGET="bun-linux-$([ "$(uname -m)" = aarch64 ] && echo arm64 || echo x64)-musl" bun run compile
42
+
43
+ # -------------------------------------------------------------------------------
44
+ # Production stage: the binary alone
45
+ # -------------------------------------------------------------------------------
46
+ FROM docker.io/alpine:3.21 AS production
47
+
48
+ ARG APP_BUILD_COMMIT=
49
+ LABEL org.opencontainers.image.revision="${APP_BUILD_COMMIT}"
50
+
51
+ # A Bun binary links libstdc++ and libgcc dynamically on musl.
52
+ COPY --from=builder /usr/lib/libstdc++.so.6* /usr/lib/
53
+ COPY --from=builder /usr/lib/libgcc_s.so.1* /usr/lib/
54
+ RUN addgroup -S app && adduser -S app -G app
55
+
56
+ WORKDIR /home/app
57
+ USER app
58
+
59
+ COPY --from=builder --chown=app /home/bun/project/{{appPath}}/dist/bin ./bin
60
+
61
+ ENV HOST=0.0.0.0 PORT={{devPort}}
62
+ EXPOSE {{devPort}}
63
+
64
+ CMD ["./bin"]
@@ -0,0 +1,10 @@
1
+ import { BunCompiler } from '@venizia/dev-configs/compilers';
2
+ import { IgnisArtifactsPlugin } from '@venizia/ignis-boot/bun';
3
+ import { BuildInfoStamp } from '@venizia/ignis-boot/build-info';
4
+
5
+ await BunCompiler.compile({
6
+ entrypoint: './src/index.ts',
7
+ outfile: './dist/bin',
8
+ plugins: [IgnisArtifactsPlugin.create()],
9
+ define: await BuildInfoStamp.define(),
10
+ });
@@ -1,5 +1,7 @@
1
1
  import { ApiReferenceComponent, BaseApplication, type IApplicationInfo } from '@venizia/ignis';
2
2
  import AutoArtifacts from '@venizia/ignis-boot/auto';
3
+ import { LoggerFactory } from '@venizia/ignis-helpers';
4
+ import { WinstonLogger } from '@venizia/ignis-helpers/winston';
3
5
  import packageJson from '../package.json';
4
6
 
5
7
  export class Application extends BaseApplication {
@@ -22,6 +24,10 @@ export class Application extends BaseApplication {
22
24
  setupMiddlewares() {}
23
25
  }
24
26
 
27
+ // A compiled binary cannot load the default provider at run time; only a class reference carries it into the bundle.
28
+ // It is registered before the application below is built, because building it already logs.
29
+ LoggerFactory.use({ provider: WinstonLogger });
30
+
25
31
  export const application = new Application({
26
32
  scope: 'Application',
27
33
  config: {
@@ -1,6 +1,8 @@
1
+ import { BuildInfoStamp } from '@venizia/ignis-boot/build-info';
1
2
  import { application } from '#src/application';
2
3
 
3
4
  const main = async () => {
5
+ await BuildInfoStamp.register();
4
6
  application.init();
5
7
  await application.start();
6
8
  };
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json.schemastore.org/tsconfig",
3
+ "extends": "@venizia/dev-configs/tsconfig.common.json",
4
+ "compilerOptions": {
5
+ "module": "preserve",
6
+ "moduleResolution": "bundler",
7
+ "experimentalDecorators": true,
8
+ "emitDecoratorMetadata": true,
9
+ "useDefineForClassFields": false
10
+ },
11
+ "include": [
12
+ "src",
13
+ ".configs/builders"
14
+ ],
15
+ "exclude": [
16
+ "node_modules",
17
+ "dist"
18
+ ]
19
+ }
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "@hono/zod-openapi": "^1.6.3",
16
16
  "@scalar/hono-api-reference": "^0.11.16",
17
- "@venizia/ignis": "0.3.3",
18
- "@venizia/ignis-boot": "0.3.3",
19
- "@venizia/ignis-helpers": "0.3.3",
17
+ "@venizia/ignis": "0.3.5",
18
+ "@venizia/ignis-boot": "0.3.4",
19
+ "@venizia/ignis-helpers": "0.3.4",
20
20
  "hono": "^4.13.7",
21
21
  "winston": "^3.19.0",
22
22
  "winston-daily-rotate-file": "^5.0.0",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "^1.4.1",
27
- "@venizia/dev-configs": "0.3.3",
27
+ "@venizia/dev-configs": "0.3.4",
28
28
  "eslint": "^10.10.0",
29
29
  "oxfmt": "0.73.0",
30
30
  "oxlint": "1.88.0",
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "peers": {},
35
35
  "scripts": {
36
- "dev": "NODE_ENV=development bun run src/index.ts",
37
- "start": "NODE_ENV=production bun run dist/index.js",
38
- "build": "tsc -p tsconfig.json",
36
+ "server:dev": "NODE_ENV=development bun run src/index.ts",
37
+ "compile": "bun .configs/builders/compile.ts",
39
38
  "typecheck": "bun check",
40
- "lint": "sh scripts/lint.sh",
41
- "lint:fix": "sh scripts/lint.sh --fix",
42
- "test": "bun test"
39
+ "lint": "devz lint",
40
+ "lint:fix": "devz lint --fix",
41
+ "test": "bun test",
42
+ "clean": "devz clean"
43
43
  },
44
44
  "checks": [
45
45
  "typecheck",
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from 'oxfmt';
2
+ import { oxfmtConfigs } from '@venizia/dev-configs/formatters';
3
+
4
+ export default defineConfig(oxfmtConfigs);
@@ -0,0 +1,4 @@
1
+ import { houseConfigs } from '@venizia/dev-configs/linters';
2
+
3
+ // oxlint (oxlint.config.mts) runs every other rule; ESLint runs the naming convention and the house rules.
4
+ export default houseConfigs;
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from 'oxlint';
2
+ import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
3
+
4
+ export default defineConfig(oxlintConfigs);
@@ -0,0 +1 @@
1
+ export * from '#src/services/greeting.service';
@@ -0,0 +1,8 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { GreetingService } from '#src/services/greeting.service';
3
+
4
+ describe('GreetingService', () => {
5
+ test('greets by name', () => {
6
+ expect(new GreetingService().greet({ name: 'IGNIS' })).toBe('Hello, IGNIS!');
7
+ });
8
+ });
@@ -0,0 +1,12 @@
1
+ import { BaseService } from '@venizia/ignis';
2
+
3
+ // A backend app binds it like its own services: `this.service(GreetingService)` in its application.
4
+ export class GreetingService extends BaseService {
5
+ constructor() {
6
+ super({ scope: GreetingService.name });
7
+ }
8
+
9
+ greet(opts: { name: string }): string {
10
+ return `Hello, ${opts.name}!`;
11
+ }
12
+ }
@@ -2,8 +2,8 @@
2
2
  "$schema": "http://json.schemastore.org/tsconfig",
3
3
  "extends": "@venizia/dev-configs/tsconfig.common.json",
4
4
  "compilerOptions": {
5
- "outDir": "dist",
6
- "rootDir": "src",
5
+ "module": "preserve",
6
+ "moduleResolution": "bundler",
7
7
  "experimentalDecorators": true,
8
8
  "emitDecoratorMetadata": true,
9
9
  "useDefineForClassFields": false
@@ -0,0 +1,45 @@
1
+ {
2
+ "presetVersion": 1,
3
+ "summary": "A shared IGNIS library: services other backend apps import (exports to src, #src imports).",
4
+ "dependencies": {},
5
+ "devDependencies": {
6
+ "@types/bun": "^1.4.1",
7
+ "@venizia/dev-configs": "0.3.4",
8
+ "@venizia/ignis": "0.3.5",
9
+ "eslint": "^10.10.0",
10
+ "oxfmt": "0.73.0",
11
+ "oxlint": "1.88.0",
12
+ "oxlint-tsgolint": "7.0.2004",
13
+ "typescript": "^6.0.3"
14
+ },
15
+ "peerDependencies": {
16
+ "@venizia/ignis": "0.3.5"
17
+ },
18
+ "scripts": {
19
+ "typecheck": "bun check",
20
+ "lint": "devz lint",
21
+ "lint:fix": "devz lint --fix",
22
+ "test": "bun test",
23
+ "clean": "devz clean"
24
+ },
25
+ "checks": [
26
+ "typecheck",
27
+ "lint",
28
+ "test"
29
+ ],
30
+ "imports": {
31
+ "#src/*.json": "./src/*.json",
32
+ "#src/*": "./src/*.js"
33
+ },
34
+ "exports": {
35
+ ".": "./src/index.ts"
36
+ },
37
+ "files": "./files",
38
+ "atlas": [
39
+ {
40
+ "name": "ignis",
41
+ "repo": "VENIZIA-AI/ignis",
42
+ "ref": "develop"
43
+ }
44
+ ]
45
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ignis",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "High-performance TypeScript server infrastructure combining LoopBack 4 enterprise architecture (decorator-based DI, repository pattern, component system) with Hono speed (~140k req/s). Features auto-generated OpenAPI docs, Drizzle ORM type-safe SQL, JWT/Basic authentication, Casbin authorization, convention-based bootstrapping, and pluggable components for health checks, Swagger UI, mail, Socket.IO, and static assets. Built for Bun and Node.js.",
5
5
  "keywords": [
6
6
  "access-control",
@@ -191,18 +191,19 @@
191
191
  },
192
192
  "sideEffects": false,
193
193
  "vulcan": {
194
- "preset": "./dist/vulcan-preset/preset.json"
194
+ "preset": "./dist/vulcan-preset/app/preset.json",
195
+ "lib": "./dist/vulcan-preset/lib/preset.json"
195
196
  },
196
197
  "scripts": {
197
198
  "force-update": "sh ./scripts/force-update.sh",
198
199
  "prepublishOnly": "make rebuild"
199
200
  },
200
201
  "dependencies": {
201
- "@venizia/ignis-connectors": "0.3.3",
202
- "@venizia/ignis-filter": "0.3.3",
203
- "@venizia/ignis-helpers": "0.3.3",
204
- "@venizia/ignis-inversion": "0.3.4",
205
- "@venizia/ignis-kernel": "0.3.3",
202
+ "@venizia/ignis-connectors": "0.3.4",
203
+ "@venizia/ignis-filter": "0.3.4",
204
+ "@venizia/ignis-helpers": "0.3.4",
205
+ "@venizia/ignis-inversion": "0.3.5",
206
+ "@venizia/ignis-kernel": "0.3.4",
206
207
  "reflect-metadata": "^0.2.2"
207
208
  },
208
209
  "peerDependencies": {
@@ -306,8 +307,8 @@
306
307
  "@types/bun": "^1.4.1",
307
308
  "@types/nodemailer": "^8.0.1",
308
309
  "@types/pg": "^8.23.1",
309
- "@venizia/dev-configs": "0.3.3",
310
- "@venizia/ignis-boot": "0.3.3",
310
+ "@venizia/dev-configs": "0.3.4",
311
+ "@venizia/ignis-boot": "0.3.4",
311
312
  "casbin": "^5.51.1",
312
313
  "eslint": "^10.10.0",
313
314
  "meilisearch": "^0.60.0",
@@ -1,5 +0,0 @@
1
- # {{app}}
2
-
3
- The {{app}} backend of {{project}}, built on IGNIS.
4
-
5
- `bun run dev` serves `http://localhost:{{devPort}}/api/hello`.
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env sh
2
- # Lint this app with oxlint, eslint and oxfmt. `sh scripts/lint.sh` checks; `--fix` fixes.
3
- set -eu
4
- cd "$(dirname "$0")/.."
5
-
6
- FILES='**/*.{ts,tsx,mts,js,mjs}'
7
- ESLINT_CACHE='--cache --cache-location node_modules/.cache/eslint/'
8
-
9
- if [ "${1:-}" = "--fix" ]; then
10
- oxlint -c .configs/oxlint.config.mts --fix
11
- eslint -c .configs/eslint.config.mjs $ESLINT_CACHE --fix .
12
- oxfmt -c .configs/oxfmt.config.mts "$FILES"
13
- else
14
- oxlint -c .configs/oxlint.config.mts --deny-warnings
15
- eslint -c .configs/eslint.config.mjs $ESLINT_CACHE .
16
- oxfmt -c .configs/oxfmt.config.mts --check "$FILES"
17
- fi