-
-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add upgrade reminder #3569
base: main
Are you sure you want to change the base?
Changes from 3 commits
892c368
90edbab
fb4a1b2
9a61e5b
4be292d
f97ebe0
43898e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,31 @@ import path from 'path'; | |
|
||
import { api, StartOptions } from '@electron-forge/core'; | ||
import { ElectronProcess } from '@electron-forge/shared-types'; | ||
import chalk from 'chalk'; | ||
import program from 'commander'; | ||
import fs from 'fs-extra'; | ||
import semver from 'semver'; | ||
// eslint-disable-next-line node/no-unpublished-import | ||
import updateNotifier from 'update-notifier'; | ||
|
||
import './util/terminate'; | ||
import workingDir from './util/working-dir'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const metadata = require('../package.json'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: This can be converted to an |
||
(async () => { | ||
let commandArgs = process.argv; | ||
let appArgs; | ||
const notifier = updateNotifier({ | ||
pkg: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: we should just pass the package.json directly here? |
||
name: metadata.name, | ||
version: metadata.version, | ||
}, | ||
updateCheckInterval: 1000 * 60 * 60, | ||
}); | ||
if (notifier.update && semver.lt(notifier.update.current, notifier.update.latest)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: In what case is there going to be an update available and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are right |
||
console.log(`Update available: ${chalk.dim(`${notifier.update?.current}`)} -> ${chalk.green(`${notifier.update?.latest}`)}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue(blocking): I don't think this is exactly what we want here. I think a custom log message is necessary for our monorepo design as we want to provide users with a way to update all their packages at a glance, but it seems like the custom message here simply logs the new version number without additional context? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, I'd like to manually generate the little box that updatenotifier uses by default :) |
||
} | ||
|
||
const doubleDashIndex = process.argv.indexOf('--'); | ||
if (doubleDashIndex !== -1) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I think this should be under
dependencies
since it ships to users.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, can we not dynamically import the ESM module into CommonJS? Would be nice to have v6. v7 seems out of the question for now because we still support Node 16 in Forge.
await import('update-notifier')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use the dynamic import() for v6 but kept getting the same ESM errors.