Angular cleanup.

This commit is contained in:
Roger Far 2025-03-21 15:31:34 -06:00
parent b3f45ece20
commit 53a1407ef8
9 changed files with 49 additions and 31 deletions

14
client/.ncurc.js Normal file
View file

@ -0,0 +1,14 @@
const minorOnly = [];
const patchOnly = [];
module.exports = {
target: (name) => {
if (minorOnly.indexOf(name) > -1) {
return 'minor';
}
if (patchOnly.indexOf(name) > -1) {
return 'patch';
}
return 'latest';
}
};

View file

@ -57,8 +57,8 @@
"budgets": [ "budgets": [
{ {
"type": "initial", "type": "initial",
"maximumWarning": "500kb", "maximumWarning": "2mb",
"maximumError": "1mb" "maximumError": "2mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",

View file

@ -22,7 +22,7 @@
"bulma": "^1.0.3", "bulma": "^1.0.3",
"curray": "^1.0.12", "curray": "^1.0.12",
"file-saver-es": "^2.0.5", "file-saver-es": "^2.0.5",
"ngx-filesize": "^3.0.5", "filesize": "^10.1.6",
"rxjs": "^7.8.2", "rxjs": "^7.8.2",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"zone.js": "^0.15.0" "zone.js": "^0.15.0"
@ -5284,13 +5284,12 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/filesize": { "node_modules/filesize": {
"version": "9.0.11", "version": "10.1.6",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-9.0.11.tgz", "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.6.tgz",
"integrity": "sha512-gTAiTtI0STpKa5xesyTA9hA3LX4ga8sm2nWRcffEa1L/5vQwb4mj2MdzMkoHoGv4QzfDshQZuYscQSf8c4TKOA==", "integrity": "sha512-sJslQKU2uM33qH5nqewAwVB2QgR6w1aMNsYUp3aN5rMRyXEwJGmZvaWzeJFNTOXWlHQyBFCWrdj3fV/fsTOX8w==",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peer": true,
"engines": { "engines": {
"node": ">= 0.4.0" "node": ">= 10.4.0"
} }
}, },
"node_modules/fill-range": { "node_modules/fill-range": {
@ -6576,20 +6575,6 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/ngx-filesize": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/ngx-filesize/-/ngx-filesize-3.0.5.tgz",
"integrity": "sha512-Q9xM7Wp/RkhLWOGRnY3D2hPlpX/6WJpr7m84xSJJKTlqRXfK4FaFL3fbuuLvF09I8s/UL6httGLIrbTB9UDGJA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": ">= 14.2.0 < 20.0.0",
"@angular/core": ">= 14.2.0 < 20.0.0",
"filesize": ">= 6.0.0 < 10.0.0"
}
},
"node_modules/node-addon-api": { "node_modules/node-addon-api": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",

View file

@ -26,7 +26,7 @@
"bulma": "^1.0.3", "bulma": "^1.0.3",
"curray": "^1.0.12", "curray": "^1.0.12",
"file-saver-es": "^2.0.5", "file-saver-es": "^2.0.5",
"ngx-filesize": "^3.0.5", "filesize": "^10.1.6",
"rxjs": "^7.8.2", "rxjs": "^7.8.2",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"zone.js": "^0.15.0" "zone.js": "^0.15.0"

View file

@ -1,11 +1,10 @@
import 'curray';
import { ClipboardModule } from '@angular/cdk/clipboard'; import { ClipboardModule } from '@angular/cdk/clipboard';
import { APP_BASE_HREF } from '@angular/common'; import { APP_BASE_HREF } from '@angular/common';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { curray } from 'curray';
import { FileSizePipe, NgxFilesizeModule } from 'ngx-filesize';
import { AddNewTorrentComponent } from './add-new-torrent/add-new-torrent.component'; import { AddNewTorrentComponent } from './add-new-torrent/add-new-torrent.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -23,8 +22,7 @@ import { TorrentStatusPipe } from './torrent-status.pipe';
import { TorrentTableComponent } from './torrent-table/torrent-table.component'; import { TorrentTableComponent } from './torrent-table/torrent-table.component';
import { TorrentComponent } from './torrent/torrent.component'; import { TorrentComponent } from './torrent/torrent.component';
import { SortPipe } from './sort.pipe'; import { SortPipe } from './sort.pipe';
import { FileSizePipe } from './filesize.pipe';
curray();
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -43,9 +41,10 @@ curray();
ProfileComponent, ProfileComponent,
Nl2BrPipe, Nl2BrPipe,
SortPipe, SortPipe,
FileSizePipe,
], ],
bootstrap: [AppComponent], bootstrap: [AppComponent],
imports: [BrowserModule, AppRoutingModule, FormsModule, NgxFilesizeModule, ClipboardModule], imports: [BrowserModule, AppRoutingModule, FormsModule, ClipboardModule],
providers: [ providers: [
FileSizePipe, FileSizePipe,
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },

View file

@ -1,6 +1,6 @@
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { FileSizePipe } from 'ngx-filesize';
import { Download } from './models/download.model'; import { Download } from './models/download.model';
import { FileSizePipe } from './filesize.pipe';
@Pipe({ @Pipe({
name: 'downloadStatus', name: 'downloadStatus',

View file

@ -0,0 +1,20 @@
import { Pipe, PipeTransform } from '@angular/core';
import { filesize } from 'filesize';
@Pipe({
name: 'filesize',
standalone: false,
})
export class FileSizePipe implements PipeTransform {
private static transformOne(value: number, options?: any): string {
return filesize(value, options).toString();
}
transform(value: number | number[], options?: any) {
if (Array.isArray(value)) {
return value.map((val) => FileSizePipe.transformOne(val, options));
}
return FileSizePipe.transformOne(value, options);
}
}

View file

@ -1,6 +1,6 @@
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { FileSizePipe } from 'ngx-filesize';
import { RealDebridStatus, Torrent } from './models/torrent.model'; import { RealDebridStatus, Torrent } from './models/torrent.model';
import { FileSizePipe } from './filesize.pipe';
@Pipe({ @Pipe({
name: 'status', name: 'status',

View file

@ -1,2 +1,2 @@
@forward "../node_modules/bulma/bulma.sass"; @forward "../node_modules/bulma/bulma.scss";
@forward "../node_modules/@fortawesome/fontawesome-free/css/all.css"; @forward "../node_modules/@fortawesome/fontawesome-free/css/all.css";