Skip to content

Commit

Permalink
fix: Provide update command for project package manager (#4167)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and develar committed Sep 23, 2019
1 parent 9df845e commit 0348b9f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/electron-builder/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { exec, InvalidConfigurationError, log } from "builder-util"
import chalk from "chalk"
import { getElectronVersion } from "app-builder-lib/out/electron/electronVersion"
import { getGypEnv } from "app-builder-lib/out/util/yarn"
import { readJson } from "fs-extra"
import { existsSync, readJson } from "fs-extra"
import isCi from "is-ci"
import * as path from "path"
import { loadEnv } from "read-config-file"
Expand Down Expand Up @@ -69,10 +69,12 @@ function checkIsOutdated() {
return
}

const packageManager = existsSync(path.join(__dirname, "..", "..", "package-lock.json")) ? "npm" : "yarn"

const notifier = updateNotifier({pkg: it})
if (notifier.update != null) {
notifier.notify({
message: `Update available ${chalk.dim(notifier.update.current)}${chalk.reset(" → ")}${chalk.green(notifier.update.latest)} \nRun ${chalk.cyan("yarn upgrade electron-builder")} to update`
message: `Update available ${chalk.dim(notifier.update.current)}${chalk.reset(" → ")}${chalk.green(notifier.update.latest)} \nRun ${chalk.cyan(`${packageManager} upgrade electron-builder`)} to update`
})
}
})
Expand All @@ -86,4 +88,4 @@ async function rebuildAppNativeCode(args: any) {
await exec(process.platform === "win32" ? "node-gyp.cmd" : "node-gyp", ["rebuild"], {
env: getGypEnv({version: await getElectronVersion(projectDir), useCustomDist: true}, args.platform, args.arch, true),
})
}
}
4 changes: 2 additions & 2 deletions test/out/__snapshots__/BuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1063,10 +1063,10 @@ Object {
"size": 1069,
},
"index.js": Object {
"size": 4896,
"size": 4962,
},
"package.json": Object {
"size": 524,
"size": 525,
},
},
},
Expand Down
22 changes: 22 additions & 0 deletions test/out/mac/__snapshots__/macArchiveTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ Array [
"Test App ßW.app/Contents/Frameworks/Mantle.framework",
"Test App ßW.app/Contents/Frameworks/ReactiveCocoa.framework",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app",
"Test App ßW.app/Contents/MacOS/Test App ßW",
"Test App ßW.app/Contents/Resources/am.lproj",
Expand Down Expand Up @@ -414,6 +417,9 @@ Array [
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Resources",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Squirrel",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/Current",
Expand All @@ -423,6 +429,15 @@ Array [
"Test App ßW.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/Current",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/Info.plist",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/MacOS",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/PkgInfo",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/Info.plist",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/MacOS",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/PkgInfo",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/Info.plist",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/MacOS",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/PkgInfo",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/Info.plist",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/MacOS",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/PkgInfo",
Expand All @@ -441,8 +456,15 @@ Array [
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Modules",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources",
"Test App ßW.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (GPU).app/Contents/MacOS/Test App ßW Helper (GPU)",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Plugin).app/Contents/MacOS/Test App ßW Helper (Plugin)",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper (Renderer).app/Contents/MacOS/Test App ßW Helper (Renderer)",
"Test App ßW.app/Contents/Frameworks/Test App ßW Helper.app/Contents/MacOS/Test App ßW Helper",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj",
"Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/bg.lproj",
Expand Down

0 comments on commit 0348b9f

Please sign in to comment.