@zktx.io/walrus-sites-preview 0.0.3 → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zktx.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,35 +1,105 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/zktx-io/walrus-sites-preview/main/Walrus_Logotype_Black.png" alt="Walrus" width="360" />
3
+ </p>
4
+
1
5
  # Walrus Sites Preview
2
6
 
3
- Preview Walrus Sites already deployed on testnet or mainnet locally using a familiar
4
- npm → localhost workflow — without setting up a portal.
7
+ Preview Walrus Sites already deployed on testnet or mainnet through a familiar
8
+ **npm → localhost** workflow.
9
+
10
+ Walrus Sites Preview is a small CLI for opening a current deployment locally
11
+ during design review, QA, planning review, or stakeholder feedback. It is meant
12
+ to sit alongside existing Walrus portal and deployment workflows, not replace
13
+ them.
14
+
15
+ A developer can share one command, and teammates can review the deployed site on
16
+ `localhost` using the same kind of browser workflow they use for regular web
17
+ projects.
18
+
19
+ ---
20
+
21
+ ## Demo Video
22
+
23
+ A short demo showing how to preview a deployed Walrus Site locally:
24
+
25
+ https://github.com/user-attachments/assets/c28c033a-92c5-4ee9-82e0-1406319842c7
26
+
27
+ The preview URL used in the demo is `http://localhost:3000`.
28
+
29
+ ---
30
+
31
+ ## Quickstart (one-liner)
32
+
33
+ Preview a deployed Walrus Site in a single command.
34
+
35
+ For mainnet:
36
+
37
+ ```sh
38
+ npx @zktx.io/walrus-sites-preview 0xYOUR_SITE_OBJECT_ID
39
+ ```
40
+
41
+ For testnet:
42
+
43
+ ```sh
44
+ npx @zktx.io/walrus-sites-preview -testnet 0xYOUR_SITE_OBJECT_ID
45
+ ```
5
46
 
6
- This tool is for developers who want to quickly preview or debug a deployed Walrus Site in a simple, local-style environment.
47
+ Then open:
48
+
49
+ ```text
50
+ http://localhost:3000
51
+ ```
52
+
53
+ You can also add `--open` to open the browser automatically:
54
+
55
+ ```sh
56
+ npx @zktx.io/walrus-sites-preview 0xYOUR_SITE_OBJECT_ID --open
57
+ ```
7
58
 
8
59
  ---
9
60
 
10
61
  ## Why this exists
11
62
 
12
- Previewing a Walrus Site on testnet usually requires setting up a portal, which can be difficult for beginners and unnecessary for quick debugging.
63
+ Walrus portals remain the right place for production access, integration
64
+ testing, and portal-specific behavior. This CLI covers a narrower case: quickly
65
+ checking an already deployed site during an internal review cycle.
66
+
67
+ In that situation, teams often need a simple browser URL for the current
68
+ deployment while keeping the existing deployment pipeline unchanged. Provide a
69
+ site object ID, and this CLI fetches the resources and serves a local preview.
13
70
 
14
- This CLI removes that friction.
15
- Give it a site object ID, and it serves the site locally.
71
+ The goal is to make review handoff simpler while preserving the established
72
+ Walrus workflow.
16
73
 
17
74
  ---
18
75
 
19
76
  ## What it does
20
77
 
21
78
  - Loads a Walrus Site using a site object ID
22
- - Fetches resources via Sui RPC + Walrus aggregator
23
- - Serves the site locally (e.g. `http://localhost:3000`)
24
- - Focused purely on developer preview and debugging
79
+ - Fetches resources via Sui RPC and the Walrus aggregator
80
+ - Serves the site locally (for example, `http://localhost:3000`)
81
+ - Provides a local review path that can sit alongside portal-based workflows
82
+ - Supports preview, debugging, QA, and review workflows
83
+
84
+ This is **not** a production hosting solution and does not replace Walrus portals.
25
85
 
26
- This is not a production hosting solution and does not replace portals.
86
+ ---
87
+
88
+ ## Who this is for
89
+
90
+ - Developers who want a quick local preview of an already deployed Walrus Site
91
+ - Web designers reviewing visual changes from a testnet deployment
92
+ - Planners, PMs, and QA reviewers checking an in-progress site before release
93
+ - Teams that want a lightweight local review command for deployed Walrus Sites
94
+
95
+ For many internal review sessions, a reviewer can start with the command and the
96
+ site object ID. Wallets and deployment keys are not part of the preview flow.
27
97
 
28
98
  ---
29
99
 
30
100
  ## Requirements
31
101
 
32
- - Node.js 18+
102
+ - Node.js 18 or later
33
103
 
34
104
  ---
35
105
 
@@ -39,17 +109,20 @@ This is not a production hosting solution and does not replace portals.
39
109
  npm i -D @zktx.io/walrus-sites-preview
40
110
  ```
41
111
 
112
+ > Note: This package is published as a scoped npm package:
113
+ > `@zktx.io/walrus-sites-preview`
114
+
42
115
  ---
43
116
 
44
- ## Quick Start
117
+ ## Quick Start (npm scripts)
45
118
 
46
- Add an npm script to your project:
119
+ Add an npm script to your project so teammates can run a familiar command:
47
120
 
48
121
  ```json
