fix(core): handle case where package.json is not available at CWD (#7187)

This commit is contained in:
Joshua Chen 2022-04-21 22:07:02 +08:00 committed by GitHub
parent e12947e818
commit 3b32a41f22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 16 deletions

View file

@ -16,6 +16,10 @@ export const NODE_MINOR_VERSION = parseInt(
10,
);
/** Docusaurus core version. */
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
export const DOCUSAURUS_VERSION = require('../package.json').version;
/**
* Can be overridden with cli option `--out-dir`. Code should generally use
* `context.outDir` instead (which is always absolute and localized).

View file

@ -8,6 +8,7 @@
export {
NODE_MAJOR_VERSION,
NODE_MINOR_VERSION,
DOCUSAURUS_VERSION,
DEFAULT_BUILD_DIR_NAME,
DEFAULT_CONFIG_FILE_NAME,
BABEL_CONFIG_FILE_NAME,