Skip to content

Commit

Permalink
feat(errors): throw error instead of just logging it when checking pl…
Browse files Browse the repository at this point in the history
…ugin versions

additionally remove import for logger because it is not needed.
  • Loading branch information
JorensM committed Oct 6, 2023
1 parent df42d89 commit 61e3fb0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/docusaurus/src/server/siteMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import fs from 'fs-extra';
import path from 'path';
import logger from '@docusaurus/logger';
import {DOCUSAURUS_VERSION} from '@docusaurus/utils';
import type {
LoadedPlugin,
Expand Down Expand Up @@ -82,10 +81,9 @@ function checkDocusaurusPackagesVersion(siteMetadata: SiteMetadata) {
versionInfo.version &&
versionInfo.version !== docusaurusVersion
) {
// Should we throw instead? It still could work with different versions
logger.error`Invalid name=${plugin} version number=${versionInfo.version}.
throw new Error(`Invalid name=${plugin} version number=${versionInfo.version}.
All official @docusaurus/* packages should have the exact same version as @docusaurus/core (number=${docusaurusVersion}).
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file?`;
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file?`);
}
},
);
Expand Down

0 comments on commit 61e3fb0

Please sign in to comment.