Skip to content

Commit 549a89d

Browse files
authored
Merge pull request #15 from PureStackStudio/dev-server-startup-perf
Dev server startup perf
2 parents 76c95a8 + 638c9c8 commit 549a89d

36 files changed

Lines changed: 1040 additions & 1202 deletions

File tree

‎frontend/purestack.studio/components/site/nav-menu/nav-menu-playground.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ const TREES: Record<TreeName, NavItem[]> = {
8989
title: 'Guides',
9090
icon: 'tabler:book',
9191
children: [
92-
{ title: 'Themes', url: '/guides/styling/themes/', icon: 'tabler:palette' },
92+
{
93+
title: 'Themes',
94+
url: '/guides/styling/themes/',
95+
icon: 'tabler:palette',
96+
},
9397
{
9498
title: 'Components',
9599
icon: 'tabler:components',
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"sequence": [
3-
"index.mdx",
4-
"regor.mdx",
5-
"plugins.mdx"
6-
]
2+
"sequence": ["index.mdx", "regor.mdx", "plugins.mdx"]
73
}

‎frontend/purestack.studio/guides/getting-started/purestack-cli.mdx‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Add `content/about.mdx` with its own title and body. Then start the preview serv
6666
yarn purestack serve --content ./content
6767
```
6868

69-
Open the URL printed as `serving at` after the first build. With the default settings it is `http://127.0.0.1:4173/`. The server binds to `0.0.0.0` by default; pass `--host 127.0.0.1` if it should listen only on your machine. If `basePath` is set in `siteConfig.json`, the printed URL includes it.
69+
Open the URL printed as `serving at` once shared setup finishes. Pages render as you open them. With the default settings the URL is `http://127.0.0.1:4173/`. The server binds to `0.0.0.0` by default; pass `--host 127.0.0.1` if it should listen only on your machine. If `basePath` is set in `siteConfig.json`, the printed URL includes it.
7070

7171
## Understand the content folder
7272

@@ -97,7 +97,7 @@ Every build command requires `--content <dir>`. The path is resolved from the wo
9797
| Command | Result | Output folder |
9898
| --- | --- | --- |
9999
| `build` | Generates the complete static site. | `outDir` |
100-
| `serve` | Builds the site, starts an HTTP server, and watches content by default. | `outDir` |
100+
| `serve` | Starts an HTTP server, renders pages on request, and watches content by default. | `outDir` |
101101
| `publish` | Cleans and builds a release artifact. | `publishDir` |
102102

103103
Use `yarn purestack --help` or `yarn purestack help` to print the CLI's own usage summary. Options can be written as `--content ./content` or `--content=./content`.
@@ -118,19 +118,25 @@ yarn purestack build --content ./content --clean
118118
```sh
119119
yarn purestack serve --content ./content
120120
yarn purestack serve --content ./content --host 127.0.0.1 --port 4300
121+
yarn purestack serve --content ./content --clean --full-render
121122
```
122123

123-
The server uses port `4173` and host `0.0.0.0` unless you override them. It serves files from `outDir`, checks watched content changes, and reloads open pages after changes. Content changes are handled incrementally where possible; a change to `siteConfig.json`, to `purestack.config.ts`, or to a file the config imports causes a full rebuild so the new settings and plugins are applied.
124+
The server uses port `4173` and host `0.0.0.0` unless you override them. By default, startup prepares routes, navigation, and shared page sections. Each page renders on its first request and is cached for later requests; static assets copy when requested. Watched edits invalidate affected pages so they render again on the next request, and open pages reload automatically. Changes to `siteConfig.json`, `purestack.config.ts`, or a file the config imports refresh shared setup and invalidate cached pages.
125+
126+
Use `--full-render` when you need every page, asset, and the complete search index generated before browsing. It runs one full build at startup, and site requests wait for that build to finish. After startup, watched edits use the same incremental invalidation and rendering on request as the default mode.
127+
128+
When search is enabled, the default mode builds its search index when a Pagefind asset is requested and includes only pages opened in the current session. `--full-render` starts with a complete search index; later changes are handled incrementally. `build` and `publish` always index the complete site.
124129

125130
These options belong to `serve`:
126131

127132
| Option | Effect |
128133
| --- | --- |
129134
| `--host <host>` | Listen on a particular interface, for example `127.0.0.1`. |
130135
| `--port <port>` | Listen on a different port. |
131-
| `--clean` | Remove `outDir` before the initial build. |
132-
| `--no-watch` | Keep the server running without watching the content directory. The initial build still runs. |
133-
| `--no-reload` | Keep watching and rebuilding, but do not inject the browser live reload script. |
136+
| `--clean` | Remove `outDir` before setup and when config changes reset shared setup. |
137+
| `--full-render` | Build every page, asset, and the complete search index once at startup. Watched edits remain incremental. |
138+
| `--no-watch` | Keep the server running without watching the content directory. Pages still render on request, or all at startup with `--full-render`. |
139+
| `--no-reload` | Keep watching and updating the site, but do not inject the browser live reload script. |
134140

135141
Watching and browser reload are separate. For example, `--no-reload` is useful if another browser tool manages refreshes. The server displays page build errors as diagnostic pages so you can correct the source and continue editing.
136142

@@ -169,10 +175,8 @@ The home page stays at `dist/site/index.html`, but links and the development ser
169175
| --- | --- |
170176
| `Missing required --content <dir> option` | Pass `--content` to `build`, `serve`, or `publish`. |
171177
| `Missing required siteConfig.json` | Check the path passed to `--content` and the file's exact name. |
172-
| `Unknown option` | Run `yarn purestack --help`; `--host`, `--port`, `--no-watch`, and `--no-reload` apply only to `serve`. |
178+
| `Unknown option` | Run `yarn purestack --help`; `--host`, `--port`, `--no-watch`, `--no-reload`, and `--full-render` apply only to `serve`. |
173179
| `Could not bundle …purestack.config.ts` | Check the imports in `purestack.config.ts` and the files it imports; the message names the import that failed. |
174180
| `Duplicate content routes detected` | Find two files that map to the same URL, such as `guide/index.md` and `guide/guide.mdx`. |
175181
| A page or asset returns 404 under a subpath | Check `basePath`, the URL printed by `serve`, and the path at which your host serves the output folder. |
176182
| `publish` fails while `serve` displayed an error page | Fix the page or asset error shown by the development server, then rerun `publish`. |
177-
178-
The checked-in [sample content](https://github.com/PureStackStudio/PureStack/tree/main/packages/ts-ssg/sample-content) is a larger working site. PureStack Studio adds its own skin, components, styles, and templates through a [plugin](https://github.com/PureStackStudio/PureStack/blob/main/frontend/studioPlugin.ts) listed in its [`purestack.config.ts`](https://github.com/PureStackStudio/PureStack/blob/main/frontend/purestack.studio/purestack.config.ts); `yarn frontend` runs `purestack serve` on that site.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"sequence": [
3-
"index.mdx",
4-
"search-and-metadata.mdx",
5-
"deployment.mdx"
6-
]
2+
"sequence": ["index.mdx", "search-and-metadata.mdx", "deployment.mdx"]
73
}

‎package.json‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "purestack-repo",
4-
"version": "1.1.3",
4+
"version": "1.1.4",
55
"packageManager": "yarn@4.18.1",
66
"type": "module",
77
"sideEffects": false,
@@ -25,9 +25,8 @@
2525
"tsx": "^4.23.15",
2626
"typescript": "7.0.2",
2727
"typescript-parser": "npm:typescript@6.0.3",
28-
"vite": "^8.3.1",
29-
"vite-tsconfig-paths": "^6.1.1",
30-
"vitest": "^4.0.18"
28+
"vite": "^8.3.2",
29+
"vitest": "^5.0.3"
3130
},
3231
"files": [],
3332
"scripts": {

‎packages/purestack/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "purestack",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/purestack.mjs",
66
"types": "./dist/purestack.d.mts",

‎packages/purestack/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const version: string = '1.1.3'
1+
export const version: string = '1.1.4'
22

33
export * from '@purestack/ts-ssg'

‎packages/ts-common/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-common",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-common.mjs",
66
"types": "./dist/ts-common.d.mts",

‎packages/ts-components/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-components",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-components.mjs",
66
"types": "./dist/ts-components.d.mts",

‎packages/ts-css/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-css",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-css.mjs",
66
"types": "./dist/ts-css.d.mts",

0 commit comments

Comments
 (0)