From fb1908e06352a9c194ec6f1fa697aad2230e1c99 Mon Sep 17 00:00:00 2001 From: Geomitron <22552797+Geomitron@users.noreply.github.com> Date: Sun, 10 May 2020 21:43:43 -0400 Subject: [PATCH] Fixed various build problems --- package-lock.json | 42 +++++++++++++------ package.json | 5 +-- .../result-table-row.component.ts | 2 +- .../result-table/result-table.component.ts | 6 +-- .../browse/status-bar/status-bar.component.ts | 12 +++--- src/app/core/services/selection.service.ts | 2 +- src/electron/ipc/download/FileExtractor.ts | 10 +++-- src/electron/main.ts | 1 + 8 files changed, 49 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f2f32d..fe43864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2142,15 +2142,6 @@ "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==", "dev": true }, - "@types/destroy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/destroy/-/destroy-1.0.0.tgz", - "integrity": "sha512-nE3ePJLWPRu/qFHN8mj3fWnkr9K9ezwoiG4yOis2DuLeAawlnOOT/pM29JQkityrwfEvkblU5O9iS1bsiMqtDw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/electron-window-state": { "version": "2.0.33", "resolved": "https://registry.npmjs.org/@types/electron-window-state/-/electron-window-state-2.0.33.tgz", @@ -4170,8 +4161,7 @@ "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" }, "cli-boxes": { "version": "2.2.0", @@ -5432,7 +5422,8 @@ "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true }, "detect-file": { "version": "1.0.0", @@ -5943,6 +5934,11 @@ } } }, + "electron-is-dev": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz", + "integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==" + }, "electron-publish": { "version": "22.3.2", "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.3.2.tgz", @@ -6030,6 +6026,17 @@ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.344.tgz", "integrity": "sha512-tvbx2Wl8WBR+ym3u492D0L6/jH+8NoQXqe46+QhbWH3voVPauGuZYeb1QAXYoOAWuiP2dbSvlBx0kQ1F3hu/Mw==" }, + "electron-unhandled": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/electron-unhandled/-/electron-unhandled-3.0.2.tgz", + "integrity": "sha512-IIqXnM5eNgV7k5sDA/GZ39ygJbpfF3WTArNGQ1TB4AI6ajQuuVztA0M6Mq9uEpmTh5gz4nR+YsTNWYsHLoM5rw==", + "requires": { + "clean-stack": "^2.1.0", + "electron-is-dev": "^1.0.1", + "ensure-error": "^2.0.0", + "lodash.debounce": "^4.0.8" + } + }, "electron-window-state": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/electron-window-state/-/electron-window-state-5.0.3.tgz", @@ -6099,6 +6106,11 @@ "tapable": "^1.0.0" } }, + "ensure-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ensure-error/-/ensure-error-2.1.0.tgz", + "integrity": "sha512-+BMSJHw9gxiJAAp2ZR1E0TNcL09dD3lOvkl7WVm4+Y6xnes/pMetP/TzCHiDduh8ihNDjbGfuYxl7l4PA1xZ8A==" + }, "entities": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", @@ -10829,6 +10841,11 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" + }, "lodash.defaults": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-3.1.2.tgz", @@ -15097,7 +15114,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } diff --git a/package.json b/package.json index 63543ab..971ba46 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@angular/router": "~9.1.4", "cli-color": "^2.0.0", "comparators": "^3.0.2", - "destroy": "^1.0.4", + "electron-unhandled": "^3.0.2", "electron-window-state": "^5.0.3", "fomantic-ui": "^2.8.3", "jquery": "^3.4.1", @@ -44,6 +44,7 @@ "needle": "^2.3.2", "node-7z": "^2.0.5", "node-unrar-js": "^0.8.1", + "rimraf": "^3.0.2", "rxjs": "~6.5.5", "sanitize-filename": "^1.6.3", "tslib": "^1.10.0", @@ -57,7 +58,6 @@ "@angular/compiler-cli": "~9.1.4", "@angular/language-service": "~9.1.4", "@types/cli-color": "^2.0.0", - "@types/destroy": "^1.0.0", "@types/electron-window-state": "^2.0.33", "@types/mv": "^2.1.0", "@types/needle": "^2.0.4", @@ -72,7 +72,6 @@ "eslint": "^6.8.0", "nodemon": "^2.0.2", "npm-run-all": "^4.1.5", - "rimraf": "^3.0.2", "ts-node": "~7.0.0", "typescript": "~3.8.3", "wait-on": "^4.0.0" diff --git a/src/app/components/browse/result-table/result-table-row/result-table-row.component.ts b/src/app/components/browse/result-table/result-table-row/result-table-row.component.ts index e58a1f2..5322afa 100644 --- a/src/app/components/browse/result-table/result-table-row/result-table-row.component.ts +++ b/src/app/components/browse/result-table/result-table-row/result-table-row.component.ts @@ -1,6 +1,6 @@ import { Component, AfterViewInit, Input, ViewChild, ElementRef } from '@angular/core' import { SongResult } from '../../../../../electron/shared/interfaces/search.interface' -import { SelectionService } from 'src/app/core/services/selection.service' +import { SelectionService } from '../../../../core/services/selection.service' @Component({ selector: 'tr[app-result-table-row]', diff --git a/src/app/components/browse/result-table/result-table.component.ts b/src/app/components/browse/result-table/result-table.component.ts index fb4ede9..f7b4926 100644 --- a/src/app/components/browse/result-table/result-table.component.ts +++ b/src/app/components/browse/result-table/result-table.component.ts @@ -1,9 +1,9 @@ import { Component, Output, EventEmitter, ViewChildren, QueryList, ViewChild, OnInit } from '@angular/core' import { SongResult } from '../../../../electron/shared/interfaces/search.interface' import { ResultTableRowComponent } from './result-table-row/result-table-row.component' -import { CheckboxDirective } from 'src/app/core/directives/checkbox.directive' -import { SearchService } from 'src/app/core/services/search.service' -import { SelectionService } from 'src/app/core/services/selection.service' +import { CheckboxDirective } from '../../../core/directives/checkbox.directive' +import { SearchService } from '../../../core/services/search.service' +import { SelectionService } from '../../../core/services/selection.service' @Component({ selector: 'app-result-table', diff --git a/src/app/components/browse/status-bar/status-bar.component.ts b/src/app/components/browse/status-bar/status-bar.component.ts index c659473..c5d4775 100644 --- a/src/app/components/browse/status-bar/status-bar.component.ts +++ b/src/app/components/browse/status-bar/status-bar.component.ts @@ -1,10 +1,10 @@ import { Component, ChangeDetectorRef } from '@angular/core' -import { DownloadService } from 'src/app/core/services/download.service' -import { ElectronService } from 'src/app/core/services/electron.service' -import { groupBy } from 'src/electron/shared/UtilFunctions' -import { VersionResult } from 'src/electron/shared/interfaces/songDetails.interface' -import { SearchService } from 'src/app/core/services/search.service' -import { SelectionService } from 'src/app/core/services/selection.service' +import { DownloadService } from '../../../core/services/download.service' +import { ElectronService } from '../../../core/services/electron.service' +import { groupBy } from '../../../../electron/shared/UtilFunctions' +import { VersionResult } from '../../../../electron/shared/interfaces/songDetails.interface' +import { SearchService } from '../../../core/services/search.service' +import { SelectionService } from '../../../core/services/selection.service' @Component({ selector: 'app-status-bar', diff --git a/src/app/core/services/selection.service.ts b/src/app/core/services/selection.service.ts index bdb20e2..babdfaa 100644 --- a/src/app/core/services/selection.service.ts +++ b/src/app/core/services/selection.service.ts @@ -1,5 +1,5 @@ import { Injectable, EventEmitter } from '@angular/core' -import { SongResult } from 'src/electron/shared/interfaces/search.interface' +import { SongResult } from '../../../electron/shared/interfaces/search.interface' import { SearchService } from './search.service' // Note: this class prevents event cycles by only emitting events if the checkbox changes diff --git a/src/electron/ipc/download/FileExtractor.ts b/src/electron/ipc/download/FileExtractor.ts index bfc8261..bc683e4 100644 --- a/src/electron/ipc/download/FileExtractor.ts +++ b/src/electron/ipc/download/FileExtractor.ts @@ -109,17 +109,19 @@ export class FileExtractor { * Extracts a .zip or .7z archive found at `fullPath` and puts the extracted results in `this.sourceFolder`. */ private extract7z(fullPath: string) { - const stream = node7z.extractFull(fullPath, this.sourceFolder, { $progress: true, $bin: zipBin.path7za }) + const zipBinPath = zipBin.path7za.replace('app.asar', 'app.asar.unpacked') // I love electron-builder packaging :) + const stream = node7z.extractFull(fullPath, this.sourceFolder, { $progress: true, $bin: zipBinPath }) stream.on('progress', this.cancelable((progress: { percent: number; fileCount: number }) => { this.callbacks.extractProgress(progress.percent, isNaN(progress.fileCount) ? 0 : progress.fileCount) })) let extractErrorOccured = false - stream.on('error', this.cancelable(() => { + stream.on('error', this.cancelable((err) => { extractErrorOccured = true - console.log(`Failed to extract [${fullPath}]; retrying with .rar extractor...`) - this.extract(fullPath, true) + this.callbacks.error({ header: '7zip Error', body: err }, () => this.extract(fullPath, extname(fullPath) == '.rar')) + // console.log(`Failed to extract [${fullPath}]; retrying with .rar extractor...`) + // this.extract(fullPath, true) })) stream.on('end', this.cancelable(() => { diff --git a/src/electron/main.ts b/src/electron/main.ts index 737d83b..b54870c 100644 --- a/src/electron/main.ts +++ b/src/electron/main.ts @@ -2,6 +2,7 @@ import { app, BrowserWindow, ipcMain } from 'electron' import * as windowStateKeeper from 'electron-window-state' import * as path from 'path' import * as url from 'url' +require('electron-unhandled')({ showDialog: true }) // IPC Handlers import { getIPCInvokeHandlers, getIPCEmitHandlers, IPCEmitEvents } from './shared/IPCHandler'