Skip to content

Commit

Permalink
fix: canary releases should ignore notifier updates (#5381)
Browse files Browse the repository at this point in the history
* canary releases should ignore notifier updates

* typo!
  • Loading branch information
slorber authored Aug 19, 2021
1 parent f9c79cb commit 85b8e7f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/docusaurus/bin/beforeCli.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,23 @@ if (
notifier.check();
}

// We don't want to display update message for canary releases
// See https://github.com/facebook/docusaurus/issues/5378
function ignoreUpdate(update) {
const isCanaryRelease =
update && update.current && update.current.startsWith('0.0.0');
return isCanaryRelease;
}

if (notifier.update && notifier.update.current !== notifier.update.latest) {
// Because notifier clears cached data after reading it, leading to notifier not consistently displaying the update
// See https://github.com/yeoman/update-notifier/issues/209
notifier.config.set('update', notifier.update);

if (ignoreUpdate(notifier.update)) {
return;
}

// eslint-disable-next-line import/no-dynamic-require, global-require
const sitePkg = require(path.resolve(process.cwd(), 'package.json'));
const siteDocusaurusPackagesForUpdate = Object.keys({
Expand Down

0 comments on commit 85b8e7f

Please sign in to comment.