From 3776940960cfb61e6292bbe8af5dc9f56bde195e Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 4 Jun 2021 19:00:30 -0400 Subject: [PATCH 01/11] created UI for export --- .../package-detailed.component.html | 5 +- .../export-package.component.html | 21 +++++- .../export-package.component.scss | 71 +++++++++++++++++++ .../export-package.component.ts | 18 +++-- 4 files changed, 106 insertions(+), 9 deletions(-) diff --git a/src/app/home/package-detailed/package-detailed.component.html b/src/app/home/package-detailed/package-detailed.component.html index 7ecba87..65f109e 100644 --- a/src/app/home/package-detailed/package-detailed.component.html +++ b/src/app/home/package-detailed/package-detailed.component.html @@ -6,9 +6,10 @@ [routerLink]="['/create-package', package.id]"> - + diff --git a/src/app/import/export-package/export-package.component.html b/src/app/import/export-package/export-package.component.html index 1cf3d8d..b844022 100644 --- a/src/app/import/export-package/export-package.component.html +++ b/src/app/import/export-package/export-package.component.html @@ -1 +1,20 @@ -

export-package works!

+
+
+ + + + +
+

Export package

+
+ +
+ + +
OR
+ + Save as file + +
+
+
diff --git a/src/app/import/export-package/export-package.component.scss b/src/app/import/export-package/export-package.component.scss index e69de29..d537818 100644 --- a/src/app/import/export-package/export-package.component.scss +++ b/src/app/import/export-package/export-package.component.scss @@ -0,0 +1,71 @@ +.close { + float: right; + + width: 33px; + height: 33px; + + color: whitesmoke; + border: 2px solid rgb(58, 58, 59); + border-radius: 100px; + text-decoration: none; + + & fa-icon { + position: relative; + top: 4px; + left: 9px; + } + + &:hover { + background-color: rgb(58, 58, 59); + } +} + +.export-package { + color: whitesmoke; + height: 100%; + + &__content { + width: 700px; + margin: auto; + padding: 20px; + } + + &__header { + // outline: 1px dotted purple; + + height: 60px; + width: calc(100%); + + &__title { + //padding: 15px 0 0 15px; + font-size: 1.2em; + } + } +} + +.text-package { + display: block; + width: 100%; + height: 200px; +} + + +.button { + color: whitesmoke; + display: block; + // float: right; + margin: auto; + margin-top: 30px; + width: 150px; + text-align: center; + border-radius: 5px; + border: 1px solid white; + padding: 10px; + text-decoration: none; +} + +.separator { + text-align: center; + font-size: 1.2em; + margin-top: 30px; +} \ No newline at end of file diff --git a/src/app/import/export-package/export-package.component.ts b/src/app/import/export-package/export-package.component.ts index bffa909..a653c52 100644 --- a/src/app/import/export-package/export-package.component.ts +++ b/src/app/import/export-package/export-package.component.ts @@ -1,15 +1,21 @@ import { Component, OnInit } from '@angular/core'; +import { faTimes } from '@fortawesome/free-solid-svg-icons'; @Component({ - selector: 'app-export-package', - templateUrl: './export-package.component.html', - styleUrls: ['./export-package.component.scss'] + selector: 'app-export-package', + templateUrl: './export-package.component.html', + styleUrls: ['./export-package.component.scss'] }) export class ExportPackageComponent implements OnInit { + faTimes = faTimes; + + constructor() { } - constructor() { } + ngOnInit(): void { + } - ngOnInit(): void { - } + saveFile(): boolean { + return false; + } } From c7ea1f90f2d6ade5ecb8fbf154bc9dea9c24852e Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 5 Jun 2021 03:27:54 -0400 Subject: [PATCH 02/11] exportation is working --- .../export-package.component.html | 3 +- .../export-package.component.scss | 5 +- .../export-package.component.ts | 75 ++++++++++++++++++- 3 files changed, 76 insertions(+), 7 deletions(-) diff --git a/src/app/import/export-package/export-package.component.html b/src/app/import/export-package/export-package.component.html index b844022..204dfa5 100644 --- a/src/app/import/export-package/export-package.component.html +++ b/src/app/import/export-package/export-package.component.html @@ -9,7 +9,8 @@

Export package

- +
COPY TEXT
+
OR
diff --git a/src/app/import/export-package/export-package.component.scss b/src/app/import/export-package/export-package.component.scss index d537818..d85f5d6 100644 --- a/src/app/import/export-package/export-package.component.scss +++ b/src/app/import/export-package/export-package.component.scss @@ -46,7 +46,8 @@ .text-package { display: block; width: 100%; - height: 200px; + height: 170px; + margin-top: 10px; } @@ -66,6 +67,6 @@ .separator { text-align: center; - font-size: 1.2em; + font-size: 1em; margin-top: 30px; } \ No newline at end of file diff --git a/src/app/import/export-package/export-package.component.ts b/src/app/import/export-package/export-package.component.ts index a653c52..8845dd7 100644 --- a/src/app/import/export-package/export-package.component.ts +++ b/src/app/import/export-package/export-package.component.ts @@ -1,21 +1,88 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Subscription } from 'rxjs'; import { faTimes } from '@fortawesome/free-solid-svg-icons'; +import { DomainService } from '../../core/services/domain.service'; +import { ElectronService } from '../../core/services/electron/electron.service'; + @Component({ selector: 'app-export-package', templateUrl: './export-package.component.html', styleUrls: ['./export-package.component.scss'] }) -export class ExportPackageComponent implements OnInit { +export class ExportPackageComponent implements OnInit, OnDestroy { faTimes = faTimes; - - constructor() { } + + sub: Subscription; + + exportablePackage: ExportablePackage; + json: string; + + constructor( + private electronService: ElectronService, + private activatedRoute: ActivatedRoute, + private domainService: DomainService + ) { } ngOnInit(): void { + this.sub = this.activatedRoute.params.subscribe(params => { + const id = params['id']; + if (id) { + const p = this.domainService.getPackages().find(x => x.id === id); + this.exportablePackage = new ExportablePackage(); + + this.exportablePackage.id = p.id; + this.exportablePackage.name = p.name; + this.exportablePackage.description = p.description; + this.exportablePackage.githubOwner = p.githubOwner; + this.exportablePackage.githubRepo = p.githubRepo; + this.exportablePackage.assetName = p.assetName; + this.exportablePackage.isPrerelease = p.isPrerelease; + this.exportablePackage.versionPatternToRemove = p.versionPatternToRemove; + this.exportablePackage.folderName = p.folderName; + this.exportablePackage.illustration = p.illustration; + this.exportablePackage.summary = p.summary; + this.exportablePackage.webpageUrl = p.webpageUrl; + this.exportablePackage.oldFolderNames = p.oldFolderNames; + + this.json = JSON.stringify(this.exportablePackage); + } + }); + } + + ngOnDestroy(): void { + if (this.sub) this.sub.unsubscribe(); } saveFile(): boolean { + const res = this.electronService.remote.dialog.showSaveDialogSync( + { + title: 'Select the export file', + defaultPath: `${this.exportablePackage.folderName}.json`, + filters: [{ name: 'Json', extensions: ['json'] }], + + }); + + if (res) { + this.electronService.fs.writeFileSync(res, this.json, 'utf-8'); + } return false; } +} +export class ExportablePackage { + public id: string; + public name: string; + public description: string; + public githubOwner: string; + public githubRepo: string; + public assetName: string; + public isPrerelease: boolean; + public versionPatternToRemove: string; + public folderName: string; + public illustration: string; + public summary: string; + public webpageUrl: string; + public oldFolderNames: string[]; } From 6e5bac48785f6361e99afc34b7fdc413cb47d2b3 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 5 Jun 2021 04:41:01 -0400 Subject: [PATCH 03/11] starting import packages --- src/app/import/add-package.component.html | 6 +-- .../import-package.component.html | 23 ++++++++- .../import-package.component.scss | 50 +++++++++++++++++++ .../import-package.component.ts | 34 ++++++++++--- src/app/import/import-routing.module.ts | 2 +- 5 files changed, 102 insertions(+), 13 deletions(-) diff --git a/src/app/import/add-package.component.html b/src/app/import/add-package.component.html index f39eb88..9d6654b 100644 --- a/src/app/import/add-package.component.html +++ b/src/app/import/add-package.component.html @@ -3,12 +3,12 @@ Create a new Package - + Cancel diff --git a/src/app/import/import-package/import-package.component.html b/src/app/import/import-package/import-package.component.html index 9a34a6f..9ff1f93 100644 --- a/src/app/import/import-package/import-package.component.html +++ b/src/app/import/import-package/import-package.component.html @@ -1 +1,22 @@ -

import-package works!

+
+
+ + + + +
+

Import json filetext package

+
+ +
WARNING: Only import packages from trusted sources.
+ Downloading blindly files from the web can lead to installing viruses, getting cryptolocked, seeing your computer dansing the Macarena and being bullied for being stupid.
+ Don't do that.
+ +
+ JSON +
+
+ FILE +
+
+
diff --git a/src/app/import/import-package/import-package.component.scss b/src/app/import/import-package/import-package.component.scss index e69de29..c65b35b 100644 --- a/src/app/import/import-package/import-package.component.scss +++ b/src/app/import/import-package/import-package.component.scss @@ -0,0 +1,50 @@ +.close { + float: right; + + width: 33px; + height: 33px; + + color: whitesmoke; + border: 2px solid rgb(58, 58, 59); + border-radius: 100px; + text-decoration: none; + + & fa-icon { + position: relative; + top: 4px; + left: 9px; + } + + &:hover { + background-color: rgb(58, 58, 59); + } +} + +.import-package { + color: whitesmoke; + height: 100%; + + &__content { + width: 700px; + margin: auto; + padding: 20px; + } + + &__header { + // outline: 1px dotted purple; + + height: 60px; + width: calc(100%); + + &__title { + //padding: 15px 0 0 15px; + font-size: 1.2em; + } + } +} + +.warning { + &__title { + color: orange; + } +} \ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index c797743..27ccbaf 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -1,15 +1,33 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Subscription } from 'rxjs'; +import { faTimes } from '@fortawesome/free-solid-svg-icons'; @Component({ - selector: 'app-import-package', - templateUrl: './import-package.component.html', - styleUrls: ['./import-package.component.scss'] + selector: 'app-import-package', + templateUrl: './import-package.component.html', + styleUrls: ['./import-package.component.scss'] }) -export class ImportPackageComponent implements OnInit { +export class ImportPackageComponent implements OnInit, OnDestroy { + faTimes = faTimes; + + isJsonImport = false; + sub: Subscription; - constructor() { } + constructor( + private activatedRoute: ActivatedRoute + ) { } - ngOnInit(): void { - } + ngOnInit(): void { + this.sub = this.activatedRoute.params.subscribe(params => { + const type = params['type']; + if (!type || type === 'json') { + this.isJsonImport = true; + } + }); + } + ngOnDestroy(): void { + if (this.sub) this.sub.unsubscribe(); + } } diff --git a/src/app/import/import-routing.module.ts b/src/app/import/import-routing.module.ts index 02a2432..0ee10da 100644 --- a/src/app/import/import-routing.module.ts +++ b/src/app/import/import-routing.module.ts @@ -25,7 +25,7 @@ const routes: Routes = [ canActivate: [CommunityfolderGuard] }, { - path: 'import-package', + path: 'import-package/:type', component: ImportPackageComponent, canActivate: [CommunityfolderGuard] }, From c3ae9db99ad5e6ec188de3f4949e948d142a32cc Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 5 Jun 2021 19:07:37 -0400 Subject: [PATCH 04/11] fix lint --- .eslintrc.json | 32 +++++------ e2e/common-setup.ts | 54 +++++++++---------- e2e/main.e2e.ts | 28 +++++----- src/app/app-routing.module.ts | 30 +++++------ src/app/app.component.spec.ts | 24 ++++----- src/app/app.module.ts | 48 ++++++++--------- src/app/core/core.module.ts | 8 +-- .../core/guards/communityfolder.guard.spec.ts | 16 +++--- src/app/core/services/domain.service.spec.ts | 16 +++--- .../core/services/downloader.service.spec.ts | 16 +++--- .../electron/electron.service.spec.ts | 10 ++-- .../services/electron/electron.service.ts | 38 ++++++------- .../core/services/extractor.service.spec.ts | 16 +++--- .../core/services/filesystem.service.spec.ts | 16 +++--- src/app/core/services/github.service.spec.ts | 16 +++--- .../core/services/packages.service.spec.ts | 16 +++--- .../core/services/settings.service.spec.ts | 16 +++--- src/app/home/home.component.spec.ts | 44 +++++++-------- src/app/home/home.module.ts | 6 +-- .../package-detailed.component.spec.ts | 32 +++++------ .../package-mini.component.spec.ts | 32 +++++------ src/app/import/add-package.component.spec.ts | 32 +++++------ src/app/import/add-package.component.ts | 12 ++--- .../create-package.component.spec.ts | 32 +++++------ .../export-package.component.spec.ts | 32 +++++------ .../import-package.component.spec.ts | 32 +++++------ src/app/import/import.module.ts | 5 +- src/app/settings/settings-routing.module.ts | 16 +++--- src/app/settings/settings.component.spec.ts | 44 +++++++-------- src/app/settings/settings.module.ts | 6 +-- .../page-not-found.component.spec.ts | 32 +++++------ .../page-not-found.component.ts | 10 ++-- .../webview/webview.directive.spec.ts | 8 +-- .../directives/webview/webview.directive.ts | 4 +- src/app/shared/shared.module.ts | 8 +-- src/environments/environment.dev.ts | 4 +- src/environments/environment.prod.ts | 4 +- src/environments/environment.ts | 4 +- src/environments/environment.web.ts | 4 +- src/main.ts | 10 ++-- src/test.ts | 10 ++-- src/typings.d.ts | 6 +-- 42 files changed, 414 insertions(+), 415 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 211ec82..6b09e85 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,22 +35,22 @@ "@angular-eslint/eslint-plugin" ], "rules": { - // "@typescript-eslint/indent": [ - // "error", - // 2, - // { - // "SwitchCase": 1, - // "CallExpression": { - // "arguments": "first" - // }, - // "FunctionExpression": { - // "parameters": "first" - // }, - // "FunctionDeclaration": { - // "parameters": "first" - // } - // } - // ], + "@typescript-eslint/indent": [ + "error", + 4, + { + "SwitchCase": 1, + "CallExpression": { + "arguments": "first" + }, + "FunctionExpression": { + "parameters": "first" + }, + "FunctionDeclaration": { + "parameters": "first" + } + } + ], "@typescript-eslint/no-empty-function": 0, "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-var-requires": 0, diff --git a/e2e/common-setup.ts b/e2e/common-setup.ts index ac5c2f0..4817ea1 100644 --- a/e2e/common-setup.ts +++ b/e2e/common-setup.ts @@ -3,36 +3,36 @@ const electronPath = require('electron'); // Require Electron from the binaries const path = require('path'); export default function setup(): void { - beforeEach(async function () { - this.app = new Application({ - // Your electron path can be any binary - // i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp' - // But for the sake of the example we fetch it from our node_modules. - path: electronPath, + beforeEach(async function () { + this.app = new Application({ + // Your electron path can be any binary + // i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp' + // But for the sake of the example we fetch it from our node_modules. + path: electronPath, - // Assuming you have the following directory structure + // Assuming you have the following directory structure - // |__ my project - // |__ ... - // |__ main.js - // |__ package.json - // |__ index.html - // |__ ... - // |__ test - // |__ spec.js <- You are here! ~ Well you should be. + // |__ my project + // |__ ... + // |__ main.js + // |__ package.json + // |__ index.html + // |__ ... + // |__ test + // |__ spec.js <- You are here! ~ Well you should be. - // The following line tells spectron to look and use the main.js file - // and the package.json located 1 level above. - args: [path.join(__dirname, '..')], - webdriverOptions: {} - }); + // The following line tells spectron to look and use the main.js file + // and the package.json located 1 level above. + args: [path.join(__dirname, '..')], + webdriverOptions: {} + }); - await this.app.start(); - }); + await this.app.start(); + }); - afterEach(async function () { - if (this.app && this.app.isRunning()) { - await this.app.stop(); - } - }); + afterEach(async function () { + if (this.app && this.app.isRunning()) { + await this.app.stop(); + } + }); } diff --git a/e2e/main.e2e.ts b/e2e/main.e2e.ts index 1e011be..f57e117 100644 --- a/e2e/main.e2e.ts +++ b/e2e/main.e2e.ts @@ -5,23 +5,23 @@ import commonSetup from './common-setup'; describe('msfs-community-downloader App', function () { - commonSetup.apply(this); + commonSetup.apply(this); - let client: SpectronClient; + let client: SpectronClient; - beforeEach(function() { - client = this.app.client; - }); + beforeEach(function () { + client = this.app.client; + }); - it('creates initial windows', async function () { - const count = await client.getWindowCount(); - expect(count).to.equal(1); - }); + it('creates initial windows', async function () { + const count = await client.getWindowCount(); + expect(count).to.equal(1); + }); - it('should display message saying App works !', async function () { - const elem = await client.$('app-home h1'); - const text = await elem.getText(); - expect(text).to.equal('App works !'); - }); + it('should display message saying App works !', async function () { + const elem = await client.$('app-home h1'); + const text = await elem.getText(); + expect(text).to.equal('App works !'); + }); }); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6e9f39e..c85310c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,23 +6,23 @@ import { HomeRoutingModule } from './home/home-routing.module'; import { SettingsRoutingModule } from './settings/settings-routing.module'; const routes: Routes = [ - { - path: '', - redirectTo: 'home', - pathMatch: 'full' - }, - { - path: '**', - component: PageNotFoundComponent - } + { + path: '', + redirectTo: 'home', + pathMatch: 'full' + }, + { + path: '**', + component: PageNotFoundComponent + } ]; @NgModule({ - imports: [ - RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' }), - HomeRoutingModule, - SettingsRoutingModule - ], - exports: [RouterModule] + imports: [ + RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' }), + HomeRoutingModule, + SettingsRoutingModule + ], + exports: [RouterModule] }) export class AppRoutingModule { } diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index c33578e..cf8dc69 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -5,17 +5,17 @@ import { TranslateModule } from '@ngx-translate/core'; import { ElectronService } from './core/services'; describe('AppComponent', () => { - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AppComponent], - providers: [ElectronService], - imports: [RouterTestingModule, TranslateModule.forRoot()] - }).compileComponents(); - })); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AppComponent], + providers: [ElectronService], + imports: [RouterTestingModule, TranslateModule.forRoot()] + }).compileComponents(); + })); - it('should create the app', waitForAsync(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); + it('should create the app', waitForAsync(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); }); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5e967d4..5338115 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -25,32 +25,32 @@ import { ImportModule } from './import/import.module'; // AoT requires an exported function for factories export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { - return new TranslateHttpLoader(http, './assets/i18n/', '.json'); + return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } @NgModule({ - declarations: [AppComponent], - imports: [ - BrowserModule, - FormsModule, - HttpClientModule, - CoreModule, - SharedModule, - HomeModule, - ImportModule, - SettingsModule, - AppRoutingModule, - FontAwesomeModule, - TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [HttpClient] - } - }) - ], - providers: [], - bootstrap: [AppComponent] + declarations: [AppComponent], + imports: [ + BrowserModule, + FormsModule, + HttpClientModule, + CoreModule, + SharedModule, + HomeModule, + ImportModule, + SettingsModule, + AppRoutingModule, + FontAwesomeModule, + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [HttpClient] + } + }) + ], + providers: [], + bootstrap: [AppComponent] }) -export class AppModule { +export class AppModule { } diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 5425ef7..8c50001 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -2,9 +2,9 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; @NgModule({ - declarations: [], - imports: [ - CommonModule - ] + declarations: [], + imports: [ + CommonModule + ] }) export class CoreModule { } diff --git a/src/app/core/guards/communityfolder.guard.spec.ts b/src/app/core/guards/communityfolder.guard.spec.ts index d3069a7..4f8e1d8 100644 --- a/src/app/core/guards/communityfolder.guard.spec.ts +++ b/src/app/core/guards/communityfolder.guard.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { CommunityfolderGuard } from './communityfolder.guard'; describe('CommunityfolderGuard', () => { - let guard: CommunityfolderGuard; + let guard: CommunityfolderGuard; - beforeEach(() => { - TestBed.configureTestingModule({}); - guard = TestBed.inject(CommunityfolderGuard); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(CommunityfolderGuard); + }); - it('should be created', () => { - expect(guard).toBeTruthy(); - }); + it('should be created', () => { + expect(guard).toBeTruthy(); + }); }); diff --git a/src/app/core/services/domain.service.spec.ts b/src/app/core/services/domain.service.spec.ts index c6cf582..19f455e 100644 --- a/src/app/core/services/domain.service.spec.ts +++ b/src/app/core/services/domain.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { DomainService } from './domain.service'; describe('DomainService', () => { - let service: DomainService; + let service: DomainService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(DomainService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(DomainService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/downloader.service.spec.ts b/src/app/core/services/downloader.service.spec.ts index 4f6f19a..2cbb56b 100644 --- a/src/app/core/services/downloader.service.spec.ts +++ b/src/app/core/services/downloader.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { DownloaderService } from './downloader.service'; describe('DownloaderService', () => { - let service: DownloaderService; + let service: DownloaderService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(DownloaderService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(DownloaderService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/electron/electron.service.spec.ts b/src/app/core/services/electron/electron.service.spec.ts index 38fe2f0..6e95b0a 100644 --- a/src/app/core/services/electron/electron.service.spec.ts +++ b/src/app/core/services/electron/electron.service.spec.ts @@ -3,10 +3,10 @@ import { TestBed } from '@angular/core/testing'; import { ElectronService } from './electron.service'; describe('ElectronService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({})); - it('should be created', () => { - const service: ElectronService = TestBed.get(ElectronService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: ElectronService = TestBed.get(ElectronService); + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/electron/electron.service.ts b/src/app/core/services/electron/electron.service.ts index b6aac0d..3d96a68 100644 --- a/src/app/core/services/electron/electron.service.ts +++ b/src/app/core/services/electron/electron.service.ts @@ -8,30 +8,30 @@ import * as childProcess from 'child_process'; import * as fs from 'fs'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class ElectronService { - ipcRenderer: typeof ipcRenderer; - webFrame: typeof webFrame; - remote: typeof remote; - childProcess: typeof childProcess; - fs: typeof fs; + ipcRenderer: typeof ipcRenderer; + webFrame: typeof webFrame; + remote: typeof remote; + childProcess: typeof childProcess; + fs: typeof fs; - get isElectron(): boolean { - return !!(window && window.process && window.process.type); - } + get isElectron(): boolean { + return !!(window && window.process && window.process.type); + } - constructor() { - // Conditional imports - if (this.isElectron) { - this.ipcRenderer = window.require('electron').ipcRenderer; - this.webFrame = window.require('electron').webFrame; + constructor() { + // Conditional imports + if (this.isElectron) { + this.ipcRenderer = window.require('electron').ipcRenderer; + this.webFrame = window.require('electron').webFrame; - // If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts - this.remote = window.require('@electron/remote'); + // If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts + this.remote = window.require('@electron/remote'); - this.childProcess = window.require('child_process'); - this.fs = window.require('fs'); + this.childProcess = window.require('child_process'); + this.fs = window.require('fs'); + } } - } } diff --git a/src/app/core/services/extractor.service.spec.ts b/src/app/core/services/extractor.service.spec.ts index d39f28e..db5ae6d 100644 --- a/src/app/core/services/extractor.service.spec.ts +++ b/src/app/core/services/extractor.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { ExtractorService } from './extractor.service'; describe('ExtractorService', () => { - let service: ExtractorService; + let service: ExtractorService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(ExtractorService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ExtractorService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/filesystem.service.spec.ts b/src/app/core/services/filesystem.service.spec.ts index 78d7517..3a11e76 100644 --- a/src/app/core/services/filesystem.service.spec.ts +++ b/src/app/core/services/filesystem.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { FilesystemService } from './filesystem.service'; describe('FilesystemService', () => { - let service: FilesystemService; + let service: FilesystemService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(FilesystemService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(FilesystemService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/github.service.spec.ts b/src/app/core/services/github.service.spec.ts index 6297f22..fbcbbef 100644 --- a/src/app/core/services/github.service.spec.ts +++ b/src/app/core/services/github.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { GithubService } from './github.service'; describe('GithubService', () => { - let service: GithubService; + let service: GithubService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(GithubService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(GithubService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/packages.service.spec.ts b/src/app/core/services/packages.service.spec.ts index 26ea404..64a792e 100644 --- a/src/app/core/services/packages.service.spec.ts +++ b/src/app/core/services/packages.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { PackagesService } from './packages.service'; describe('PackagesService', () => { - let service: PackagesService; + let service: PackagesService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(PackagesService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(PackagesService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/core/services/settings.service.spec.ts b/src/app/core/services/settings.service.spec.ts index 359cb6b..5be914c 100644 --- a/src/app/core/services/settings.service.spec.ts +++ b/src/app/core/services/settings.service.spec.ts @@ -3,14 +3,14 @@ import { TestBed } from '@angular/core/testing'; import { SettingsService } from './settings.service'; describe('SettingsService', () => { - let service: SettingsService; + let service: SettingsService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(SettingsService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SettingsService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts index 0a326e6..807de32 100644 --- a/src/app/home/home.component.spec.ts +++ b/src/app/home/home.component.spec.ts @@ -5,30 +5,30 @@ import { RouterTestingModule } from '@angular/router/testing'; import { HomeComponent } from './home.component'; describe('HomeComponent', () => { - let component: HomeComponent; - let fixture: ComponentFixture; + let component: HomeComponent; + let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [HomeComponent], - imports: [TranslateModule.forRoot(), RouterTestingModule] - }).compileComponents(); - })); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [HomeComponent], + imports: [TranslateModule.forRoot(), RouterTestingModule] + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(HomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); - it('should render title in a h1 tag', waitForAsync(() => { - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain( - 'PAGES.HOME.TITLE' - ); - })); + it('should render title in a h1 tag', waitForAsync(() => { + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain( + 'PAGES.HOME.TITLE' + ); + })); }); diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 44f77eb..bf7557d 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -10,7 +10,7 @@ import { SharedModule } from '../shared/shared.module'; import { PackageDetailedComponent } from './package-detailed/package-detailed.component'; @NgModule({ - declarations: [HomeComponent, PackageMiniComponent, PackageDetailedComponent], - imports: [CommonModule, SharedModule, HomeRoutingModule, FontAwesomeModule] + declarations: [HomeComponent, PackageMiniComponent, PackageDetailedComponent], + imports: [CommonModule, SharedModule, HomeRoutingModule, FontAwesomeModule] }) -export class HomeModule {} +export class HomeModule { } diff --git a/src/app/home/package-detailed/package-detailed.component.spec.ts b/src/app/home/package-detailed/package-detailed.component.spec.ts index af98511..e3a70e9 100644 --- a/src/app/home/package-detailed/package-detailed.component.spec.ts +++ b/src/app/home/package-detailed/package-detailed.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PackageDetailedComponent } from './package-detailed.component'; describe('PackageDetailedComponent', () => { - let component: PackageDetailedComponent; - let fixture: ComponentFixture; + let component: PackageDetailedComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PackageDetailedComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PackageDetailedComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(PackageDetailedComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PackageDetailedComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/home/package-mini/package-mini.component.spec.ts b/src/app/home/package-mini/package-mini.component.spec.ts index f9618b6..88557e6 100644 --- a/src/app/home/package-mini/package-mini.component.spec.ts +++ b/src/app/home/package-mini/package-mini.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PackageMiniComponent } from './package-mini.component'; describe('PackageMiniComponent', () => { - let component: PackageMiniComponent; - let fixture: ComponentFixture; + let component: PackageMiniComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PackageMiniComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PackageMiniComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(PackageMiniComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PackageMiniComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/import/add-package.component.spec.ts b/src/app/import/add-package.component.spec.ts index 1ff1d4b..9d1dc00 100644 --- a/src/app/import/add-package.component.spec.ts +++ b/src/app/import/add-package.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddPackageComponent } from './add-package.component'; describe('AddPackageComponent', () => { - let component: AddPackageComponent; - let fixture: ComponentFixture; + let component: AddPackageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ AddPackageComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [AddPackageComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(AddPackageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(AddPackageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/import/add-package.component.ts b/src/app/import/add-package.component.ts index 1b868ee..0bb879f 100644 --- a/src/app/import/add-package.component.ts +++ b/src/app/import/add-package.component.ts @@ -1,15 +1,15 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'app-add-package', - templateUrl: './add-package.component.html', - styleUrls: ['./add-package.component.scss'] + selector: 'app-add-package', + templateUrl: './add-package.component.html', + styleUrls: ['./add-package.component.scss'] }) export class AddPackageComponent implements OnInit { - constructor() { } + constructor() { } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/src/app/import/create-package/create-package.component.spec.ts b/src/app/import/create-package/create-package.component.spec.ts index aa6c90c..1ded3fc 100644 --- a/src/app/import/create-package/create-package.component.spec.ts +++ b/src/app/import/create-package/create-package.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CreatePackageComponent } from './create-package.component'; describe('CreatePackageComponent', () => { - let component: CreatePackageComponent; - let fixture: ComponentFixture; + let component: CreatePackageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ CreatePackageComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CreatePackageComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(CreatePackageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(CreatePackageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/import/export-package/export-package.component.spec.ts b/src/app/import/export-package/export-package.component.spec.ts index 567a1f2..e518ea2 100644 --- a/src/app/import/export-package/export-package.component.spec.ts +++ b/src/app/import/export-package/export-package.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ExportPackageComponent } from './export-package.component'; describe('ExportPackageComponent', () => { - let component: ExportPackageComponent; - let fixture: ComponentFixture; + let component: ExportPackageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ExportPackageComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ExportPackageComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(ExportPackageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ExportPackageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/import/import-package/import-package.component.spec.ts b/src/app/import/import-package/import-package.component.spec.ts index 2e578af..0bbd37e 100644 --- a/src/app/import/import-package/import-package.component.spec.ts +++ b/src/app/import/import-package/import-package.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ImportPackageComponent } from './import-package.component'; describe('ImportPackageComponent', () => { - let component: ImportPackageComponent; - let fixture: ComponentFixture; + let component: ImportPackageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ImportPackageComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ImportPackageComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(ImportPackageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ImportPackageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/import/import.module.ts b/src/app/import/import.module.ts index dc10a61..2d0fb47 100644 --- a/src/app/import/import.module.ts +++ b/src/app/import/import.module.ts @@ -13,6 +13,5 @@ import { ExportPackageComponent } from './export-package/export-package.componen @NgModule({ declarations: [AddPackageComponent, CreatePackageComponent, ImportPackageComponent, ExportPackageComponent], imports: [CommonModule, SharedModule, ImportRoutingModule, FontAwesomeModule] - }) - export class ImportModule {} - \ No newline at end of file +}) +export class ImportModule { } diff --git a/src/app/settings/settings-routing.module.ts b/src/app/settings/settings-routing.module.ts index 0c3a5ec..9113ed5 100644 --- a/src/app/settings/settings-routing.module.ts +++ b/src/app/settings/settings-routing.module.ts @@ -4,15 +4,15 @@ import { Routes, RouterModule } from '@angular/router'; import { SettingsComponent } from './settings.component'; const routes: Routes = [ - { - path: 'settings', - component: SettingsComponent - } + { + path: 'settings', + component: SettingsComponent + } ]; @NgModule({ - declarations: [], - imports: [CommonModule, RouterModule.forChild(routes)], - exports: [RouterModule] + declarations: [], + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule] }) -export class SettingsRoutingModule {} +export class SettingsRoutingModule { } diff --git a/src/app/settings/settings.component.spec.ts b/src/app/settings/settings.component.spec.ts index cacd2d9..8c1e2f4 100644 --- a/src/app/settings/settings.component.spec.ts +++ b/src/app/settings/settings.component.spec.ts @@ -6,30 +6,30 @@ import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; describe('SettingsComponent', () => { - let component: SettingsComponent; - let fixture: ComponentFixture; + let component: SettingsComponent; + let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [SettingsComponent], - imports: [TranslateModule.forRoot(), RouterTestingModule] - }).compileComponents(); - })); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [SettingsComponent], + imports: [TranslateModule.forRoot(), RouterTestingModule] + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(SettingsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(SettingsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); - it('should render title in a h1 tag', waitForAsync(() => { - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain( - 'PAGES.DETAIL.TITLE' - ); - })); + it('should render title in a h1 tag', waitForAsync(() => { + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain( + 'PAGES.DETAIL.TITLE' + ); + })); }); diff --git a/src/app/settings/settings.module.ts b/src/app/settings/settings.module.ts index aada52b..ca07110 100644 --- a/src/app/settings/settings.module.ts +++ b/src/app/settings/settings.module.ts @@ -8,7 +8,7 @@ import { SettingsComponent } from './settings.component'; import { SharedModule } from '../shared/shared.module'; @NgModule({ - declarations: [SettingsComponent], - imports: [CommonModule, SharedModule, SettingsRoutingModule, FontAwesomeModule] + declarations: [SettingsComponent], + imports: [CommonModule, SharedModule, SettingsRoutingModule, FontAwesomeModule] }) -export class SettingsModule {} +export class SettingsModule { } diff --git a/src/app/shared/components/page-not-found/page-not-found.component.spec.ts b/src/app/shared/components/page-not-found/page-not-found.component.spec.ts index 89162fd..ff42ab8 100644 --- a/src/app/shared/components/page-not-found/page-not-found.component.spec.ts +++ b/src/app/shared/components/page-not-found/page-not-found.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { PageNotFoundComponent } from './page-not-found.component'; describe('PageNotFoundComponent', () => { - let component: PageNotFoundComponent; - let fixture: ComponentFixture; + let component: PageNotFoundComponent; + let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [PageNotFoundComponent] - }) - .compileComponents(); - })); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [PageNotFoundComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PageNotFoundComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PageNotFoundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/shared/components/page-not-found/page-not-found.component.ts b/src/app/shared/components/page-not-found/page-not-found.component.ts index ae41e0d..cf444b3 100644 --- a/src/app/shared/components/page-not-found/page-not-found.component.ts +++ b/src/app/shared/components/page-not-found/page-not-found.component.ts @@ -1,12 +1,12 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'app-page-not-found', - templateUrl: './page-not-found.component.html', - styleUrls: ['./page-not-found.component.scss'] + selector: 'app-page-not-found', + templateUrl: './page-not-found.component.html', + styleUrls: ['./page-not-found.component.scss'] }) export class PageNotFoundComponent implements OnInit { - constructor() {} + constructor() { } - ngOnInit(): void {} + ngOnInit(): void { } } diff --git a/src/app/shared/directives/webview/webview.directive.spec.ts b/src/app/shared/directives/webview/webview.directive.spec.ts index d157f01..470d5ef 100644 --- a/src/app/shared/directives/webview/webview.directive.spec.ts +++ b/src/app/shared/directives/webview/webview.directive.spec.ts @@ -1,8 +1,8 @@ import { WebviewDirective } from './webview.directive'; describe('WebviewDirective', () => { - it('should create an instance', () => { - const directive = new WebviewDirective(); - expect(directive).toBeTruthy(); - }); + it('should create an instance', () => { + const directive = new WebviewDirective(); + expect(directive).toBeTruthy(); + }); }); diff --git a/src/app/shared/directives/webview/webview.directive.ts b/src/app/shared/directives/webview/webview.directive.ts index 239fed4..013699a 100644 --- a/src/app/shared/directives/webview/webview.directive.ts +++ b/src/app/shared/directives/webview/webview.directive.ts @@ -1,8 +1,8 @@ import { Directive } from '@angular/core'; @Directive({ - selector: 'webview' + selector: 'webview' }) export class WebviewDirective { - constructor() { } + constructor() { } } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 9a66283..a575e2a 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -8,8 +8,8 @@ import { WebviewDirective } from './directives/'; import { FormsModule } from '@angular/forms'; @NgModule({ - declarations: [PageNotFoundComponent, WebviewDirective], - imports: [CommonModule, TranslateModule, FormsModule], - exports: [TranslateModule, WebviewDirective, FormsModule] + declarations: [PageNotFoundComponent, WebviewDirective], + imports: [CommonModule, TranslateModule, FormsModule], + exports: [TranslateModule, WebviewDirective, FormsModule] }) -export class SharedModule {} +export class SharedModule { } diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts index 0c5b4ec..7c1a778 100644 --- a/src/environments/environment.dev.ts +++ b/src/environments/environment.dev.ts @@ -1,4 +1,4 @@ export const AppConfig = { - production: false, - environment: 'DEV' + production: false, + environment: 'DEV' }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 047b3fc..46f6797 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const AppConfig = { - production: true, - environment: 'PROD' + production: true, + environment: 'PROD' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ca0b6a9..00416a5 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,4 +1,4 @@ export const AppConfig = { - production: false, - environment: 'LOCAL' + production: false, + environment: 'LOCAL' }; diff --git a/src/environments/environment.web.ts b/src/environments/environment.web.ts index dceaa8a..a3d78b7 100644 --- a/src/environments/environment.web.ts +++ b/src/environments/environment.web.ts @@ -1,4 +1,4 @@ export const AppConfig = { - production: false, - environment: 'WEB' + production: false, + environment: 'WEB' }; diff --git a/src/main.ts b/src/main.ts index 6ad7b10..df9bc0e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,11 +5,11 @@ import { AppModule } from './app/app.module'; import { AppConfig } from './environments/environment'; if (AppConfig.production) { - enableProdMode(); + enableProdMode(); } platformBrowserDynamic() - .bootstrapModule(AppModule, { - preserveWhitespaces: false - }) - .catch(err => console.error(err)); + .bootstrapModule(AppModule, { + preserveWhitespaces: false + }) + .catch(err => console.error(err)); diff --git a/src/test.ts b/src/test.ts index 1631789..7bbba8d 100644 --- a/src/test.ts +++ b/src/test.ts @@ -3,18 +3,18 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting + BrowserDynamicTestingModule, + platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. -context.keys().map(context); +context.keys().map(context); \ No newline at end of file diff --git a/src/typings.d.ts b/src/typings.d.ts index cf117a1..274f42d 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -1,9 +1,9 @@ /* SystemJS module definition */ declare const nodeModule: NodeModule; interface NodeModule { - id: string; + id: string; } interface Window { - process: any; - require: any; + process: any; + require: any; } From 049a217a9ae69890b23a4936c1e003e8a2e9e751 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 5 Jun 2021 19:20:03 -0400 Subject: [PATCH 05/11] json import ui done --- .../import-package.component.html | 17 +++++++----- .../import-package.component.scss | 27 +++++++++++++++++++ .../import-package.component.ts | 7 +++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/app/import/import-package/import-package.component.html b/src/app/import/import-package/import-package.component.html index 9ff1f93..f8f7629 100644 --- a/src/app/import/import-package/import-package.component.html +++ b/src/app/import/import-package/import-package.component.html @@ -5,18 +5,23 @@
-

Import json filetext package

+

Import json filetext package

-
WARNING: Only import packages from trusted sources.
- Downloading blindly files from the web can lead to installing viruses, getting cryptolocked, seeing your computer dansing the Macarena and being bullied for being stupid.
+
WARNING: Only import packages from trusted + sources.
+ Downloading blindly files from the web can lead to installing viruses, getting cryptolocked, seeing your + computer dansing the Macarena and being bullied for being stupid.
Don't do that.
- JSON -
+

Sure of the source? Paste the package here:

+ + Load +
FILE
- + \ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.scss b/src/app/import/import-package/import-package.component.scss index c65b35b..365008d 100644 --- a/src/app/import/import-package/import-package.component.scss +++ b/src/app/import/import-package/import-package.component.scss @@ -41,10 +41,37 @@ font-size: 1.2em; } } + + &__json { + &__title { + font-size: 1.1em; + margin: 30px 0 0 0; + } + &__text-package { + display: block; + width: 100%; + height: 170px; + margin-top: 10px; + } + } } .warning { &__title { color: orange; } +} + +.button { + color: whitesmoke; + display: block; + float: right; + // margin: auto; + margin-top: 20px; + width: 150px; + text-align: center; + border-radius: 5px; + border: 1px solid white; + padding: 10px; + text-decoration: none; } \ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index 27ccbaf..e980c65 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -14,6 +14,8 @@ export class ImportPackageComponent implements OnInit, OnDestroy { isJsonImport = false; sub: Subscription; + json: string; + constructor( private activatedRoute: ActivatedRoute ) { } @@ -30,4 +32,9 @@ export class ImportPackageComponent implements OnInit, OnDestroy { ngOnDestroy(): void { if (this.sub) this.sub.unsubscribe(); } + + importJson(): boolean { + + return false; + } } From 4b153806400a94bb659e3ea4ce46201c3ce987c9 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 5 Jun 2021 20:15:25 -0400 Subject: [PATCH 06/11] added import controls --- src/app/import/add-package.component.html | 4 +- .../import-package.component.html | 37 ++++++++++++++++--- .../import-package.component.scss | 23 ++++++++++++ .../import-package.component.ts | 26 +++++++++++++ 4 files changed, 83 insertions(+), 7 deletions(-) diff --git a/src/app/import/add-package.component.html b/src/app/import/add-package.component.html index 9d6654b..0d3d2bd 100644 --- a/src/app/import/add-package.component.html +++ b/src/app/import/add-package.component.html @@ -3,10 +3,10 @@ Create a new Package - + Import Json file Package - + Import Text Package diff --git a/src/app/import/import-package/import-package.component.html b/src/app/import/import-package/import-package.component.html index f8f7629..a2d0843 100644 --- a/src/app/import/import-package/import-package.component.html +++ b/src/app/import/import-package/import-package.component.html @@ -5,8 +5,8 @@
-

Import json filetext package

+

Import textjson file package

WARNING: Only import packages from trusted @@ -15,13 +15,40 @@

Import json computer dansing the Macarena and being bullied for being stupid.
Don't do that.

-
+

Sure of the source? Paste the package here:

Load
-
- FILE +
+

Sure of the source? Import the file here:

+ Load +
+ +
+ +
+

Loaded Package:

+

+ {{loadedPackage.name}}
+ {{loadedPackage.description}}
+ + https://github.com/{{loadedPackage.githubOwner}}/{{loadedPackage.githubRepo}} +
+
+

+
+ +
+

Is it the package you wanted to add?

+ +
+ No Yes +
+
+ +
\ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.scss b/src/app/import/import-package/import-package.component.scss index 365008d..8a9593f 100644 --- a/src/app/import/import-package/import-package.component.scss +++ b/src/app/import/import-package/import-package.component.scss @@ -56,6 +56,29 @@ } } +.imported-package { + margin: 20px 0 0 40px; + + &__title { + font-size: 1.1em; + margin-bottom: 10px; + } + + &__link { + color: gray; + + &:hover { + color: white; + } + } +} + +.validate { + &__title { + font-size: 1.1em; + } +} + .warning { &__title { color: orange; diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index e980c65..6a82f08 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs'; import { faTimes } from '@fortawesome/free-solid-svg-icons'; +import { ElectronService } from '../../core/services/electron/electron.service'; +import { ExportablePackage } from '../export-package/export-package.component'; @Component({ selector: 'app-import-package', @@ -15,8 +17,10 @@ export class ImportPackageComponent implements OnInit, OnDestroy { sub: Subscription; json: string; + loadedPackage: ExportablePackage; constructor( + private electronService: ElectronService, private activatedRoute: ActivatedRoute ) { } @@ -34,7 +38,29 @@ export class ImportPackageComponent implements OnInit, OnDestroy { } importJson(): boolean { + this.loadJson(this.json); + return false; + } + + importFile(): boolean { + const res = this.electronService.remote.dialog.showOpenDialogSync( + { + title: 'Select the package file', + filters: [{ name: 'Json', extensions: ['json'] }], + properties: ['openFile'] + }); + + if(res && res.length > 0){ + const path = res[0]; + const jsonData = this.electronService.fs.readFileSync(path, 'utf-8'); + this.loadJson(jsonData); + } return false; } + + private loadJson(json: string): void{ + if(!json) return; + this.loadedPackage = JSON.parse(json); + } } From 9cffae3ca19e246b1d7da1b59a20d450a0a9cc5a Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 7 Jun 2021 02:42:18 -0400 Subject: [PATCH 07/11] import working --- .../import-package.component.html | 4 +-- .../import-package.component.scss | 11 +++++++ .../import-package.component.ts | 32 ++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/app/import/import-package/import-package.component.html b/src/app/import/import-package/import-package.component.html index a2d0843..e4ffc68 100644 --- a/src/app/import/import-package/import-package.component.html +++ b/src/app/import/import-package/import-package.component.html @@ -17,7 +17,7 @@

Import text

Sure of the source? Paste the package here:

- + Load
@@ -44,7 +44,7 @@

Loaded Package:

Is it the package you wanted to add?

- No Yes + No Yes
diff --git a/src/app/import/import-package/import-package.component.scss b/src/app/import/import-package/import-package.component.scss index 8a9593f..dfc67ce 100644 --- a/src/app/import/import-package/import-package.component.scss +++ b/src/app/import/import-package/import-package.component.scss @@ -97,4 +97,15 @@ border: 1px solid white; padding: 10px; text-decoration: none; + + &__validate { + margin-left: 5px; + display: inline-block; + float: none; + } +} + +.validate__buttons { + text-align: center; + margin: auto; } \ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index 6a82f08..35ace82 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -1,9 +1,11 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; import { faTimes } from '@fortawesome/free-solid-svg-icons'; import { ElectronService } from '../../core/services/electron/electron.service'; import { ExportablePackage } from '../export-package/export-package.component'; +import { DomainService } from '../../core/services/domain.service'; +import { Package } from '../../core/services/packages.service'; @Component({ selector: 'app-import-package', @@ -20,6 +22,8 @@ export class ImportPackageComponent implements OnInit, OnDestroy { loadedPackage: ExportablePackage; constructor( + private domainService: DomainService, + private router: Router, private electronService: ElectronService, private activatedRoute: ActivatedRoute ) { } @@ -63,4 +67,30 @@ export class ImportPackageComponent implements OnInit, OnDestroy { if(!json) return; this.loadedPackage = JSON.parse(json); } + + cancel(): boolean { + this.loadedPackage = null; + return false; + } + + validate(): boolean { + const p = new Package(); + p.id = this.loadedPackage.id; + p.name = this.loadedPackage.name; + p.description = this.loadedPackage.description; + p.githubOwner = this.loadedPackage.githubOwner; + p.githubRepo = this.loadedPackage.githubRepo; + p.assetName = this.loadedPackage.assetName; + p.isPrerelease = this.loadedPackage.isPrerelease; + p.versionPatternToRemove = this.loadedPackage.versionPatternToRemove; + p.folderName = this.loadedPackage.folderName; + p.illustration = this.loadedPackage.illustration; + p.summary = this.loadedPackage.summary; + p.webpageUrl = this.loadedPackage.webpageUrl; + p.oldFolderNames = this.loadedPackage.oldFolderNames; + + this.domainService.addCustomPackage(p); + this.router.navigate(['/']); + return false; + } } From 1f113a9e9a8d9cf20267c301b3d8a09bd10f1843 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 7 Jun 2021 21:50:29 -0400 Subject: [PATCH 08/11] display error --- .../import-package.component.html | 12 +++++---- .../import-package.component.scss | 14 +++++++--- .../import-package.component.ts | 27 +++++++++++++++++-- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/app/import/import-package/import-package.component.html b/src/app/import/import-package/import-package.component.html index e4ffc68..6cc6d09 100644 --- a/src/app/import/import-package/import-package.component.html +++ b/src/app/import/import-package/import-package.component.html @@ -11,8 +11,8 @@

Import text
WARNING: Only import packages from trusted sources.
- Downloading blindly files from the web can lead to installing viruses, getting cryptolocked, seeing your - computer dansing the Macarena and being bullied for being stupid.
+ Downloading blindly files from the web can lead to installing viruses, getting cryptolocked or seeing your + computer dansing the Macarena.
Don't do that.
@@ -20,13 +20,17 @@

Sure of the source? Paste the package he Load

+

Sure of the source? Import the file here:

Load
-
+
+ {{errorMessage}} +
+

Loaded Package:

@@ -47,8 +51,6 @@

Is it the package you wanted to add?

No Yes
- -
\ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.scss b/src/app/import/import-package/import-package.component.scss index dfc67ce..97d5539 100644 --- a/src/app/import/import-package/import-package.component.scss +++ b/src/app/import/import-package/import-package.component.scss @@ -39,7 +39,7 @@ &__title { //padding: 15px 0 0 15px; font-size: 1.2em; - } + } } &__json { @@ -47,6 +47,7 @@ font-size: 1.1em; margin: 30px 0 0 0; } + &__text-package { display: block; width: 100%; @@ -58,7 +59,7 @@ .imported-package { margin: 20px 0 0 40px; - + &__title { font-size: 1.1em; margin-bottom: 10px; @@ -81,11 +82,11 @@ .warning { &__title { - color: orange; + color: orange; } } -.button { +.button { color: whitesmoke; display: block; float: right; @@ -108,4 +109,9 @@ .validate__buttons { text-align: center; margin: auto; +} + +.display-error { + color: red; + margin-top: 30px; } \ No newline at end of file diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index 35ace82..a536ba5 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { Subscription } from 'rxjs'; +import { Subscription, of } from 'rxjs'; import { faTimes } from '@fortawesome/free-solid-svg-icons'; import { ElectronService } from '../../core/services/electron/electron.service'; import { ExportablePackage } from '../export-package/export-package.component'; @@ -21,6 +21,9 @@ export class ImportPackageComponent implements OnInit, OnDestroy { json: string; loadedPackage: ExportablePackage; + hasError: boolean; + errorMessage: string; + constructor( private domainService: DomainService, private router: Router, @@ -64,8 +67,28 @@ export class ImportPackageComponent implements OnInit, OnDestroy { } private loadJson(json: string): void{ + this.hasError = false; + this.errorMessage = null; + if(!json) return; - this.loadedPackage = JSON.parse(json); + const newPackage = JSON.parse(json); + + const currentPackages = this.domainService.getPackages(); + const sameIdPackage = currentPackages.find(x => x.id === newPackage.id); + if(sameIdPackage){ + this.hasError = true; + this.errorMessage = `Can't import the package: it has the same ID than ${sameIdPackage.name}`; + return; + } + + const sameFolderPackage = currentPackages.find(x => x.folderName === newPackage.folderName); + if(sameFolderPackage){ + this.hasError = true; + this.errorMessage = `Can't import the package: it use the same Folder than ${sameFolderPackage.name}`; + return; + } + + this.loadedPackage = newPackage; } cancel(): boolean { From 213231d98a946bc4b3dc25799818f0f1047cff35 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 7 Jun 2021 21:53:39 -0400 Subject: [PATCH 09/11] added invalid json error --- .../import-package.component.ts | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/app/import/import-package/import-package.component.ts b/src/app/import/import-package/import-package.component.ts index a536ba5..ce557e3 100644 --- a/src/app/import/import-package/import-package.component.ts +++ b/src/app/import/import-package/import-package.component.ts @@ -14,7 +14,7 @@ import { Package } from '../../core/services/packages.service'; }) export class ImportPackageComponent implements OnInit, OnDestroy { faTimes = faTimes; - + isJsonImport = false; sub: Subscription; @@ -57,7 +57,7 @@ export class ImportPackageComponent implements OnInit, OnDestroy { properties: ['openFile'] }); - if(res && res.length > 0){ + if (res && res.length > 0) { const path = res[0]; const jsonData = this.electronService.fs.readFileSync(path, 'utf-8'); this.loadJson(jsonData); @@ -66,23 +66,33 @@ export class ImportPackageComponent implements OnInit, OnDestroy { return false; } - private loadJson(json: string): void{ + private loadJson(json: string): void { this.hasError = false; this.errorMessage = null; - if(!json) return; - const newPackage = JSON.parse(json); + if (!json) return; + + let newPackage: ExportablePackage; + + try { + newPackage = JSON.parse(json); + } catch (err) { + console.error(err); + this.hasError = true; + this.errorMessage = `Invalid JSON, the parsing has failed`; + return; + } const currentPackages = this.domainService.getPackages(); const sameIdPackage = currentPackages.find(x => x.id === newPackage.id); - if(sameIdPackage){ + if (sameIdPackage) { this.hasError = true; this.errorMessage = `Can't import the package: it has the same ID than ${sameIdPackage.name}`; return; } const sameFolderPackage = currentPackages.find(x => x.folderName === newPackage.folderName); - if(sameFolderPackage){ + if (sameFolderPackage) { this.hasError = true; this.errorMessage = `Can't import the package: it use the same Folder than ${sameFolderPackage.name}`; return; From da7d680a767ecd9d36c4b445b0c90e6b1c1f0b4e Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 7 Jun 2021 22:00:37 -0400 Subject: [PATCH 10/11] road to 0.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa1511a..2dbfa10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "msfs-community-downloader", - "version": "0.5.0", + "version": "0.6.0", "description": "MSFS addin downloader client", "homepage": "https://github.com/nicolasconstant/msfs-community-downloader", "author": { From 160dfc62d54eebbbd509105a96ad6fb47eba67a2 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 7 Jun 2021 22:04:10 -0400 Subject: [PATCH 11/11] fix typo --- .../import/create-package/create-package.component.html | 8 ++++---- .../import/import-package/import-package.component.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/import/create-package/create-package.component.html b/src/app/import/create-package/create-package.component.html index 38cbdb8..1d8c97b 100644 --- a/src/app/import/create-package/create-package.component.html +++ b/src/app/import/create-package/create-package.component.html @@ -13,7 +13,7 @@

Edit package

-

The name of the package's folder. Must be unique amongs all other packages. Usually the name of the folder inside the zip package.

+

The name of the package's folder. Must be unique among all other packages. Usually, the name of the folder inside the zip package.

@@ -43,7 +43,7 @@

Edit package

-

The name of the zip file of the package.
If it changes every version, just enter the first part that is common. For example if a package is released via a zip called "my-package-v0.5.0.zip" enter "my-package-v" in this field.
If the package isn't released via a zip, leave empty.

+

The name of the zip file of the package.
If it changes every version, just enter the first part that is common. For example, if a package is released via a zip called "my-package-v0.5.0.zip" enter "my-package-v" in this field.
If the package isn't released via a zip, leave empty.

@@ -58,12 +58,12 @@

Edit package

-

Optionnal.
If the package has a landing page, official website, etc, enter the URL here.

+

Optional.
If the package has a landing page, official website, etc, enter the URL here.

-

Optionnal.
If the version is messed up, you can clean-up for display purposes. If the version is released like "data-v0.5.0", enter "data-" to remove this part in the interface.

+

Optional.
If the version is messed up, you can clean-up for display purposes. If the version is released like "data-v0.5.0", enter "data-" to remove this part in the interface.