49
122
  {
50
123
  "scripts": {
51
- "preview:testnet": "preview -testnet -id 0xYOUR_SITE_OBJECT_ID -port 3000",
52
- "preview:mainnet": "preview -mainnet -id 0xYOUR_SITE_OBJECT_ID -port 3000"
124
+ "preview:testnet": "walrus-sites-preview -testnet 0xYOUR_SITE_OBJECT_ID -port 3000",
125
+ "preview:mainnet": "walrus-sites-preview 0xYOUR_SITE_OBJECT_ID -port 3000"
53
126
  }
54
127
  }
55
128
  ```
@@ -62,23 +135,65 @@ npm run preview:testnet
62
135
 
63
136
  Then open:
64
137
 
65
- `http://localhost:3000`
138
+ ```text
139
+ http://localhost:3000
140
+ ```
66
141
 
67
142
  You can inspect the resolved configuration at:
68
143
 
69
- `http://localhost:3000/__config`
144
+ ```text
145
+ http://localhost:3000/__config
146
+ ```
147
+
148
+ ---
149
+
150
+ ## How to get a Site Object ID
151
+
152
+ `walrus-sites-preview` requires a **Walrus Site Object ID**.
153
+
154
+ When a site is deployed to Walrus Sites — whether via the official site-builder CLI or a CI workflow — the **Site Object ID is printed in the deployment output**.
155
+
156
+ Look for a line similar to:
157
+
158
+ ```text
159
+ Site object ID: 0x...
160
+ ```
161
+
162
+ or:
163
+
164
+ ```text
165
+ "site_obj_id": "0x..."
166
+ ```
167
+
168
+ Copy this value and pass it to the preview command.
169
+
170
+ For detailed deployment guides, see:
171
+
172
+ - Publishing a Walrus Site (official docs):
173
+ [https://docs.wal.app/docs/sites/getting-started/publishing-your-first-site](https://docs.wal.app/docs/sites/getting-started/publishing-your-first-site)
174
+ - Deploying via GitHub Actions (walrus-sites-provenance):
175
+ [https://github.com/marketplace/actions/walrus-sites-provenance](https://github.com/marketplace/actions/walrus-sites-provenance)
176
+
177
+ > This tool does not deploy or update sites.
178
+ > It only previews already deployed Walrus Sites.
70
179
 
71
180
  ---
72
181
 
73
182
  ## Configuration
74
183
 
75
- You can optionally create a `config.json` next to your `package.json`.
184
+ You may optionally create a `config.json` next to your `package.json`.
185
+
186
+ CLI flags always override file-based configuration.
76
187
 
77
- CLI flags always override file-based config.
188
+ When using `-testnet` or `-mainnet`, the following values are filled automatically:
78
189
 
79
- If you use `-testnet` or `-mainnet`, the required RPC and aggregator URLs are filled automatically.
190
+ - `rpcUrlList`
191
+ - `aggregatorUrl`
192
+ - `sitePackage`
80
193
 
81
- `config.json` supports:
194
+ The positional one-liner defaults to mainnet. Pass `-testnet` for testnet sites.
195
+
196
+ ### Supported fields
82
197
 
83
198
  - `siteObjectId` (required)
84
199
  - `rpcUrlList` (required unless using `-testnet` / `-mainnet`)
@@ -87,7 +202,7 @@ If you use `-testnet` or `-mainnet`, the required RPC and aggregator URLs are fi
87
202
  - `network` (optional, informational)
88
203
  - `host`, `port` (via CLI flags)
89
204
 
90
- Example:
205
+ ### Example
91
206
 
92
207
  ```json
93
208
  {
@@ -99,7 +214,11 @@ Example:
99
214
  }
100
215
  ```
101
216
 
102
- To pass arguments dynamically:
217
+ ---
218
+
219
+ ## Passing arguments dynamically
220
+
221
+ Install the package:
103
222
 
104
223
  ```sh
105
224
  npm i -D @zktx.io/walrus-sites-preview
@@ -110,7 +229,7 @@ Add a pass-through script:
110
229
  ```json
111
230
  {
112
231
  "scripts": {
113
- "preview": "preview"
232
+ "preview": "walrus-sites-preview"
114
233
  }
115
234
  }
116
235
  ```
@@ -118,7 +237,7 @@ Add a pass-through script:
118
237
  Then run:
119
238
 
120
239
  ```sh
121
- npm run preview -- -testnet -id 0xYOUR_SITE_OBJECT_ID -port 3000
240
+ npm run preview -- -testnet 0xYOUR_SITE_OBJECT_ID -port 3000
122
241
  ```
123
242
 
124
243
  ---
@@ -127,9 +246,19 @@ npm run preview -- -testnet -id 0xYOUR_SITE_OBJECT_ID -port 3000
127
246
 
128
247
  This package vendors and adapts parts of the Walrus Sites portal source code.
129
248
 
130
- Where `dist` comes from (portal build):
249
+ The vendored portal worker code is currently aligned with the upstream
250
+ `portal/worker` package version `2.9.0`.
131
251
 
132
- - Source repo: https://github.com/MystenLabs/walrus-sites/tree/main/portal
252
+ Origin of the bundled `dist` assets (portal build):
253
+
254
+ - Source repository:
255
+ [https://github.com/MystenLabs/walrus-sites/tree/main/portal](https://github.com/MystenLabs/walrus-sites/tree/main/portal)
133
256
  - `portal/worker` → `./portal-worker`
134
257
  - `portal/common` → `./portal-common`
135
- - Source: `./portal-worker/src` (service worker TypeScript) and `./portal-worker/static` (static assets)
258
+ - Included sources:
259
+ - `./portal-worker/src` (service worker TypeScript)
260
+ - `./portal-worker/static` (static assets)
261
+
262
+ ## License
263
+
264
+ MIT