Skip to content

Commit

Permalink
fix: allow typescript typechecking for electron-updater .d.ts (#8372)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta authored Jul 23, 2024
1 parent e74f8f0 commit c85b73d
Show file tree
Hide file tree
Showing 15 changed files with 166 additions and 9,273 deletions.
7 changes: 7 additions & 0 deletions .changeset/selfish-ligers-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"app-builder-lib": patch
"electron-builder": patch
"electron-updater": patch
---

fix: allow enabling tsc lib checking on electron-updater package
1 change: 0 additions & 1 deletion packages/app-builder-lib/tsconfig-scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"../../typings/*.d.ts"
],
"exclude": [
"../../typings/electron.d.ts"
]
}
1 change: 0 additions & 1 deletion packages/app-builder-lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"../../typings/*.d.ts"
],
"exclude": [
"../../typings/electron.d.ts"
],
"references": [
{
Expand Down
1 change: 0 additions & 1 deletion packages/electron-builder/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@
"../../typings/*.d.ts"
],
"exclude": [
"../../typings/electron.d.ts"
]
}
3 changes: 2 additions & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"@types/js-yaml": "4.0.3",
"@types/lodash.escaperegexp": "4.1.6",
"@types/lodash.isequal": "4.5.5",
"@types/semver": "^7.3.13"
"@types/semver": "^7.3.13",
"electron": "^31.2.1"
},
"typings": "./out/main.d.ts",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { createClient, isUrlProbablySupportMultiRangeRequests } from "./provider
import { ProviderPlatform } from "./providers/Provider"
import type { TypedEmitter } from "tiny-typed-emitter"
import Session = Electron.Session
import { AuthInfo } from "electron"
import type { AuthInfo } from "electron"
import { gunzipSync } from "zlib"
import { blockmapFiles } from "./util"
import { DifferentialDownloaderOptions } from "./differentialDownloader/DifferentialDownloader"
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-updater/src/ElectronAppAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ElectronAppAdapter implements AppAdapter {
}

get appUpdateConfigPath(): string {
return this.isPackaged ? path.join(process.resourcesPath!, "app-update.yml") : path.join(this.app.getAppPath(), "dev-app-update.yml")
return this.isPackaged ? path.join(process.resourcesPath, "app-update.yml") : path.join(this.app.getAppPath(), "dev-app-update.yml")
}

get userDataPath(): string {
Expand All @@ -41,6 +41,6 @@ export class ElectronAppAdapter implements AppAdapter {
}

onQuit(handler: (exitCode: number) => void): void {
this.app.once("quit", (_: Event, exitCode: number) => handler(exitCode))
this.app.once("quit", (_: Electron.Event, exitCode: number) => handler(exitCode))
}
}
2 changes: 1 addition & 1 deletion packages/electron-updater/src/NsisUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class NsisUpdater extends BaseUpdater {
}

const callUsingElevation = (): void => {
this.spawnLog(path.join(process.resourcesPath!, "elevate.exe"), [options.installerPath].concat(args)).catch(e => this.dispatchError(e))
this.spawnLog(path.join(process.resourcesPath, "elevate.exe"), [options.installerPath].concat(args)).catch(e => this.dispatchError(e))
}

if (options.isAdminRightsRequired) {
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-updater/src/electronHttpExecutor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DownloadOptions, HttpExecutor, configureRequestOptions, configureRequestUrl } from "builder-util-runtime"
import { AuthInfo } from "electron"
import type { AuthInfo } from "electron"
import { RequestOptions } from "http"
import Session = Electron.Session
import ClientRequest = Electron.ClientRequest
Expand Down Expand Up @@ -65,7 +65,7 @@ export class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {
const request = require("electron").net.request({
...options,
session: this.cachedSession,
}) as Electron.ClientRequest
})
request.on("response", callback)
if (this.proxyLoginCallback != null) {
request.on("login", this.proxyLoginCallback)
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function doLoadAutoUpdater(): AppUpdater {
} else {
_autoUpdater = new (require("./AppImageUpdater").AppImageUpdater)()
try {
const identity = path.join(process.resourcesPath!, "package-type")
const identity = path.join(process.resourcesPath, "package-type")
if (!existsSync(identity)) {
return _autoUpdater
}
Expand Down
1 change: 0 additions & 1 deletion packages/electron-updater/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"access": "public"
},
"files": [
"../../typings/electron.d.ts"
],
"include": [
"src/**/*.ts"
Expand Down
Loading

0 comments on commit c85b73d

Please sign in to comment.