mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 21:32:38 +02:00
fix(core): normalize input for poll option (#8342)
Fixes https://github.com/facebook/docusaurus/issues/8306
This commit is contained in:
parent
5d2dd9b6b4
commit
029417154c
1 changed files with 18 additions and 0 deletions
|
@ -104,6 +104,23 @@ cli
|
||||||
)
|
)
|
||||||
.action(deploy);
|
.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
|
cli
|
||||||
.command('start [siteDir]')
|
.command('start [siteDir]')
|
||||||
.description('Start the development server.')
|
.description('Start the development server.')
|
||||||
|
@ -122,6 +139,7 @@ cli
|
||||||
.option(
|
.option(
|
||||||
'--poll [interval]',
|
'--poll [interval]',
|
||||||
'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
|
'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
|
||||||
|
normalizePollValue,
|
||||||
)
|
)
|
||||||
.option(
|
.option(
|
||||||
'--no-minify',
|
'--no-minify',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue