Skip to content

Commit

Permalink
loading simple-update-notifier via require
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Maietta committed Aug 22, 2022
1 parent 2ccc6f9 commit ee48283
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions packages/electron-builder/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { readJson } from "fs-extra"
import * as isCi from "is-ci"
import * as path from "path"
import { loadEnv } from "read-config-file"
import UpdateNotifier from "simple-update-notifier"
import { ExecError } from "builder-util/out/util"
import { build, configureBuildCommand, createYargs } from "../builder"
import { createSelfSignedCert } from "./create-self-signed-cert"
Expand Down Expand Up @@ -47,7 +46,7 @@ void createYargs()

function wrap(task: (args: any) => Promise<any>) {
return (args: any) => {
checkIsOutdated()
checkIsOutdated().catch(e => log.warn({ error: e }, "cannot check updates"))
loadEnv(path.join(process.cwd(), "electron-builder.env"))
.then(() => task(args))
.catch(error => {
Expand All @@ -63,20 +62,17 @@ function wrap(task: (args: any) => Promise<any>) {
}
}

function checkIsOutdated() {
async function checkIsOutdated() {
if (isCi || process.env.NO_UPDATE_NOTIFIER != null) {
return
}

readJson(path.join(__dirname, "..", "..", "package.json"))
.then(async it => {
if (it.version === "0.0.0-semantic-release") {
return
}

await UpdateNotifier({ pkg: it })
})
.catch(e => log.warn({ error: e }, "cannot check updates"))
const pkg = await readJson(path.join(__dirname, "..", "..", "package.json"))
if (pkg.version === "0.0.0-semantic-release") {
return
}
const UpdateNotifier = require("simple-update-notifier")
await UpdateNotifier({ pkg })
}

async function rebuildAppNativeCode(args: any) {
Expand Down

0 comments on commit ee48283

Please sign in to comment.