From aed387d13485a52d87ed8edaef95c20e13774914 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 29 May 2026 16:04:17 +0200 Subject: [PATCH 1/3] restore cli args for dev server https --- packages/docusaurus/src/commands/cli.ts | 3 --- packages/docusaurus/src/commands/start/start.ts | 4 ---- packages/docusaurus/src/commands/start/webpack.ts | 4 ---- 3 files changed, 11 deletions(-) diff --git a/packages/docusaurus/src/commands/cli.ts b/packages/docusaurus/src/commands/cli.ts index 2a1b1f897396..cbce9944cfa1 100755 --- a/packages/docusaurus/src/commands/cli.ts +++ b/packages/docusaurus/src/commands/cli.ts @@ -203,8 +203,6 @@ export async function createCLIProgram({ '--no-minify', 'build website without minimizing JS bundles (default: false)', ) - /* - TODO .option( '--https', 'serve the dev site over HTTPS using a self-signed cert (default: false). Preferred over the HTTPS=true env var. Implied when both --ssl-cert and --ssl-key are provided.', @@ -217,7 +215,6 @@ export async function createCLIProgram({ '--ssl-key ', 'path to a TLS private key file (implies HTTPS). Preferred over the SSL_KEY_FILE env var; CLI takes precedence if both are set.', ) - */ .action(start); cli diff --git a/packages/docusaurus/src/commands/start/start.ts b/packages/docusaurus/src/commands/start/start.ts index 10d7412abeac..e98579d63283 100644 --- a/packages/docusaurus/src/commands/start/start.ts +++ b/packages/docusaurus/src/commands/start/start.ts @@ -19,13 +19,9 @@ export type StartCLIOptions = HostPortOptions & open?: boolean; poll?: boolean | number; minify?: boolean; - - /* - TODO Docusaurus v4: wire new CLI parameters https?: true; sslCert?: string; sslKey?: string; - */ }; async function doStart( diff --git a/packages/docusaurus/src/commands/start/webpack.ts b/packages/docusaurus/src/commands/start/webpack.ts index 7082c75c168d..fd349abaf9c8 100644 --- a/packages/docusaurus/src/commands/start/webpack.ts +++ b/packages/docusaurus/src/commands/start/webpack.ts @@ -61,13 +61,9 @@ async function createDevServerConfig({ const pollingOptions = createPollingOptions(cliOptions); const httpsConfig = await getHttpsConfig({ - /* - TODO Docusaurus v4: wire new CLI parameters https: cliOptions.https, sslCert: cliOptions.sslCert, sslKey: cliOptions.sslKey, - - */ }); // https://webpack.js.org/configuration/dev-server From 3424bcb3c22beb2071f3054e1a75f2eee17e4bc3 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 29 May 2026 16:04:37 +0200 Subject: [PATCH 2/3] fix lockfile --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 15fc0b9ed6fd..2389b92f8899 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4263,7 +4263,7 @@ resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.40.tgz#3563f7e8ce8708f5fda43eb8e0956ef11e0da320" integrity sha512-OXtKsLU1bVtInzzDEAY2sYiF/rl4tvAnLLLpuMp3HzAOQZ5A+i69AKDhA1YLQTaMAqO3vzyYNVAYVRMPtSYD4w== -"@swc/core@^1.15.32", "@swc/core@^1.15.40": +"@swc/core@^1.15.40": version "1.15.40" resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.15.40.tgz#941c949aa88c0d8d291f102f519f3c2c77701b90" integrity sha512-2kwzJikRvgtNAG7MwVZY2vEzZjTxKIq5jXOihuSV/8U+Hej8Va22t65aKnJZs3P+NwojZvR8Mf8kyM7O+V8sQg== From 7c1df2ee40b5b66985f271472ba5c01f4736e5b7 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 29 May 2026 16:19:53 +0200 Subject: [PATCH 3/3] Add dev server https cli options docs --- website/docs/cli.mdx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/website/docs/cli.mdx b/website/docs/cli.mdx index 1541e41f983d..b294153e18b5 100644 --- a/website/docs/cli.mdx +++ b/website/docs/cli.mdx @@ -45,6 +45,9 @@ Builds and serves a preview of your site locally with [Webpack Dev Server](https | `--config` | `undefined` | Path to Docusaurus config file, default to `[siteDir]/docusaurus.config.js` | | `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). | | `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. | +| `--https` | `false` | Serve the dev site over HTTPS using a self-signed certificate. Implied when both `--ssl-cert` and `--ssl-key` are provided. | +| `--ssl-cert` | `undefined` | Path to a TLS certificate file (implies HTTPS). | +| `--ssl-key` | `undefined` | Path to a TLS private key file (implies HTTPS). | :::info @@ -70,14 +73,24 @@ There are multiple ways to obtain a certificate. We will use [mkcert](https://gi 2. Run `mkcert -install` to install the cert in your trust store, and restart your browser -3. Start the app with Docusaurus HTTPS env variables: +3. Start the app with the Docusaurus HTTPS CLI options: -```bash -HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem yarn start +```bash npm2yarn +npm run start -- --ssl-cert localhost.pem --ssl-key localhost-key.pem ``` 4. Open `https://localhost:3000/` +:::tip Self-signed certificate + +Use the `--https` option to serve the dev site over HTTPS with an automatically generated self-signed certificate: + +```bash npm2yarn +npm run start -- --https +``` + +::: + ### `docusaurus build [siteDir]` {/* #docusaurus-build-sitedir */} Compiles your site for production.