@phreshos/cli 0.1.37 → 0.1.38

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
@@ -113,7 +113,7 @@ phresh dev --run-option-path=/notes.md --run-option-line=42
113
113
  Read back by name, on either half:
114
114
 
115
115
  ```ts
116
- const path = await current.option("path")
116
+ const path = await context.option("path")
117
117
  ```
118
118
 
119
119
  **Options are text, all of them.** An option must mean the same thing
@@ -8,17 +8,16 @@ bun install
8
8
  bun run dev
9
9
  ```
10
10
 
11
- The complete authored source is intentionally small:
11
+ The complete Program is intentionally small:
12
12
 
13
13
  ```text
14
- source/
15
- ├── client/
16
- │ ├── app.tsx
17
- │ ├── index.html
18
- │ ├── main.tsx
19
- │ └── style.css
20
- └── server/
21
- └── main.ts
14
+ client/
15
+ ├── app.tsx
16
+ ├── index.html
17
+ ├── main.tsx
18
+ └── style.css
19
+ server/
20
+ └── main.ts
22
21
  ```
23
22
 
24
23
  `app.tsx` owns the small React component. The two `main` files are direct
@@ -1,21 +1,21 @@
1
- import { current } from "@phreshos/client"
1
+ import { context } from "@phreshos/client"
2
2
  import { useSubscribe } from "@phreshos/react"
3
3
  import { useEffect, useState } from "react"
4
4
 
5
5
  export default function App() {
6
6
  const [count, setCount] = useState<number>()
7
7
 
8
- useSubscribe(current.server, "changed", setCount)
8
+ useSubscribe(context.server, "changed", setCount)
9
9
 
10
10
  useEffect(() => {
11
- current.server.ask<number>("read").then(setCount)
11
+ context.server.ask<number>("read").then(setCount)
12
12
  }, [])
13
13
 
14
14
  return <main>
15
15
  <span>PhreshOS</span>
16
16
  <h1>Server counter</h1>
17
17
  <p>The Client talks directly to its Process Server.</p>
18
- <button type="button" onClick={() => current.server.publish("increment")}>
18
+ <button type="button" onClick={() => context.server.publish("increment")}>
19
19
  Count is {count ?? "…"}
20
20
  </button>
21
21
  </main>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "phresh",
3
3
  "private": true,
4
- "version": "0.1.20",
4
+ "version": "0.1.22",
5
5
  "description": "The official PhreshOS starter Program.",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -14,15 +14,15 @@
14
14
  "starter"
15
15
  ],
16
16
  "dependencies": {
17
- "@phreshos/client": "^0.1.24",
17
+ "@phreshos/client": "^0.1.25",
18
18
  "@phreshos/core": "^0.1.25",
19
- "@phreshos/react": "^0.1.12",
20
- "@phreshos/server": "^0.1.25",
19
+ "@phreshos/react": "^0.1.13",
20
+ "@phreshos/server": "^0.1.26",
21
21
  "react": "^19.2.8",
22
22
  "react-dom": "^19.2.8"
23
23
  },
24
24
  "devDependencies": {
25
- "@phreshos/cli": "^0.1.37",
25
+ "@phreshos/cli": "^0.1.38",
26
26
  "@types/node": "^26.2.0",
27
27
  "@types/react": "^19.2.18",
28
28
  "@types/react-dom": "^19.2.4",
@@ -4,7 +4,7 @@ export default defineConfig({
4
4
  identity: "phresh",
5
5
  name: "Phresh Program",
6
6
  description: "A minimal counter with direct Client and Server endpoints.",
7
- version: "0.1.20",
7
+ version: "0.1.22",
8
8
  icon: "icon.png",
9
9
  categories: ["Development"],
10
10
  keywords: ["example", "counter", "client", "server"],
@@ -14,7 +14,7 @@ export default defineConfig({
14
14
  location: "dist/server",
15
15
  entryFile: "main.js",
16
16
  development: {
17
- startCommand: "vite-node source/server/main.ts"
17
+ startCommand: "vite-node server/main.ts"
18
18
  }
19
19
  },
20
20
  client: {
@@ -1,10 +1,17 @@
1
+ import { externalDependencies } from "../vite.config"
1
2
  import { rm, writeFile } from "node:fs/promises"
3
+ import packageConfig from "../package.json" with { type: "json" }
2
4
 
3
5
  process.env.NODE_ENV = "production"
4
6
 
5
7
  const { build } = await import("vite")
6
8
 
9
+ const dependencies: Partial<typeof packageConfig.dependencies> = {}
10
+
7
11
  await rm("dist", { recursive: true, force: true })
12
+
13
+ for (const dependency of externalDependencies) dependencies[dependency] = packageConfig.dependencies[dependency]
14
+
8
15
  await build({ configFile: "vite.config.ts", ssr: { noExternal: true } })
9
16
  await build({ configFile: "vite.client.ts" })
10
- await writeFile("dist/server/package.json", JSON.stringify({ type: "module" }))
17
+ await writeFile("dist/server/package.json", JSON.stringify({ type: "module", dependencies }))
@@ -0,0 +1,10 @@
1
+ import { context } from "@phreshos/server"
2
+
3
+ let count = 0
4
+
5
+ context.answer("read", () => count)
6
+
7
+ context.subscribe("increment", () => {
8
+ count += 1
9
+ context.publish("changed", count)
10
+ })
@@ -3,7 +3,7 @@ import { defineConfig } from "vite"
3
3
  import { resolve } from "node:path"
4
4
 
5
5
  export default defineConfig({
6
- root: "source/client",
6
+ root: "client",
7
7
  plugins: [react()],
8
8
  base: "./",
9
9
  resolve: {
@@ -19,4 +19,4 @@ export default defineConfig({
19
19
  emptyOutDir: true,
20
20
  outDir: resolve(import.meta.dirname, "dist/client")
21
21
  }
22
- })
22
+ })
@@ -1,8 +1,14 @@
1
+ import packageConfig from "./package.json" with { type: "json" }
1
2
  import { defineConfig } from "vite"
2
3
  import { resolve } from "node:path"
3
4
 
5
+ export const externalDependencies: (keyof typeof packageConfig.dependencies)[] = []
6
+
4
7
  export default defineConfig({
5
- root: "source/server",
8
+ root: "server",
9
+ ssr: {
10
+ external: externalDependencies
11
+ },
6
12
  build: {
7
13
  ssr: true,
8
14
  emptyOutDir: true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "repository": "PhreshOS/phresh-program",
3
- "version": "0.1.20",
4
- "sha256": "645172d788eade71536ac9f9e31426eef7286d159846fb91382bcb49193b4f5e",
3
+ "version": "0.1.22",
4
+ "sha256": "f6892e1f1deee3764dbd5ac89fbe3884e2feb850a7a021ca2a0ff3df7e12db47",
5
5
  "development": true
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phreshos/cli",
3
3
  "type": "module",
4
- "version": "0.1.37",
4
+ "version": "0.1.38",
5
5
  "description": "The Phresh command-line interface for Program projects and system management.",
6
6
  "engines": {
7
7
  "node": ">=20.10"
@@ -1,10 +0,0 @@
1
- import { current } from "@phreshos/server"
2
-
3
- let count = 0
4
-
5
- current.answer("read", () => count)
6
-
7
- current.subscribe("increment", () => {
8
- count += 1
9
- current.publish("changed", count)
10
- })