Open erickzhao opened 1 year ago
I am working on this. You want a check for latest Electron version right?
Docusaurus uses https://www.npmjs.com/package/update-notifier for comparing latest version and current versions. After going through this package I found out to get the latest version it uses https://www.npmjs.com/package/latest-version. According to me "latest-version" is ideal for us as it is regularly updated, is small in size and we already have current version data.
@erickzhao I would like to know your feed back on this.
I did some changes in start.ts I can make it accurate with the actual latest version data.
Hi @DevanceJ, this is specifically looking for the latest Forge version rather than the Electron version.
Hi @erickzhao, Can you help me how to get the latest version to check if the user's version is outdated or not.
Hey @erickzhao I have been looking into this issue as well, update-notifier to check for update along with semver to check the difference in version appears to be the solution, like so
if (notifier.config && notifier.update && semver.lt(notifier.update.current, notifier.update.latest))
As for the dependencies to be update, I used the exported set of dependencies similarly to the one in docusaurus snippet you provided which results in something like this:
npm i , @electron-forge/cli@latest, @electron-forge/maker-squirrel@latest, @electron-forge/maker-zip@latest, @electron-forge/maker-deb@latest, @electron-forge/maker-rpm@latest, @electron-forge/plugin-auto-unpack-natives@latest, electron-squirrel-startup@latest
But faced an issue when I installed update-notifier.
The builds were going fine, but when I added update-notifier
, I got flooded with error messages saying for several tsconfig files
packages/publisher/snapcraft/tsconfig.json:4:15 - error TS6046: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext'.
4 "target": "ES2021",
Hi @TheLazron, I did some more digging and there is actually no need to use any external libraries to implement this, the codebase currently uses exec from child_process to execute npm show for getting the latest versions.
I closed the pr while resolving merge conflicts. I am going to raise a new pr to close the issue soon.
I am trying to do this from the electron-forge-start file in cli but I keep getting this error when i try npm start(electron-forge start) in the linked electron app.
Error [ERR_REQUIRE_ESM]: require() of ES Module
import updateNotifier from 'update-notifier';
const notifier = updateNotifier({
pkg: {
name: '@electron-forge/cli',
version: (await fs.readJson(path.resolve(__dirname, '../package.json'))).version,
},
updateCheckInterval: 1000 60 60,
});
notifier.notify();
Any advise?
Hi, After doing some research I found a more optimal alternative to update-notifier
I'll try using this for upgrade reminder.
Pre-flight checklist
Problem description
Forge users should stay up-to-date with the latest version as much as possible. We currently don't have a way of alerting people to bump their packages up.
Proposed solution
Docusaurus prints out this little message when you run a production build. Something similar for Forge would be nice.
Alternatives considered
Not showing a message.
Additional information
No response