mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 17:17:28 +02:00
feat(v2): add ability disable to open page in browser when start command (#1856)
* feat(v2): add ability disable to open page in browser when start command * Replace disable-open-browser with no-open * Fixes
This commit is contained in:
parent
9eb05d8711
commit
e408d72d26
5 changed files with 7 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
- Add `extendCli` api for plugins. This will allow plugin to further extend Docusaurus CLI.
|
- Add `extendCli` api for plugins. This will allow plugin to further extend Docusaurus CLI.
|
||||||
- Fix `swizzle` command not being able to swizzle single js file.
|
- Fix `swizzle` command not being able to swizzle single js file.
|
||||||
- Fix logo URL in footer to be appended with baseUrl automatically.
|
- Fix logo URL in footer to be appended with baseUrl automatically.
|
||||||
|
- Add the option `--no-open` for `start` command.
|
||||||
|
|
||||||
## 2.0.0-alpha.27
|
## 2.0.0-alpha.27
|
||||||
|
|
||||||
|
|
1
packages/docusaurus-types/src/index.d.ts
vendored
1
packages/docusaurus-types/src/index.d.ts
vendored
|
@ -49,6 +49,7 @@ export interface StartCLIOptions {
|
||||||
port: string;
|
port: string;
|
||||||
host: string;
|
host: string;
|
||||||
hotOnly: boolean;
|
hotOnly: boolean;
|
||||||
|
open: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BuildCLIOptions {
|
export interface BuildCLIOptions {
|
||||||
|
|
|
@ -70,11 +70,13 @@ cli
|
||||||
'--hot-only',
|
'--hot-only',
|
||||||
'Do not fallback to page refresh if hot reload fails (default: false)',
|
'Do not fallback to page refresh if hot reload fails (default: false)',
|
||||||
)
|
)
|
||||||
.action((siteDir = '.', {port, host, hotOnly}) => {
|
.option('--no-open', 'Do not open page in the browser (default: false)')
|
||||||
|
.action((siteDir = '.', {port, host, hotOnly, open}) => {
|
||||||
wrapCommand(start)(path.resolve(siteDir), {
|
wrapCommand(start)(path.resolve(siteDir), {
|
||||||
port,
|
port,
|
||||||
host,
|
host,
|
||||||
hotOnly,
|
hotOnly,
|
||||||
|
open,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ export async function start(
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
openBrowser(openUrl);
|
cliOptions.open && openBrowser(openUrl);
|
||||||
});
|
});
|
||||||
['SIGINT', 'SIGTERM'].forEach(sig => {
|
['SIGINT', 'SIGTERM'].forEach(sig => {
|
||||||
process.on(sig as NodeJS.Signals, () => {
|
process.on(sig as NodeJS.Signals, () => {
|
||||||
|
|
|
@ -48,6 +48,7 @@ Builds and serves the static site with [Webpack Dev Server](https://webpack.js.o
|
||||||
|`--port`|`3000`|Specifies the port of the dev server|
|
|`--port`|`3000`|Specifies the port of the dev server|
|
||||||
|`--host`|`localhost`|Specify a host to use. E.g., if you want your server to be accessible externally, you can use `--host 0.0.0.0`|
|
|`--host`|`localhost`|Specify a host to use. E.g., if you want your server to be accessible externally, you can use `--host 0.0.0.0`|
|
||||||
|`--hot-only`|`false`|Enables Hot Module Replacement without page refresh as fallback in case of build failures. More information [here](https://webpack.js.org/configuration/dev-server/#devserverhotonly).|
|
|`--hot-only`|`false`|Enables Hot Module Replacement without page refresh as fallback in case of build failures. More information [here](https://webpack.js.org/configuration/dev-server/#devserverhotonly).|
|
||||||
|
|`--no-open`|`false`|Do not open automatically the page in the browser.|
|
||||||
|
|
||||||
### `docusaurus build`
|
### `docusaurus build`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue