From 0644985b9c994518b84c9daa2ac7eaee005dec11 Mon Sep 17 00:00:00 2001 From: ScarletFlash Date: Sat, 13 Jul 2024 19:05:34 +0200 Subject: [PATCH] build: turbo-powered builds --- .gitignore | 2 + application/.gitignore | 1 - application/angular.json | 6 +- application/eslint.config.js | 334 ++++++------- application/package.json | 8 +- .../src/app/background/background.service.ts | 5 +- .../pages/referrals/referrals.component.html | 21 +- application/tsconfig.app.json | 9 - application/tsconfig.json | 31 +- application/turbo.json | 15 + lib-background/package.json | 30 ++ lib-background/src/api.ts | 4 + lib-background/src/dimensions.interface.ts | 4 + .../src/grid-plane.object.ts | 4 +- .../src}/grid.material.ts | 8 +- .../src}/render-loop.ts | 26 +- .../src}/scene-content-manager.ts | 11 +- lib-background/tsconfig.json | 4 + package-lock.json | 470 +++++++++++++++++- package.json | 5 + turbo.json | 21 + 21 files changed, 777 insertions(+), 242 deletions(-) delete mode 100644 application/tsconfig.app.json create mode 100644 lib-background/package.json create mode 100644 lib-background/src/api.ts create mode 100644 lib-background/src/dimensions.interface.ts rename application/src/app/background/scene/grid-plane.ts => lib-background/src/grid-plane.object.ts (78%) rename {application/src/app/background/scene/resourses => lib-background/src}/grid.material.ts (89%) rename {application/src/app/background/scene => lib-background/src}/render-loop.ts (74%) rename {application/src/app/background/scene => lib-background/src}/scene-content-manager.ts (85%) create mode 100644 lib-background/tsconfig.json diff --git a/.gitignore b/.gitignore index a5cbb4c..68511cf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ node_modules/ npm-debug.log .DS_Store Thumbs.db +dist/ +dist-watch/ diff --git a/application/.gitignore b/application/.gitignore index 3476107..0c9cacd 100644 --- a/application/.gitignore +++ b/application/.gitignore @@ -1,3 +1,2 @@ -dist/ out-tsc/ .angular/cache/ diff --git a/application/angular.json b/application/angular.json index 487d0df..afd8467 100644 --- a/application/angular.json +++ b/application/angular.json @@ -1,5 +1,5 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "$schema": "../node_modules/@angular/cli/lib/config/schema.json", "version": 1, "cli": { "packageManager": "npm", @@ -50,11 +50,11 @@ "build": { "builder": "@angular-devkit/build-angular:application", "options": { - "outputPath": "dist/frontend", + "outputPath": "dist", "index": "src/index.html", "browser": "src/main.ts", "polyfills": ["zone.js"], - "tsConfig": "tsconfig.app.json", + "tsConfig": "tsconfig.json", "assets": [ { "glob": "**/*", diff --git a/application/eslint.config.js b/application/eslint.config.js index 213419e..8682f39 100644 --- a/application/eslint.config.js +++ b/application/eslint.config.js @@ -1,7 +1,7 @@ // @ts-check -const ESLint = require('@eslint/js'); -const AngularESLint = require('angular-eslint'); -const TypeScriptESLint = require('typescript-eslint'); +const ESLint = require("@eslint/js"); +const AngularESLint = require("angular-eslint"); +const TypeScriptESLint = require("typescript-eslint"); module.exports = TypeScriptESLint.config( { @@ -9,152 +9,152 @@ module.exports = TypeScriptESLint.config( parser: TypeScriptESLint.parser, parserOptions: { ecmaFeatures: { modules: true }, - ecmaVersion: 'latest', - project: './tsconfig.app.json' - } + ecmaVersion: "latest", + project: "./tsconfig.json", + }, }, - files: ['**/*.ts'], + files: ["**/*.ts"], extends: [ ESLint.configs.recommended, ...TypeScriptESLint.configs.strictTypeChecked, ...TypeScriptESLint.configs.stylisticTypeChecked, - ...AngularESLint.configs.tsAll + ...AngularESLint.configs.tsAll, ], processor: AngularESLint.processInlineTemplates, rules: { - '@angular-eslint/use-component-view-encapsulation': 'off', - '@angular-eslint/use-injectable-provided-in': 'off', - '@angular-eslint/no-host-metadata-property': 'off', - curly: 'error', - 'max-depth': [ - 'error', + "@angular-eslint/use-component-view-encapsulation": "off", + "@angular-eslint/use-injectable-provided-in": "off", + "@angular-eslint/no-host-metadata-property": "off", + curly: "error", + "max-depth": [ + "error", { - max: 2 - } + max: 2, + }, ], - 'no-else-return': [ - 'error', + "no-else-return": [ + "error", { - allowElseIf: false - } + allowElseIf: false, + }, ], - 'no-extra-boolean-cast': [ - 'error', + "no-extra-boolean-cast": [ + "error", { - enforceForLogicalOperands: true - } + enforceForLogicalOperands: true, + }, ], - 'no-implicit-coercion': [ - 'error', + "no-implicit-coercion": [ + "error", { boolean: true, number: true, string: true, - disallowTemplateShorthand: false - } + disallowTemplateShorthand: false, + }, ], - 'no-shadow': 'off', - '@typescript-eslint/no-shadow': 'error', - '@typescript-eslint/consistent-type-imports': [ - 'error', + "no-shadow": "off", + "@typescript-eslint/no-shadow": "error", + "@typescript-eslint/consistent-type-imports": [ + "error", { - prefer: 'type-imports', + prefer: "type-imports", disallowTypeAnnotations: true, - fixStyle: 'inline-type-imports' - } + fixStyle: "inline-type-imports", + }, ], - '@typescript-eslint/consistent-type-exports': [ - 'error', + "@typescript-eslint/consistent-type-exports": [ + "error", { - fixMixedExportsWithInlineTypeSpecifier: true - } + fixMixedExportsWithInlineTypeSpecifier: true, + }, ], - '@typescript-eslint/ban-types': [ - 'error', + "@typescript-eslint/ban-types": [ + "error", { types: { - Object: null + Object: null, }, - extendDefaults: false - } + extendDefaults: false, + }, ], - '@typescript-eslint/consistent-type-assertions': [ - 'error', + "@typescript-eslint/consistent-type-assertions": [ + "error", { - assertionStyle: 'as', - objectLiteralTypeAssertions: 'never' - } + assertionStyle: "as", + objectLiteralTypeAssertions: "never", + }, ], - '@typescript-eslint/no-unnecessary-condition': [ - 'error', + "@typescript-eslint/no-unnecessary-condition": [ + "error", { allowConstantLoopConditions: false, - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true - } + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true, + }, ], - '@typescript-eslint/explicit-member-accessibility': [ - 'error', + "@typescript-eslint/explicit-member-accessibility": [ + "error", { - accessibility: 'explicit', + accessibility: "explicit", overrides: { - constructors: 'off', - parameterProperties: 'off' - } - } + constructors: "off", + parameterProperties: "off", + }, + }, ], - '@typescript-eslint/member-ordering': [ - 'error', + "@typescript-eslint/member-ordering": [ + "error", { classes: [ - 'abstract-field', - 'instance-field', - 'static-field', + "abstract-field", + "instance-field", + "static-field", - 'static-get', - 'instance-get', - 'abstract-get', + "static-get", + "instance-get", + "abstract-get", - 'constructor', + "constructor", - 'abstract-method', + "abstract-method", - 'public-instance-method', - 'protected-instance-method', - 'private-instance-method', - '#private-instance-method', + "public-instance-method", + "protected-instance-method", + "private-instance-method", + "#private-instance-method", - 'public-static-method', - 'protected-static-method', - 'private-static-method', - '#private-static-method' - ] - } - ], - '@typescript-eslint/no-inferrable-types': 'off', - '@typescript-eslint/no-require-imports': 'error', - 'no-unused-expressions': 'off', - 'no-inner-declarations': 'off', - '@typescript-eslint/no-unused-expressions': [ - 'error', + "public-static-method", + "protected-static-method", + "private-static-method", + "#private-static-method", + ], + }, + ], + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-require-imports": "error", + "no-unused-expressions": "off", + "no-inner-declarations": "off", + "@typescript-eslint/no-unused-expressions": [ + "error", { allowShortCircuit: false, allowTernary: true, allowTaggedTemplates: false, - enforceForJSX: false - } + enforceForJSX: false, + }, ], - '@typescript-eslint/prefer-readonly': 'error', - '@typescript-eslint/strict-boolean-expressions': [ - 'error', + "@typescript-eslint/prefer-readonly": "error", + "@typescript-eslint/strict-boolean-expressions": [ + "error", { allowString: false, allowNumber: false, - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false - } + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false, + }, ], - '@typescript-eslint/no-extraneous-class': 'off', - '@typescript-eslint/typedef': [ - 'error', + "@typescript-eslint/no-extraneous-class": "off", + "@typescript-eslint/typedef": [ + "error", { arrowParameter: true, arrayDestructuring: false, @@ -163,82 +163,82 @@ module.exports = TypeScriptESLint.config( parameter: true, propertyDeclaration: true, variableDeclaration: true, - variableDeclarationIgnoreFunction: true - } + variableDeclarationIgnoreFunction: true, + }, ], - '@typescript-eslint/prefer-as-const': 'off', - '@typescript-eslint/explicit-function-return-type': [ - 'error', + "@typescript-eslint/prefer-as-const": "off", + "@typescript-eslint/explicit-function-return-type": [ + "error", { - allowExpressions: true - } + allowExpressions: true, + }, ], - '@typescript-eslint/no-namespace': 'off', + "@typescript-eslint/no-namespace": "off", complexity: [ - 'error', - { - max: 10 - } - ], - 'consistent-return': 'error', - 'no-underscore-dangle': 'error', - 'default-case': 'error', - 'default-case-last': 'error', - eqeqeq: 'error', - 'no-caller': 'error', - 'no-duplicate-imports': 'error', - 'no-sequences': [ - 'error', - { - allowInParentheses: false - } - ], - 'no-template-curly-in-string': 'error', - '@typescript-eslint/no-unsafe-assignment': 'warn', - '@typescript-eslint/no-unsafe-return': 'warn', - '@typescript-eslint/no-unsafe-member-access': 'warn', - '@typescript-eslint/no-unsafe-enum-comparison': 'warn', - '@typescript-eslint/no-unsafe-call': 'warn', - '@typescript-eslint/no-unsafe-argument': 'warn', - '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-floating-promises': 'warn', - 'prefer-object-spread': 'error', - 'prefer-template': 'error', - 'object-shorthand': 'error', - 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_' - } - ], - 'no-var': 'error', - 'no-unneeded-ternary': 'error', - 'no-undef-init': 'error', - 'no-new-wrappers': 'error', - 'no-bitwise': 'error', - 'prefer-const': 'error', - radix: 'error', - 'no-eval': 'error', - 'no-console': [ - 'error', - { - allow: ['warn'] - } - ], - 'id-denylist': ['warn', 'data', 'e', 'acc'], - 'arrow-body-style': ['error', 'as-needed'], - 'prefer-arrow-callback': 'error', - 'no-restricted-imports': 'off', - '@typescript-eslint/no-restricted-imports': 'error' - } + "error", + { + max: 10, + }, + ], + "consistent-return": "error", + "no-underscore-dangle": "error", + "default-case": "error", + "default-case-last": "error", + eqeqeq: "error", + "no-caller": "error", + "no-duplicate-imports": "error", + "no-sequences": [ + "error", + { + allowInParentheses: false, + }, + ], + "no-template-curly-in-string": "error", + "@typescript-eslint/no-unsafe-assignment": "warn", + "@typescript-eslint/no-unsafe-return": "warn", + "@typescript-eslint/no-unsafe-member-access": "warn", + "@typescript-eslint/no-unsafe-enum-comparison": "warn", + "@typescript-eslint/no-unsafe-call": "warn", + "@typescript-eslint/no-unsafe-argument": "warn", + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-floating-promises": "warn", + "prefer-object-spread": "error", + "prefer-template": "error", + "object-shorthand": "error", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + }, + ], + "no-var": "error", + "no-unneeded-ternary": "error", + "no-undef-init": "error", + "no-new-wrappers": "error", + "no-bitwise": "error", + "prefer-const": "error", + radix: "error", + "no-eval": "error", + "no-console": [ + "error", + { + allow: ["warn"], + }, + ], + "id-denylist": ["warn", "data", "e", "acc"], + "arrow-body-style": ["error", "as-needed"], + "prefer-arrow-callback": "error", + "no-restricted-imports": "off", + "@typescript-eslint/no-restricted-imports": "error", + }, }, { - files: ['**/*.html'], + files: ["**/*.html"], extends: [...AngularESLint.configs.templateAll], rules: { - '@angular-eslint/template/i18n': 'off', - '@angular-eslint/template/prefer-self-closing-tags': 'off' - } - } + "@angular-eslint/template/i18n": "off", + "@angular-eslint/template/prefer-self-closing-tags": "off", + }, + }, ); diff --git a/application/package.json b/application/package.json index 3968b68..74eb2ab 100644 --- a/application/package.json +++ b/application/package.json @@ -6,16 +6,15 @@ "ng": "ng", "start": "ng serve", "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "ng test", - "serve:ssr:frontend": "node dist/frontend/server/server.mjs", + "build_watch": "ng build --watch --configuration development --output-path dist-watch", "formatter_check": "prettier --config ./../lib-configurations/prettier/base.yaml --check .", "formatter_fix": "prettier --config ./../lib-configurations/prettier/base.yaml --write .", "linter:check": "ng lint", "linter:fix": "ng lint --fix", - "compiler:check": "tsc --project tsconfig.app.json --noEmit" + "compiler_check": "tsc --project tsconfig.json --noEmit" }, "dependencies": { + "@repo_/lib-background": "*", "@angular/animations": "^18.0.0", "@angular/common": "^18.0.0", "@angular/compiler": "^18.0.0", @@ -29,7 +28,6 @@ "@fontsource/bungee": "^5.0.0", "express": "^4.0.0", "rxjs": "~7.8.0", - "three": "^0.165.0", "tslib": "^2.0.0", "zone.js": "~0.14.0" }, diff --git a/application/src/app/background/background.service.ts b/application/src/app/background/background.service.ts index 9d412a8..4458ea9 100644 --- a/application/src/app/background/background.service.ts +++ b/application/src/app/background/background.service.ts @@ -1,10 +1,11 @@ import { Injectable, type OnDestroy } from '@angular/core'; +import { SceneContentManager } from '@repo_/lib-background'; import type { Dimensions } from '../declarations/dimensions.interface'; -import { SceneContentManager } from './scene/scene-content-manager'; @Injectable() export class BackgroundService implements OnDestroy { - private readonly sceneContentManager: SceneContentManager = new SceneContentManager(); + private readonly sceneContentManager: SceneContentManager = + new SceneContentManager(); public attachCanvas(canvas: HTMLCanvasElement): void { if (typeof window === 'undefined') { diff --git a/application/src/app/pages/referrals/referrals.component.html b/application/src/app/pages/referrals/referrals.component.html index e7f6e19..29e11c8 100644 --- a/application/src/app/pages/referrals/referrals.component.html +++ b/application/src/app/pages/referrals/referrals.component.html @@ -1,26 +1,33 @@
-

+

Sharing is caring

- Here is a list of wonderful tools that I rely on daily, both for work and beyond. I highly recommend them to you. + Here is a list of wonderful tools that I rely on daily, both for work and + beyond. I highly recommend them to you.

@for (referral of referrals; track referral.name) { + + diff --git a/application/tsconfig.app.json b/application/tsconfig.app.json deleted file mode 100644 index 9294a31..0000000 --- a/application/tsconfig.app.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./out-tsc/app", - "types": ["node"] - }, - "extends": "@repo_/lib-configurations/typescript/angular.json", - "files": ["src/main.ts", "src/main.server.ts", "server.ts"], - "include": ["src/**/*.d.ts"] -} diff --git a/application/tsconfig.json b/application/tsconfig.json index da7f7b7..9294a31 100644 --- a/application/tsconfig.json +++ b/application/tsconfig.json @@ -1,30 +1,9 @@ { - "compileOnSave": false, "compilerOptions": { - "outDir": "./dist/out-tsc", - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "skipLibCheck": true, - "esModuleInterop": true, - "sourceMap": true, - "declaration": false, - "experimentalDecorators": true, - "moduleResolution": "bundler", - "importHelpers": true, - "target": "ESNext", - "module": "ESNext", - "useDefineForClassFields": false, - "exactOptionalPropertyTypes": true, - "verbatimModuleSyntax": true, - "lib": ["ESNext", "dom"] + "outDir": "./out-tsc/app", + "types": ["node"] }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true - } + "extends": "@repo_/lib-configurations/typescript/angular.json", + "files": ["src/main.ts", "src/main.server.ts", "server.ts"], + "include": ["src/**/*.d.ts"] } diff --git a/application/turbo.json b/application/turbo.json index 73fb049..afac157 100644 --- a/application/turbo.json +++ b/application/turbo.json @@ -2,6 +2,21 @@ "$schema": "https://turbo.build/schema.json", "extends": ["//"], "tasks": { + "build": { + "dependsOn": ["^build"], + "inputs": ["./**/*.ts", "./**/*.html"], + "outputs": ["./dist/**"], + "outputLogs": "errors-only", + "cache": true + }, + "build_watch": { + "dependsOn": ["^build_watch"], + "inputs": ["./**/*.ts", "./**/*.html"], + "outputs": ["./dist-watch/**"], + "outputLogs": "errors-only", + "cache": false, + "persistent": true + }, "formatter_check": { "inputs": ["./**", "!.angular/**", "!./dist/**"] }, diff --git a/lib-background/package.json b/lib-background/package.json new file mode 100644 index 0000000..8052baa --- /dev/null +++ b/lib-background/package.json @@ -0,0 +1,30 @@ +{ + "name": "@repo_/lib-background", + "private": true, + "version": "1.0.0", + "types": "./src/api.ts", + "scripts": { + "build": "esbuild ./src/api.ts --bundle --platform=browser --minify --splitting --outdir=dist --format=esm --tree-shaking=true --legal-comments=external --sourcemap=external", + "build_watch": "esbuild ./src/api.ts --bundle --platform=browser --minify --splitting --outdir=dist-watch --format=esm --tree-shaking=true --legal-comments=none --sourcemap=external --watch", + "compiler_check": "tsc --project tsconfig.json --noEmit", + "formatter_check": "prettier --config ./prettier/base.yaml --check .", + "formatter_fix": "prettier --config ./prettier/base.yaml --write ." + }, + "dependencies": { + "three": "^0.165.0" + }, + "devDependencies": { + "@repo_/lib-configurations": "*", + "esbuild": "^0.23.0", + "@types/node": "*", + "eslint": "*", + "prettier": "*", + "typescript": "*", + "typescript-eslint": "*" + }, + "exports": [ + "./dist-watch/api.js", + "./dist/api.js", + "./src/api.ts" + ] +} diff --git a/lib-background/src/api.ts b/lib-background/src/api.ts new file mode 100644 index 0000000..961b304 --- /dev/null +++ b/lib-background/src/api.ts @@ -0,0 +1,4 @@ +import type { Dimensions } from './dimensions.interface'; +import { SceneContentManager } from './scene-content-manager'; + +export { SceneContentManager, type Dimensions }; diff --git a/lib-background/src/dimensions.interface.ts b/lib-background/src/dimensions.interface.ts new file mode 100644 index 0000000..d2ab6b0 --- /dev/null +++ b/lib-background/src/dimensions.interface.ts @@ -0,0 +1,4 @@ +export interface Dimensions { + readonly widthPx: number; + readonly heightPx: number; +} diff --git a/application/src/app/background/scene/grid-plane.ts b/lib-background/src/grid-plane.object.ts similarity index 78% rename from application/src/app/background/scene/grid-plane.ts rename to lib-background/src/grid-plane.object.ts index 3a8e106..9e51549 100644 --- a/application/src/app/background/scene/grid-plane.ts +++ b/lib-background/src/grid-plane.object.ts @@ -1,6 +1,6 @@ import { Mesh, PlaneGeometry } from 'three'; -import type { Dimensions } from '../../declarations/dimensions.interface'; -import { GridMaterial } from './resourses/grid.material'; +import type { Dimensions } from './dimensions.interface'; +import { GridMaterial } from './grid.material'; export class GridPlane extends Mesh { constructor(dimensions: Dimensions) { diff --git a/application/src/app/background/scene/resourses/grid.material.ts b/lib-background/src/grid.material.ts similarity index 89% rename from application/src/app/background/scene/resourses/grid.material.ts rename to lib-background/src/grid.material.ts index 888d5fb..164f577 100644 --- a/application/src/app/background/scene/resourses/grid.material.ts +++ b/lib-background/src/grid.material.ts @@ -1,5 +1,5 @@ import { Color, ShaderMaterial, Vector2, type IUniform } from 'three'; -import type { Dimensions } from '../../../declarations/dimensions.interface'; +import type { Dimensions } from './dimensions.interface'; const vertexShader: string = ` varying vec2 vUv; @@ -48,12 +48,12 @@ export class GridMaterial extends ShaderMaterial { uniforms: { shift: { value: 0.0 }, dimensions: { - value: new Vector2(widthPx, heightPx) + value: new Vector2(widthPx, heightPx), }, cellSize: { value: 50.0 }, lineThickness: { value: 0.01 }, - lineColor: { value: new Color(0xff5050) } - } + lineColor: { value: new Color(0xff5050) }, + }, }); } diff --git a/application/src/app/background/scene/render-loop.ts b/lib-background/src/render-loop.ts similarity index 74% rename from application/src/app/background/scene/render-loop.ts rename to lib-background/src/render-loop.ts index b66db9a..8f70bff 100644 --- a/application/src/app/background/scene/render-loop.ts +++ b/lib-background/src/render-loop.ts @@ -1,5 +1,5 @@ import { type Camera, Color, type Scene, WebGLRenderer } from 'three'; -import type { Dimensions } from '../../declarations/dimensions.interface'; +import type { Dimensions } from './dimensions.interface'; class NotInitializedError extends Error { constructor() { @@ -18,7 +18,7 @@ export class RenderLoop { constructor( private readonly scene: Scene, - private readonly camera: Camera + private readonly camera: Camera, ) {} public initialize(canvas: HTMLCanvasElement): void { @@ -28,7 +28,7 @@ export class RenderLoop { const webGLRenderer: WebGLRenderer = new WebGLRenderer({ canvas, - antialias: true + antialias: true, }); webGLRenderer.setClearColor(new Color(0x000000), 0); this.webGLRenderer = webGLRenderer; @@ -51,20 +51,24 @@ export class RenderLoop { this.webGLRenderer.setSize(widthPx, heightPx); } - public start(onRender?: (timeSinceLastFrameMs?: DOMHighResTimeStamp) => void): void { + public start( + onRender?: (timeSinceLastFrameMs?: DOMHighResTimeStamp) => void, + ): void { if (this.webGLRenderer === null) { throw new NotInitializedError(); } const webGLRenderer: WebGLRenderer = this.webGLRenderer; - webGLRenderer.setAnimationLoop((timeSinceLastFrameMs: DOMHighResTimeStamp) => { - webGLRenderer.render(this.scene, this.camera); + webGLRenderer.setAnimationLoop( + (timeSinceLastFrameMs: DOMHighResTimeStamp) => { + webGLRenderer.render(this.scene, this.camera); - if (typeof onRender !== 'function') { - return; - } - onRender(timeSinceLastFrameMs); - }); + if (typeof onRender !== 'function') { + return; + } + onRender(timeSinceLastFrameMs); + }, + ); } public stop(): void { diff --git a/application/src/app/background/scene/scene-content-manager.ts b/lib-background/src/scene-content-manager.ts similarity index 85% rename from application/src/app/background/scene/scene-content-manager.ts rename to lib-background/src/scene-content-manager.ts index 36c1965..506d1f4 100644 --- a/application/src/app/background/scene/scene-content-manager.ts +++ b/lib-background/src/scene-content-manager.ts @@ -1,6 +1,6 @@ import { AmbientLight, PerspectiveCamera, Scene } from 'three'; -import type { Dimensions } from '../../declarations/dimensions.interface'; -import { GridPlane } from './grid-plane'; +import type { Dimensions } from './dimensions.interface'; +import { GridPlane } from './grid-plane.object'; import { RenderLoop } from './render-loop'; export class SceneContentManager { @@ -8,7 +8,10 @@ export class SceneContentManager { private readonly scene: Scene = new Scene(); private gridPlane: GridPlane | null = null; - private readonly renderLoop: RenderLoop = new RenderLoop(this.scene, this.camera); + private readonly renderLoop: RenderLoop = new RenderLoop( + this.scene, + this.camera, + ); private isInitialized: boolean = false; @@ -36,7 +39,7 @@ export class SceneContentManager { this.renderLoop.initialize(canvas); const canvasDimensions: Dimensions = { widthPx: canvas.clientWidth, - heightPx: canvas.clientHeight + heightPx: canvas.clientHeight, }; this.setContainerSize(canvasDimensions); diff --git a/lib-background/tsconfig.json b/lib-background/tsconfig.json new file mode 100644 index 0000000..e7c87a9 --- /dev/null +++ b/lib-background/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@repo_/lib-configurations/typescript/base.json", + "include": ["src"] +} diff --git a/package-lock.json b/package-lock.json index fdb36a9..644c90a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,9 +35,9 @@ "@angular/router": "^18.0.0", "@angular/ssr": "^18.0.0", "@fontsource/bungee": "^5.0.0", + "@repo_/lib-background": "*", "express": "^4.0.0", "rxjs": "~7.8.0", - "three": "^0.165.0", "tslib": "^2.0.0", "zone.js": "~0.14.0" }, @@ -59,6 +59,453 @@ "typescript-eslint": "*" } }, + "lib-background": { + "name": "@repo_/lib-background", + "version": "1.0.0", + "dependencies": { + "three": "^0.165.0" + }, + "devDependencies": { + "@repo_/lib-configurations": "*", + "@types/node": "*", + "esbuild": "^0.23.0", + "eslint": "*", + "prettier": "*", + "typescript": "*", + "typescript-eslint": "*" + } + }, + "lib-background/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.0.tgz", + "integrity": "sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/android-arm": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.0.tgz", + "integrity": "sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/android-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.0.tgz", + "integrity": "sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/android-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.0.tgz", + "integrity": "sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.0.tgz", + "integrity": "sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/darwin-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.0.tgz", + "integrity": "sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.0.tgz", + "integrity": "sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.0.tgz", + "integrity": "sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-arm": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.0.tgz", + "integrity": "sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.0.tgz", + "integrity": "sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-ia32": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.0.tgz", + "integrity": "sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-loong64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.0.tgz", + "integrity": "sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.0.tgz", + "integrity": "sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.0.tgz", + "integrity": "sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.0.tgz", + "integrity": "sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-s390x": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.0.tgz", + "integrity": "sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/linux-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.0.tgz", + "integrity": "sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.0.tgz", + "integrity": "sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.0.tgz", + "integrity": "sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/sunos-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.0.tgz", + "integrity": "sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/win32-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.0.tgz", + "integrity": "sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/win32-ia32": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.0.tgz", + "integrity": "sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/@esbuild/win32-x64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.0.tgz", + "integrity": "sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "lib-background/node_modules/esbuild": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz", + "integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.0", + "@esbuild/android-arm": "0.23.0", + "@esbuild/android-arm64": "0.23.0", + "@esbuild/android-x64": "0.23.0", + "@esbuild/darwin-arm64": "0.23.0", + "@esbuild/darwin-x64": "0.23.0", + "@esbuild/freebsd-arm64": "0.23.0", + "@esbuild/freebsd-x64": "0.23.0", + "@esbuild/linux-arm": "0.23.0", + "@esbuild/linux-arm64": "0.23.0", + "@esbuild/linux-ia32": "0.23.0", + "@esbuild/linux-loong64": "0.23.0", + "@esbuild/linux-mips64el": "0.23.0", + "@esbuild/linux-ppc64": "0.23.0", + "@esbuild/linux-riscv64": "0.23.0", + "@esbuild/linux-s390x": "0.23.0", + "@esbuild/linux-x64": "0.23.0", + "@esbuild/netbsd-x64": "0.23.0", + "@esbuild/openbsd-arm64": "0.23.0", + "@esbuild/openbsd-x64": "0.23.0", + "@esbuild/sunos-x64": "0.23.0", + "@esbuild/win32-arm64": "0.23.0", + "@esbuild/win32-ia32": "0.23.0", + "@esbuild/win32-x64": "0.23.0" + } + }, "lib-configurations": { "name": "@repo_/lib-configurations", "version": "1.0.0", @@ -3160,6 +3607,23 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.0.tgz", + "integrity": "sha512-suXjq53gERueVWu0OKxzWqk7NxiUWSUlrxoZK7usiF50C6ipColGR5qie2496iKGYNLhDZkPxBI3erbnYkU0rQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.3.tgz", @@ -4452,6 +4916,10 @@ "resolved": "application", "link": true }, + "node_modules/@repo_/lib-background": { + "resolved": "lib-background", + "link": true + }, "node_modules/@repo_/lib-configurations": { "resolved": "lib-configurations", "link": true diff --git a/package.json b/package.json index 58a000d..8612916 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,11 @@ "private": true, "version": "1.0.0", "scripts": { + "🏗️": "Building", + "build": "npm run turbo build", + "build_watch": "npm run turbo build_watch", + "🤖": "Static Analysis", + "compiler_check": "npm run turbo compiler_check", "💅": "Formatting", "formatter_check": "npm run turbo formatter_check", "formatter_check:root": "prettier --config ./lib-configurations/prettier/base.yaml --check ./*.*", diff --git a/turbo.json b/turbo.json index 8484919..085bd9e 100644 --- a/turbo.json +++ b/turbo.json @@ -2,6 +2,27 @@ "$schema": "https://turbo.build/schema.json", "globalDependencies": ["!.turbo/**", "!node_modules/**"], "tasks": { + "build": { + "dependsOn": [], + "inputs": ["./**/*.ts"], + "outputs": ["./dist/**"], + "outputLogs": "errors-only", + "cache": true + }, + "build_watch": { + "dependsOn": [], + "inputs": ["./**/*.ts"], + "outputs": ["./dist-watch/**"], + "outputLogs": "errors-only", + "cache": false, + "persistent": true + }, + "compiler_check": { + "dependsOn": [], + "inputs": ["./**/*.ts"], + "outputs": [], + "outputLogs": "errors-only" + }, "formatter_check": { "dependsOn": ["//#formatter_check:root"], "inputs": ["./**"],