@venizia/ignis 0.3.2 → 0.3.4

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 (22) hide show
  1. package/dist/vulcan-preset/app/files/.configs/builders/Dockerfile +58 -0
  2. package/dist/vulcan-preset/app/files/.configs/builders/compile.ts +10 -0
  3. package/dist/vulcan-preset/{files/.configs → app/files/.configs/lints}/oxlint.config.mts +1 -1
  4. package/dist/vulcan-preset/{files → app/files}/src/application.ts +6 -0
  5. package/dist/vulcan-preset/{files → app/files}/src/index.ts +3 -1
  6. package/dist/vulcan-preset/app/files/tsconfig.json +19 -0
  7. package/dist/vulcan-preset/{preset.json → app/preset.json} +15 -12
  8. package/dist/vulcan-preset/lib/files/.configs/formatters/oxfmt.config.mts +4 -0
  9. package/dist/vulcan-preset/lib/files/.configs/lints/eslint.config.mjs +4 -0
  10. package/dist/vulcan-preset/lib/files/.configs/lints/oxlint.config.mts +4 -0
  11. package/dist/vulcan-preset/lib/files/src/index.ts +1 -0
  12. package/dist/vulcan-preset/lib/files/src/services/greeting.service.test.ts +8 -0
  13. package/dist/vulcan-preset/lib/files/src/services/greeting.service.ts +12 -0
  14. package/dist/vulcan-preset/{files → lib/files}/tsconfig.json +2 -7
  15. package/dist/vulcan-preset/lib/preset.json +45 -0
  16. package/package.json +10 -9
  17. package/dist/vulcan-preset/files/README.md +0 -5
  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 → app/files}/_env.example +0 -0
  21. /package/dist/vulcan-preset/{files → app/files}/src/controllers/hello.controller.ts +0 -0
  22. /package/dist/vulcan-preset/{files → app/files}/src/smoke.test.ts +0 -0
@@ -0,0 +1,58 @@
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
+ RUN bun install --frozen-lockfile --ignore-scripts
32
+
33
+ WORKDIR /home/bun/project/{{appPath}}
34
+ # Alpine is musl: the binary targets bun-linux-<arch>-musl, for the architecture the image builds on.
35
+ RUN BUN_TARGET="bun-linux-$([ "$(uname -m)" = aarch64 ] && echo arm64 || echo x64)-musl" bun run compile
36
+
37
+ # -------------------------------------------------------------------------------
38
+ # Production stage: the binary alone
39
+ # -------------------------------------------------------------------------------
40
+ FROM docker.io/alpine:3.21 AS production
41
+
42
+ ARG APP_BUILD_COMMIT=
43
+ LABEL org.opencontainers.image.revision="${APP_BUILD_COMMIT}"
44
+
45
+ # A Bun binary links libstdc++ and libgcc dynamically on musl.
46
+ COPY --from=builder /usr/lib/libstdc++.so.6* /usr/lib/
47
+ COPY --from=builder /usr/lib/libgcc_s.so.1* /usr/lib/
48
+ RUN addgroup -S app && adduser -S app -G app
49
+
50
+ WORKDIR /home/app
51
+ USER app
52
+
53
+ COPY --from=builder --chown=app /home/bun/project/{{appPath}}/dist/bin ./bin
54
+
55
+ ENV HOST=0.0.0.0 PORT={{devPort}}
56
+ EXPOSE {{devPort}}
57
+
58
+ 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,4 +1,4 @@
1
1
  import { defineConfig } from 'oxlint';
2
- import { oxlintConfigs } from '@venizia/dev-configs/linters';
2
+ import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
3
3
 
4
4
  export default defineConfig(oxlintConfigs);
@@ -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 { application } from './application';
1
+ import { BuildInfoStamp } from '@venizia/ignis-boot/build-info';
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
+ }
@@ -7,12 +7,16 @@
7
7
  "/api/hello",
8
8
  "/api/doc/explorer"
9
9
  ],
10
+ "imports": {
11
+ "#src/*.json": "./src/*.json",
12
+ "#src/*": "./src/*.js"
13
+ },
10
14
  "dependencies": {
11
15
  "@hono/zod-openapi": "^1.6.3",
12
16
  "@scalar/hono-api-reference": "^0.11.16",
13
- "@venizia/ignis": "0.3.2",
14
- "@venizia/ignis-boot": "0.3.2",
15
- "@venizia/ignis-helpers": "0.3.2",
17
+ "@venizia/ignis": "0.3.4",
18
+ "@venizia/ignis-boot": "0.3.4",
19
+ "@venizia/ignis-helpers": "0.3.4",
16
20
  "hono": "^4.13.7",
17
21
  "winston": "^3.19.0",
18
22
  "winston-daily-rotate-file": "^5.0.0",
@@ -20,23 +24,22 @@
20
24
  },
21
25
  "devDependencies": {
22
26
  "@types/bun": "^1.4.1",
23
- "@venizia/dev-configs": "0.3.1",
27
+ "@venizia/dev-configs": "0.3.4",
24
28
  "eslint": "^10.10.0",
25
29
  "oxfmt": "0.73.0",
26
30
  "oxlint": "1.88.0",
27
31
  "oxlint-tsgolint": "7.0.2004",
28
- "tsc-alias": "^1.9.4",
29
32
  "typescript": "^6.0.3"
30
33
  },
31
34
  "peers": {},
32
35
  "scripts": {
33
- "dev": "NODE_ENV=development bun run src/index.ts",
34
- "start": "NODE_ENV=production bun run dist/index.js",
35
- "build": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
36
- "typecheck": "bun check --no-pretty -p tsconfig.json",
37
- "lint": "oxlint -c .configs/oxlint.config.mts --deny-warnings && eslint -c .configs/eslint.config.mjs . && oxfmt -c .configs/oxfmt.config.mts --check \"**/*.{ts,tsx,mts,js,mjs}\"",
38
- "lint:fix": "oxlint -c .configs/oxlint.config.mts --fix && eslint -c .configs/eslint.config.mjs . --fix && oxfmt -c .configs/oxfmt.config.mts \"**/*.{ts,tsx,mts,js,mjs}\"",
39
- "test": "bun test"
36
+ "server:dev": "NODE_ENV=development bun run src/index.ts",
37
+ "compile": "bun .configs/builders/compile.ts",
38
+ "typecheck": "bun check",
39
+ "lint": "devz lint",
40
+ "lint:fix": "devz lint --fix",
41
+ "test": "bun test",
42
+ "clean": "devz clean"
40
43
  },
41
44
  "checks": [
42
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,13 +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",
7
- "paths": {
8
- "@/*": [
9
- "./src/*"
10
- ]
11
- },
5
+ "module": "preserve",
6
+ "moduleResolution": "bundler",
12
7
  "experimentalDecorators": true,
13
8
  "emitDecoratorMetadata": true,
14
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.4",
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.4"
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.2",
3
+ "version": "0.3.4",
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.2",
202
- "@venizia/ignis-filter": "0.3.2",
203
- "@venizia/ignis-helpers": "0.3.2",
204
- "@venizia/ignis-inversion": "0.3.2",
205
- "@venizia/ignis-kernel": "0.3.2",
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.1",
310
- "@venizia/ignis-boot": "0.3.2",
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`.