diff --git a/docs/guide/deploying.md b/docs/guide/deploying.md index 2c703bb9..a5eebdb9 100644 --- a/docs/guide/deploying.md +++ b/docs/guide/deploying.md @@ -10,7 +10,7 @@ The following guides are based on some shared assumptions: { "scripts": { "docs:build": "vitepress build docs", - "docs:serve": "vitepress serve docs" + "docs:preview": "vitepress preview docs" } } ``` @@ -34,22 +34,22 @@ If your site is to be served at a subdirectory (`https://example.com/subdir/`), - Once you've built the docs, you can test them locally by running: ```sh - $ yarn docs:serve + $ yarn docs:preview ``` - The `serve` command will boot up a local static web server that will serve the files from `.vitepress/dist` at `http://localhost:4173`. It's an easy way to check if the production build looks fine in your local environment. + The `preview` command will boot up a local static web server that will serve the files from `.vitepress/dist` at `http://localhost:4173`. It's an easy way to check if the production build looks fine in your local environment. - You can configure the port of the server by passing `--port` as an argument. ```json { "scripts": { - "docs:serve": "vitepress serve docs --port 8080" + "docs:preview": "vitepress preview docs --port 8080" } } ``` - Now the `docs:serve` method will launch the server at `http://localhost:8080`. + Now the `docs:preview` method will launch the server at `http://localhost:8080`. ## Netlify, Vercel, AWS Amplify, Cloudflare Pages, Render diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index eebed450..2c1d037c 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -63,7 +63,7 @@ Add some scripts to `package.json`. "scripts": { "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", - "docs:serve": "vitepress serve docs" + "docs:preview": "vitepress preview docs" }, ... } diff --git a/package.json b/package.json index 6e26b878..33c4b1a3 100644 --- a/package.json +++ b/package.json @@ -62,12 +62,12 @@ "format": "prettier --check --write .", "format-fail": "prettier --check .", "check": "run-s format-fail build test", - "test": "run-p --aggregate-output test-unit test-serve test-build", + "test": "run-p --aggregate-output test-unit test-preview test-build", "test-unit": "vitest run -r __tests__/unit", - "test-serve": "vitest run -r __tests__/e2e", - "test-build": "VITE_TEST_BUILD=1 pnpm test-serve", - "debug-serve": "DEBUG=1 vitest -r __tests__/e2e", - "debug-build": "VITE_TEST_BUILD=1 pnpm debug-serve", + "test-preview": "vitest run -r __tests__/e2e", + "test-build": "VITE_TEST_BUILD=1 pnpm test-preview", + "debug-preview": "DEBUG=1 vitest -r __tests__/e2e", + "debug-build": "VITE_TEST_BUILD=1 pnpm debug-preview", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "release": "node scripts/release.js", "docs": "run-p dev docs-dev", @@ -75,7 +75,7 @@ "docs-debug": "node --inspect-brk ./bin/vitepress dev docs", "docs-build": "run-s build docs-build-only", "docs-build-only": "node ./bin/vitepress build docs", - "docs-serve": "node ./bin/vitepress serve docs" + "docs-preview": "node ./bin/vitepress preview docs" }, "dependencies": { "@docsearch/css": "^3.3.0", diff --git a/src/node/cli.ts b/src/node/cli.ts index 0d992fab..0bd1cb3e 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -32,7 +32,7 @@ if (!command || command === 'dev') { console.error(c.red(`build error:\n`), err) process.exit(1) }) -} else if (command === 'serve') { +} else if (command === 'serve' || command === 'preview') { serve(argv).catch((err) => { console.error(c.red(`failed to start server. error:\n`), err) process.exit(1)