diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..70e8992 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +node_modules +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +Makefile +helm-charts +.env +.editorconfig +.idea +.angular +.nx +tmp +dist +coverage* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4030856 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# use the official Bun image +# see all versions at https://hub.docker.com/r/oven/bun/tags +FROM oven/bun:1 AS base +WORKDIR /usr/src/app +RUN apt-get update && \ + apt-get install -y \ + git \ + unzip + +# install dependencies into temp directory +# this will cache them and speed up future builds +FROM base AS builder +COPY package.json bun.lockb ./ +RUN bun install --frozen-lockfile +COPY . . +# Currently hangs because of https://github.com/nrwl/nx/issues/27494 +RUN export NX_DAEMON=false NX_ISOLATE_PLUGINS=false && \ + bun run build + +# copy compiled code into final image +FROM base AS release +# Don't know yet if having node_modules in the final image is needed. +# If it is, we probably should install a production version +# of our dependencies in the builder stage and copy them here. +# COPY --from=builder /usr/src/app/node_modules ./node_modules +COPY --from=builder /usr/src/app/dist . +COPY --from=builder /usr/src/app/package.json . + +# run the app +USER bun +EXPOSE 4200/tcp +ENTRYPOINT [ "bun", "dist/apps/home/server/server.mjs" ] \ No newline at end of file diff --git a/apps/home/src/app/shared/rxjs/cache.spec.ts b/apps/home/src/app/shared/rxjs/cache.spec.ts deleted file mode 100644 index 28bd863..0000000 --- a/apps/home/src/app/shared/rxjs/cache.spec.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { of, throwError } from 'rxjs'; -import { delay } from 'rxjs/operators'; -import { cache, CacheOptions } from './cache'; - -describe('cache operator', () => { - it('should cache the result of the observable', (done) => { - const callback = jest.fn(() => of('test').pipe(delay(100))); - const options: CacheOptions = {}; - - const cached$ = cache(callback, options); - - let callCount = 0; - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(1); - callCount++; - if (callCount === 2) { - done(); - } - }); - - // Subscribe again to ensure the cached value is used - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(1); - callCount++; - if (callCount === 2) { - done(); - } - }); - }); - - it('should handle errors correctly', (done) => { - const callback = jest.fn(() => throwError(() => new Error('test error'))); - const options: CacheOptions = {}; - - const cached$ = cache(callback, options); - - cached$.subscribe({ - next: () => ({}), - error: (err) => { - expect(err.message).toBe('test error'); - expect(callback).toHaveBeenCalledTimes(1); - done(); - }, - complete: () => ({}), - }); - }); - - it('should not call the callback again if the cache is still valid', (done) => { - const callback = jest.fn(() => of('test').pipe(delay(100))); - const options: CacheOptions = {}; - - const cached$ = cache(callback, options); - - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(1); - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(1); - done(); - }); - }); - }); - - it('should call the callback again if the cache is invalidated', (done) => { - const callback = jest.fn(() => of('test').pipe(delay(100))); - const options: CacheOptions = { expirationTime: 50 }; - - const cached$ = cache(callback, options); - - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(1); - setTimeout(() => { - cached$.subscribe((value) => { - expect(value).toBe('test'); - expect(callback).toHaveBeenCalledTimes(2); - done(); - }); - }, 100); - }); - }); -}); diff --git a/nx.json b/nx.json index 438626a..8d9c355 100644 --- a/nx.json +++ b/nx.json @@ -56,15 +56,15 @@ } }, "plugins": [ - { - "plugin": "@nx/cypress/plugin", - "options": { - "targetName": "e2e", - "openTargetName": "open-cypress", - "componentTestingTargetName": "component-test", - "ciTargetName": "e2e-ci" - } - }, + // { + // "plugin": "@nx/cypress/plugin", + // "options": { + // "targetName": "e2e", + // "openTargetName": "open-cypress", + // "componentTestingTargetName": "component-test", + // "ciTargetName": "e2e-ci" + // } + // }, { "plugin": "@nx/eslint/plugin", "options": { diff --git a/tools/builder/package.json b/tools/builder/package.json index 40812a0..312eac8 100644 --- a/tools/builder/package.json +++ b/tools/builder/package.json @@ -2,8 +2,8 @@ "name": "@home/builder", "version": "0.0.1", "dependencies": { - "@angular-devkit/architect": "0.1900.7", - "@angular-devkit/core": "19.0.7", + "@angular-devkit/architect": "0.1901.5", + "@angular-devkit/core": "19.1.5", "esbuild": "^0.24.0", "rxjs": "~7.8.1", "tslib": "^2.3.0"