diff --git a/apps/NwaifuAnime/.eslintrc.json b/apps/NwaifuAnime/.eslintrc.json new file mode 100644 index 0000000..437641b --- /dev/null +++ b/apps/NwaifuAnime/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "app", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/apps/NwaifuAnime/ngsw-config.json b/apps/NwaifuAnime/ngsw-config.json new file mode 100644 index 0000000..422d480 --- /dev/null +++ b/apps/NwaifuAnime/ngsw-config.json @@ -0,0 +1,29 @@ +{ + "$schema": "../../node_modules/@angular/service-worker/config/schema.json", + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": [ + "/favicon.ico", + "/index.html", + "/manifest.webmanifest", + "/*.css", + "/*.js" + ] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": [ + "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)" + ] + } + } + ] +} diff --git a/apps/NwaifuAnime/project.json b/apps/NwaifuAnime/project.json new file mode 100644 index 0000000..8fc4abd --- /dev/null +++ b/apps/NwaifuAnime/project.json @@ -0,0 +1,75 @@ +{ + "name": "NwaifuAnime", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "prefix": "app", + "sourceRoot": "apps/NwaifuAnime/src", + "tags": [], + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:application", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/NwaifuAnime", + "index": "apps/NwaifuAnime/src/index.html", + "browser": "apps/NwaifuAnime/src/main.ts", + "polyfills": ["zone.js"], + "tsConfig": "apps/NwaifuAnime/tsconfig.app.json", + "inlineStyleLanguage": "less", + "assets": [ + { + "glob": "**/*", + "input": "apps/NwaifuAnime/public" + } + ], + "styles": ["apps/NwaifuAnime/src/styles.less"], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "outputHashing": "all", + "serviceWorker": "apps/NwaifuAnime/ngsw-config.json" + }, + "development": { + "optimization": false, + "extractLicenses": false, + "sourceMap": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "NwaifuAnime:build:production" + }, + "development": { + "buildTarget": "NwaifuAnime:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "NwaifuAnime:build" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/apps/NwaifuAnime/public/favicon.ico b/apps/NwaifuAnime/public/favicon.ico new file mode 100644 index 0000000..317ebcb Binary files /dev/null and b/apps/NwaifuAnime/public/favicon.ico differ diff --git a/apps/NwaifuAnime/public/icons/icon-128x128.png b/apps/NwaifuAnime/public/icons/icon-128x128.png new file mode 100644 index 0000000..5a9a2cc Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-128x128.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-144x144.png b/apps/NwaifuAnime/public/icons/icon-144x144.png new file mode 100644 index 0000000..11702cd Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-144x144.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-152x152.png b/apps/NwaifuAnime/public/icons/icon-152x152.png new file mode 100644 index 0000000..ff4e06b Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-152x152.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-192x192.png b/apps/NwaifuAnime/public/icons/icon-192x192.png new file mode 100644 index 0000000..afd36a4 Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-192x192.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-384x384.png b/apps/NwaifuAnime/public/icons/icon-384x384.png new file mode 100644 index 0000000..613ac79 Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-384x384.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-512x512.png b/apps/NwaifuAnime/public/icons/icon-512x512.png new file mode 100644 index 0000000..7574990 Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-512x512.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-72x72.png b/apps/NwaifuAnime/public/icons/icon-72x72.png new file mode 100644 index 0000000..033724e Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-72x72.png differ diff --git a/apps/NwaifuAnime/public/icons/icon-96x96.png b/apps/NwaifuAnime/public/icons/icon-96x96.png new file mode 100644 index 0000000..3090dc2 Binary files /dev/null and b/apps/NwaifuAnime/public/icons/icon-96x96.png differ diff --git a/apps/NwaifuAnime/public/manifest.webmanifest b/apps/NwaifuAnime/public/manifest.webmanifest new file mode 100644 index 0000000..1258736 --- /dev/null +++ b/apps/NwaifuAnime/public/manifest.webmanifest @@ -0,0 +1,59 @@ +{ + "name": "NwaifuAnime", + "short_name": "NwaifuAnime", + "theme_color": "#1976d2", + "background_color": "#fafafa", + "display": "standalone", + "scope": "./", + "start_url": "./", + "icons": [ + { + "src": "icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable any" + } + ] +} diff --git a/apps/NwaifuAnime/src/app/app.component.html b/apps/NwaifuAnime/src/app/app.component.html new file mode 100644 index 0000000..c65e554 --- /dev/null +++ b/apps/NwaifuAnime/src/app/app.component.html @@ -0,0 +1,7 @@ +@if (hasUpdate) { +

Update available

+ +} @else { +

Update not available

+} + diff --git a/apps/NwaifuAnime/src/app/app.component.less b/apps/NwaifuAnime/src/app/app.component.less new file mode 100644 index 0000000..e69de29 diff --git a/apps/NwaifuAnime/src/app/app.component.ts b/apps/NwaifuAnime/src/app/app.component.ts new file mode 100644 index 0000000..59e55c5 --- /dev/null +++ b/apps/NwaifuAnime/src/app/app.component.ts @@ -0,0 +1,25 @@ +import { Component } from "@angular/core"; +import { RouterModule } from "@angular/router"; +import { AppService } from "./app.service"; +import { NxWelcomeComponent } from "./nx-welcome.component"; + +@Component({ + standalone: true, + imports: [NxWelcomeComponent, RouterModule], + selector: "app-root", + templateUrl: "./app.component.html", + styleUrl: "./app.component.less", + providers: [AppService], +}) +export class AppComponent { + title = "NwaifuAnime"; + constructor(private sw: AppService) {} + + get hasUpdate() { + return this.sw.isUpdateAvailable; + } + + update() { + this.sw.update(); + } +} diff --git a/apps/NwaifuAnime/src/app/app.config.ts b/apps/NwaifuAnime/src/app/app.config.ts new file mode 100644 index 0000000..f7d7b52 --- /dev/null +++ b/apps/NwaifuAnime/src/app/app.config.ts @@ -0,0 +1,11 @@ +import { ApplicationConfig, provideZoneChangeDetection, isDevMode } from "@angular/core"; +import { provideRouter } from "@angular/router"; +import { appRoutes } from "./app.routes"; +import { provideServiceWorker } from '@angular/service-worker'; + +export const appConfig: ApplicationConfig = { + providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(appRoutes), provideServiceWorker('ngsw-worker.js', { + enabled: !isDevMode(), + registrationStrategy: 'registerWhenStable:30000' + })], +}; diff --git a/apps/NwaifuAnime/src/app/app.routes.ts b/apps/NwaifuAnime/src/app/app.routes.ts new file mode 100644 index 0000000..0b3d5da --- /dev/null +++ b/apps/NwaifuAnime/src/app/app.routes.ts @@ -0,0 +1,3 @@ +import { Route } from "@angular/router"; + +export const appRoutes: Route[] = []; diff --git a/apps/NwaifuAnime/src/app/app.service.ts b/apps/NwaifuAnime/src/app/app.service.ts new file mode 100644 index 0000000..d3e1e97 --- /dev/null +++ b/apps/NwaifuAnime/src/app/app.service.ts @@ -0,0 +1,34 @@ +import { Injectable } from "@angular/core"; +import { SwUpdate } from "@angular/service-worker"; + +@Injectable({ providedIn: "root" }) +export class AppService { + private hasUpdate = false; + constructor(private sw: SwUpdate) { + console.log("service init"); + this.sw.checkForUpdate(); + + this.sw.versionUpdates.subscribe((ev) => { + if (ev.type == "VERSION_DETECTED") { + console.log("update detected"); + this.hasUpdate = true; + } else { + console.log("no update"); + } + }); + } + + get isUpdateAvailable() { + return this.hasUpdate; + } + + update() { + this.sw.activateUpdate().then((res) => { + if (res) { + console.log("updated"); + this.hasUpdate = false; + window.location.reload(); + } + }); + } +} diff --git a/apps/NwaifuAnime/src/app/nx-welcome.component.ts b/apps/NwaifuAnime/src/app/nx-welcome.component.ts new file mode 100644 index 0000000..a396ec6 --- /dev/null +++ b/apps/NwaifuAnime/src/app/nx-welcome.component.ts @@ -0,0 +1,965 @@ +import { CommonModule } from "@angular/common"; +import { Component, ViewEncapsulation } from "@angular/core"; + +@Component({ + selector: "app-nx-welcome", + standalone: true, + imports: [CommonModule], + template: ` + + +
+
+ +
+

+ Hello there, + Welcome NwaifuAnime 👋 +

+
+ +
+
+

+ + + + You're up and running +

+ What's next? +
+
+ + + +
+
+ + + +
+

Next steps

+

Here are some things you can do with Nx:

+
+ + + + + Add UI library + +
# Generate UI lib
+nx g @nx/angular:lib ui
+# Add a component
+nx g @nx/angular:component ui/src/lib/button
+
+
+ + + + + View project details + +
nx show project NwaifuAnime --web
+
+
+ + + + + View interactive project graph + +
nx graph
+
+
+ + + + + Run affected commands + +
# 's been affected by changes
+nx affected:graph
+# run tests for current changes
+nx affected:test
+# run e2e tests for current changes
+nx affected:e2e
+
+
+

+ Carefully crafted with + + + +

+
+
+ `, + styles: [], + encapsulation: ViewEncapsulation.None, +}) +export class NxWelcomeComponent {} diff --git a/apps/NwaifuAnime/src/index.html b/apps/NwaifuAnime/src/index.html new file mode 100644 index 0000000..6b7f2f5 --- /dev/null +++ b/apps/NwaifuAnime/src/index.html @@ -0,0 +1,16 @@ + + + + + NwaifuAnime + + + + + + + + + + + diff --git a/apps/NwaifuAnime/src/main.ts b/apps/NwaifuAnime/src/main.ts new file mode 100644 index 0000000..9318a44 --- /dev/null +++ b/apps/NwaifuAnime/src/main.ts @@ -0,0 +1,5 @@ +import { bootstrapApplication } from "@angular/platform-browser"; +import { appConfig } from "./app/app.config"; +import { AppComponent } from "./app/app.component"; + +bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); diff --git a/apps/NwaifuAnime/src/styles.less b/apps/NwaifuAnime/src/styles.less new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/apps/NwaifuAnime/src/styles.less @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/NwaifuAnime/tsconfig.app.json b/apps/NwaifuAnime/tsconfig.app.json new file mode 100644 index 0000000..fff4a41 --- /dev/null +++ b/apps/NwaifuAnime/tsconfig.app.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": ["src/main.ts"], + "include": ["src/**/*.d.ts"], + "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] +} diff --git a/apps/NwaifuAnime/tsconfig.editor.json b/apps/NwaifuAnime/tsconfig.editor.json new file mode 100644 index 0000000..a8ac182 --- /dev/null +++ b/apps/NwaifuAnime/tsconfig.editor.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "compilerOptions": {}, + "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] +} diff --git a/apps/NwaifuAnime/tsconfig.json b/apps/NwaifuAnime/tsconfig.json new file mode 100644 index 0000000..a28fec9 --- /dev/null +++ b/apps/NwaifuAnime/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.editor.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/apps/NwaifuAnime/tsconfig.spec.json b/apps/NwaifuAnime/tsconfig.spec.json new file mode 100644 index 0000000..7870b7c --- /dev/null +++ b/apps/NwaifuAnime/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/bun.lockb b/bun.lockb index 806ccec..b4c4712 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 2483f1b..926802c 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@angular/platform-browser": "18.0.3", "@angular/platform-browser-dynamic": "18.0.3", "@angular/router": "18.0.3", + "@angular/service-worker": "18.0.3", "@fortawesome/angular-fontawesome": "0.14.1", "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-brands-svg-icons": "^6.4.2",