@pracht/cli 0.0.0 → 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # @pracht/cli
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#21](https://github.com/JoviDeCroock/pracht/pull/21) [`1243610`](https://github.com/JoviDeCroock/pracht/commit/12436100f9ce4a6dd749190570bf3b0dd1170308) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add README files to all packages
8
+
9
+ - [`c95bb72`](https://github.com/JoviDeCroock/pracht/commit/c95bb72c53a2d9012fde847139c276808ba5a9c3) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Fix SSG prerendered pages missing client JS script tag and framework context
10
+
11
+ Two issues caused prerendered (SSG) pages to ship without working hydration:
12
+
13
+ 1. **Vite 8 environment nesting**: The `@cloudflare/vite-plugin` outputs client assets
14
+ to `<outDir>/client/`, so `outDir: "dist/client"` produced `dist/client/client/`.
15
+ The CLI then couldn't find the Vite manifest, resulting in no `<script>` tag in
16
+ prerendered HTML. Fixed by setting `outDir: "dist"`.
17
+
18
+ 2. **Dual Preact context copies**: The CLI imported `prerenderApp` from its own
19
+ `@pracht/core`, while the server bundle had its own bundled copy. Different
20
+ `createContext` instances meant `useLocation()` returned `/` during prerendering,
21
+ breaking shell features like active link highlighting. Fixed by re-exporting
22
+ `prerenderApp` from the server module so the CLI uses the same bundled copy.
23
+
24
+ - Updated dependencies [[`1243610`](https://github.com/JoviDeCroock/pracht/commit/12436100f9ce4a6dd749190570bf3b0dd1170308), [`d64d7fc`](https://github.com/JoviDeCroock/pracht/commit/d64d7fc1e4a7b134259d1dfbb3d5a939599e42fc)]:
25
+ - @pracht/core@0.0.1
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @pracht/cli
2
+
3
+ Command-line tool for developing and building pracht apps.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @pracht/cli
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ### `pracht dev`
14
+
15
+ Start the local development server with SSR and HMR.
16
+
17
+ ### `pracht build`
18
+
19
+ Create a production build with client/server output and SSG/ISG prerendering.
20
+
21
+ ### `pracht preview`
22
+
23
+ Run a production smoke test against the built output.
package/bin/pracht.js CHANGED
@@ -66,11 +66,13 @@ async function dev() {
66
66
 
67
67
  async function build() {
68
68
  // 1. Client build
69
+ // Use outDir "dist" — Vite 8's environment API (used by @cloudflare/vite-plugin)
70
+ // outputs the client environment to <outDir>/client/, so "dist" → "dist/client/".
69
71
  console.log("\n Building client...\n");
70
72
  await viteBuild({
71
73
  root: process.cwd(),
72
74
  build: {
73
- outDir: "dist/client",
75
+ outDir: "dist",
74
76
  manifest: true,
75
77
  rollupOptions: {
76
78
  input: "virtual:pracht/client",
@@ -95,7 +97,9 @@ async function build() {
95
97
 
96
98
  if (existsSync(serverEntry)) {
97
99
  const serverMod = await import(serverEntry);
98
- const { prerenderApp } = await import("@pracht/core");
100
+ // Use prerenderApp from the server bundle to share the same Preact context
101
+ // instances as route/shell modules — avoids dual-copy issues during SSG.
102
+ const { prerenderApp } = serverMod;
99
103
 
100
104
  // Read the Vite manifest for asset URLs
101
105
  const manifestPath = resolve(clientDir, ".vite/manifest.json");
package/package.json CHANGED
@@ -1,11 +1,23 @@
1
1
  {
2
2
  "name": "@pracht/cli",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/JoviDeCroock/pracht",
7
+ "directory": "packages/cli"
8
+ },
9
+ "homepage": "https://github.com/JoviDeCroock/pracht/tree/main/packages/cli",
10
+ "bugs": {
11
+ "url": "https://github.com/JoviDeCroock/pracht/issues"
12
+ },
4
13
  "bin": {
5
14
  "pracht": "./bin/pracht.js"
6
15
  },
7
16
  "type": "module",
17
+ "publishConfig": {
18
+ "provenance": true
19
+ },
8
20
  "dependencies": {
9
- "@pracht/core": "0.0.0"
21
+ "@pracht/core": "0.0.1"
10
22
  }
11
23
  }