uniweb 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -136,10 +136,32 @@ npm install -g uniweb
136
136
  **Requirements:**
137
137
 
138
138
  - Node.js 20.19 or later
139
- - pnpm 9+ (recommended) or npm 10+
139
+ - pnpm 10+ (recommended) or npm 10+
140
140
 
141
141
  Projects use Vite 7 and Tailwind CSS v4 by default.
142
142
 
143
+ ### Setting up pnpm
144
+
145
+ Uniweb projects use pnpm for dependency management. The easiest way to get pnpm is via **Corepack**, which ships with Node.js.
146
+
147
+ **Enable Corepack (one-time setup):**
148
+
149
+ ```bash
150
+ corepack enable
151
+ ```
152
+
153
+ > **Node 25+**: Corepack is no longer bundled. Install it first:
154
+ > ```bash
155
+ > npm i -g corepack && corepack enable
156
+ > ```
157
+
158
+ **Troubleshooting:**
159
+
160
+ - If `pnpm` isn't found after enabling Corepack, you may have a global pnpm installation shadowing it. Remove it with `npm uninstall -g pnpm`.
161
+ - Alternatively, install pnpm directly: `npm install -g pnpm`
162
+
163
+ Once Corepack is enabled, running `pnpm install` in a Uniweb project will automatically use the correct pnpm version specified in `package.json`.
164
+
143
165
  ## Commands
144
166
 
145
167
  ### `create`
@@ -204,6 +226,8 @@ uniweb build [options]
204
226
  | Option | Description |
205
227
  | ------------------- | --------------------------------------------------------------------- |
206
228
  | `--target <type>` | Build target: `foundation` or `site` (auto-detected if not specified) |
229
+ | `--prerender` | Pre-render pages to static HTML (SSG) - site builds only |
230
+ | `--foundation-dir` | Path to foundation directory (for prerendering) |
207
231
  | `--platform <name>` | Deployment platform (e.g., `vercel`) for platform-specific output |
208
232
 
209
233
  **Examples:**
@@ -218,10 +242,47 @@ uniweb build --target foundation
218
242
  # Explicitly build as site
219
243
  uniweb build --target site
220
244
 
245
+ # Build site with pre-rendering (SSG)
246
+ uniweb build --prerender
247
+
221
248
  # Build for Vercel deployment
222
249
  uniweb build --platform vercel
223
250
  ```
224
251
 
252
+ ### Pre-rendering (SSG)
253
+
254
+ The `--prerender` flag generates static HTML for each page at build time. This is useful for:
255
+
256
+ - **SEO**: Search engines see fully rendered content immediately
257
+ - **Performance**: First contentful paint is instant (no JavaScript required)
258
+ - **Hosting**: Deploy to any static host (GitHub Pages, Netlify, S3, etc.)
259
+
260
+ **How it works:**
261
+
262
+ 1. The site build runs first, generating the JavaScript bundle and `site-content.json`
263
+ 2. The prerenderer loads the foundation and site content in Node.js
264
+ 3. Each page is rendered to HTML using React's `renderToString()`
265
+ 4. The HTML is injected into the shell with the site content embedded
266
+
267
+ **Hydration:**
268
+
269
+ The pre-rendered HTML includes a `<script id="__SITE_CONTENT__">` tag with the full site data. When the page loads in the browser:
270
+
271
+ 1. The static HTML displays immediately (no flash of loading state)
272
+ 2. React hydrates the existing DOM instead of replacing it
273
+ 3. The site becomes fully interactive with client-side routing
274
+
275
+ **Usage:**
276
+
277
+ ```bash
278
+ # From site directory
279
+ cd site
280
+ pnpm build:ssg
281
+
282
+ # Or from workspace root
283
+ cd site && uniweb build --prerender
284
+ ```
285
+
225
286
  ## Built-in Templates
226
287
 
227
288
  ### Single (Default)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,9 +36,9 @@
36
36
  "js-yaml": "^4.1.0",
37
37
  "prompts": "^2.4.2",
38
38
  "tar": "^7.0.0",
39
- "@uniweb/build": "0.1.10",
40
- "@uniweb/core": "0.1.6",
39
+ "@uniweb/build": "0.1.12",
41
40
  "@uniweb/runtime": "0.2.5",
41
+ "@uniweb/core": "0.1.6",
42
42
  "@uniweb/kit": "0.1.4"
43
43
  }
44
44
  }
package/src/versions.js CHANGED
@@ -67,7 +67,7 @@ export function getResolvedVersions() {
67
67
  // When publishing with pnpm, workspace:* gets resolved to actual versions.
68
68
  // Fallbacks are only used during local development.
69
69
  resolvedVersions = {
70
- '@uniweb/build': resolveVersionSpec(deps['@uniweb/build'], '^0.1.10'),
70
+ '@uniweb/build': resolveVersionSpec(deps['@uniweb/build'], '^0.1.12'),
71
71
  '@uniweb/core': resolveVersionSpec(deps['@uniweb/core'], '^0.1.6'),
72
72
  '@uniweb/kit': resolveVersionSpec(deps['@uniweb/kit'], '^0.1.4'),
73
73
  '@uniweb/runtime': resolveVersionSpec(deps['@uniweb/runtime'], '^0.2.3'),
@@ -3,6 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
6
+ "packageManager": "pnpm@10.0.0",
6
7
  "scripts": {
7
8
  "dev": "pnpm --filter site dev",
8
9
  "build": "pnpm --filter foundation build && pnpm --filter site build",
@@ -3,6 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
6
+ "packageManager": "pnpm@10.0.0",
6
7
  "scripts": {
7
8
  "dev": "pnpm --filter main dev",
8
9
  "dev:all": "pnpm -r dev",
@@ -7,6 +7,7 @@
7
7
  "dev": "vite",
8
8
  "dev:runtime": "VITE_FOUNDATION_MODE=runtime vite",
9
9
  "build": "vite build",
10
+ "build:ssg": "vite build && uniweb build --prerender",
10
11
  "preview": "vite preview"
11
12
  },
12
13
  "dependencies": {
@@ -7,6 +7,7 @@
7
7
  "dev": "vite",
8
8
  "dev:runtime": "VITE_FOUNDATION_MODE=runtime vite",
9
9
  "build": "vite build",
10
+ "build:ssg": "vite build && uniweb build --prerender",
10
11
  "preview": "vite preview"
11
12
  },
12
13
  "dependencies": {
@@ -3,6 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
6
+ "packageManager": "pnpm@10.0.0",
6
7
  "scripts": {
7
8
  "dev": "pnpm --filter site dev",
8
9
  "build": "pnpm --filter foundation build && pnpm --filter site build",
@@ -7,6 +7,7 @@
7
7
  "dev": "vite",
8
8
  "dev:runtime": "VITE_FOUNDATION_MODE=runtime vite",
9
9
  "build": "vite build",
10
+ "build:ssg": "vite build && uniweb build --prerender",
10
11
  "preview": "vite preview"
11
12
  },
12
13
  "dependencies": {