Skip to content

Commit 0348b9f

Browse files
G-Rathdevelar
authored andcommitted
fix: Provide update command for project package manager (#4167)
1 parent 9df845e commit 0348b9f

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

packages/electron-builder/src/cli/cli.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { exec, InvalidConfigurationError, log } from "builder-util"
44
import chalk from "chalk"
55
import { getElectronVersion } from "app-builder-lib/out/electron/electronVersion"
66
import { getGypEnv } from "app-builder-lib/out/util/yarn"
7-
import { readJson } from "fs-extra"
7+
import { existsSync, readJson } from "fs-extra"
88
import isCi from "is-ci"
99
import * as path from "path"
1010
import { loadEnv } from "read-config-file"
@@ -69,10 +69,12 @@ function checkIsOutdated() {
6969
return
7070
}
7171

72+
const packageManager = existsSync(path.join(__dirname, "..", "..", "package-lock.json")) ? "npm" : "yarn"
73+
7274
const notifier = updateNotifier({pkg: it})
7375
if (notifier.update != null) {
7476
notifier.notify({
75-
message: `Update available ${chalk.dim(notifier.update.current)}${chalk.reset(" → ")}${chalk.green(notifier.update.latest)} \nRun ${chalk.cyan("yarn upgrade electron-builder")} to update`
77+
message: `Update available ${chalk.dim(notifier.update.current)}${chalk.reset(" → ")}${chalk.green(notifier.update.latest)} \nRun ${chalk.cyan(`${packageManager} upgrade electron-builder`)} to update`
7678
})
7779
}
7880
})
@@ -86,4 +88,4 @@ async function rebuildAppNativeCode(args: any) {
8688
await exec(process.platform === "win32" ? "node-gyp.cmd" : "node-gyp", ["rebuild"], {
8789
env: getGypEnv({version: await getElectronVersion(projectDir), useCustomDist: true}, args.platform, args.arch, true),
8890
})
89-
}
91+
}

test/out/__snapshots__/BuildTest.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,10 +1063,10 @@ Object {
10631063
"size": 1069,
10641064
},
10651065
"index.js": Object {
1066-
"size": 4896,
1066+
"size": 4962,
10671067
},
10681068
"package.json": Object {
1069-
"size": 524,
1069+
"size": 525,
10701070
},
10711071
},
10721072
},

test/out/mac/__snapshots__/macArchiveTest.js.snap

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ Array [
337337
"Test App ßW.app/Contents/Frameworks/Mantle.framework",
338338
"Test App ßW.app/Contents/Frameworks/ReactiveCocoa.framework",
339339
"Test App ßW.app/Contents/Frameworks/Squirrel.framework",
340+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app",
341+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app",
342+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app",
340343
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app",
341344
"Test App ßW.app/Contents/MacOS/Test App ßW",
342345
"Test App ßW.app/Contents/Resources/am.lproj",
@@ -414,6 +417,9 @@ Array [
414417
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Resources",
415418
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Squirrel",
416419
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions",
420+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents",
421+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents",
422+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents",
417423
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents",
418424
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A",
419425
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/Current",
@@ -423,6 +429,15 @@ Array [
423429
"Test App ßW.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current",
424430
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A",
425431
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/Current",
432+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/Info.plist",
433+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/MacOS",
434+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/PkgInfo",
435+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/Info.plist",
436+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/MacOS",
437+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/PkgInfo",
438+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/Info.plist",
439+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/MacOS",
440+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/PkgInfo",
426441
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/Info.plist",
427442
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/MacOS",
428443
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/PkgInfo",
@@ -441,8 +456,15 @@ Array [
441456
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Modules",
442457
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources",
443458
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel",
459+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/MacOS/Test App ßW Helper (GPU)",
460+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/MacOS/Test App ßW Helper (Plugin)",
461+
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/MacOS/Test App ßW Helper (Renderer)",
444462
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/MacOS/Test App ßW Helper",
463+
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib",
445464
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib",
465+
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib",
466+
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib",
467+
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib",
446468
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj",
447469
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj",
448470
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/bg.lproj",

0 commit comments

Comments
 (0)