diff --git a/packages/docusaurus/bin/docusaurus.mjs b/packages/docusaurus/bin/docusaurus.mjs index 98a03e66e51d..76cead11dbaf 100755 --- a/packages/docusaurus/bin/docusaurus.mjs +++ b/packages/docusaurus/bin/docusaurus.mjs @@ -104,6 +104,23 @@ cli ) .action(deploy); +/** + * @param {string | undefined} value + * @returns {boolean | number} + */ +function normalizePollValue(value) { + if (value === undefined || value === '') { + return false; + } + + const parsedIntValue = Number.parseInt(value, 10); + if (!Number.isNaN(parsedIntValue)) { + return parsedIntValue; + } + + return value === 'true'; +} + cli .command('start [siteDir]') .description('Start the development server.') @@ -122,6 +139,7 @@ cli .option( '--poll [interval]', 'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds', + normalizePollValue, ) .option( '--no-minify',