Skip to content

Commit d4ddde3

Browse files
authored
Prepare Deno Client for v1.0.0-rc release (#131)
* Update sync-versions script to also work on py client * Bump binary to 0.2.0 * Prepare for the 1.0.0-rc.1 release
1 parent 9f72aa1 commit d4ddde3

File tree

8 files changed

+57
-20
lines changed

8 files changed

+57
-20
lines changed

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 1.0.0-rc.1 Deno Client; 0.2.0 binary -- 2025-02-17
4+
5+
- Added new logging that can be triggered with the `LOG_LEVEL` environment variable
6+
7+
- [BREAKING] Changed some typenames/zod schemas not to include `Webview` in the name.
8+
- [BREAKING] Updated code generation to support multiple clients which necessitated a breaking change for the Deno client.
9+
10+
```diff
11+
using webview = await createWebView({
12+
title: "Simple",
13+
devtools: true,
14+
+ load: {
15+
html: "<h1>Hello, World!</h1>",
16+
+ },
17+
initializationScript:
18+
"console.log('This is printed from initializationScript!')",
19+
});
20+
```
21+
`html` or `url` must be wrapped in an object and passed to `load`.
22+
323
## 0.0.17 (binary 0.1.14) -- 2024-10-02
424

525
- Add `webview.loadUrl` to load a new URL after the webview is initialized

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webview"
3-
version = "0.1.14"
3+
version = "0.2.0"
44
edition = "2021"
55

66
[profile.release]

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ When executing this package, it checks to see if you have the required binary fo
4141
This will be true of a first run of the package. These are the following permission requests you can expect to see:
4242

4343
- Read HOME env -- Used to locate the cache directory
44-
- Read <cache>/deno-webview/deno-webview-<version> -- Tries to read the binary from cache
44+
- Read <cache>/webview/webview-<version> -- Tries to read the binary from cache
4545
- net to github.com:443 -- Connects to GitHub releases to try to download the binary (will be redirected)
4646
- net to objects.githubusercontent.com:443 -- GitHub's CDN for the actual download
47-
- Read <cache>/deno-webview/ -- Reads the cache directory
48-
- Write <cache>/deno-webview/deno-webview-<version> -- Writes the binary
49-
- Run <cache>/deno-webview/deno-webview-<version> -- Runs the binary
47+
- Read <cache>/webview/ -- Reads the cache directory
48+
- Write <cache>/webview/webview-<version> -- Writes the binary
49+
- Run <cache>/webview/webview-<version> -- Runs the binary
5050

5151
### Binary cached
5252

scripts/sync-versions.ts

+26-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
/**
2-
* Keeps the version of the WebView binary in sync with the version in Cargo.toml.
2+
* Synchronizes version numbers across the project:
3+
* - Updates BIN_VERSION in Deno client (main.ts)
4+
* - Updates package version in Python client (pyproject.toml)
5+
* - Updates BIN_VERSION in Python client (__init__.py)
6+
*
7+
* All versions are synchronized with the main version from Cargo.toml
38
*/
49

510
import { parse } from "jsr:@std/toml";
611

12+
// Read the source version from Cargo.toml
713
const latestVersion = await Deno
814
.readTextFile("./Cargo.toml").then((text) =>
915
parse(text) as { package: { version: string } }
1016
).then((config) => config.package.version);
1117

12-
// Read the content of src/lib.ts
13-
const libPath = "./src/clients/deno/main.ts";
14-
const libContent = await Deno.readTextFile(libPath);
18+
// ===== Update Deno Client Version =====
19+
const denoPath = "./src/clients/deno/main.ts";
20+
const denoContent = await Deno.readTextFile(denoPath);
1521

16-
// Replace the version in the URL
17-
const updatedContent = libContent.replace(
22+
const updatedDenoContent = denoContent.replace(
1823
/const BIN_VERSION = "[^"]+"/,
1924
`const BIN_VERSION = "${latestVersion}"`,
2025
);
2126

22-
// Write the updated content back to src/lib.ts
23-
await Deno.writeTextFile(libPath, updatedContent);
27+
await Deno.writeTextFile(denoPath, updatedDenoContent);
28+
console.log(`✓ Updated Deno BIN_VERSION to ${latestVersion}`);
2429

25-
console.log(`Updated WebView binary version to ${latestVersion} in src/lib.ts`);
30+
// ===== Update Python Client BIN_VERSION =====
31+
const pythonInitPath = "./src/clients/python/src/webview_python/__init__.py";
32+
const pythonInitContent = await Deno.readTextFile(pythonInitPath);
33+
34+
const updatedPythonInitContent = pythonInitContent.replace(
35+
/BIN_VERSION = "[^"]+"/,
36+
`BIN_VERSION = "${latestVersion}"`,
37+
);
38+
39+
await Deno.writeTextFile(pythonInitPath, updatedPythonInitContent);
40+
console.log(`✓ Updated Python BIN_VERSION to ${latestVersion}`);
41+
42+
console.log(`\n🎉 Successfully synchronized all versions to ${latestVersion}`);

src/clients/deno/deno.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@justbe/webview",
33
"exports": "./main.ts",
44
"license": "MIT",
5-
"version": "0.0.17",
5+
"version": "1.0.0-rc.1",
66
"publish": {
77
"include": ["README.md", "LICENSE", "*.ts", "schemas/*.ts"]
88
},

src/clients/deno/main.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import { ensureDir, exists } from "jsr:@std/fs";
3535
import { error, FmtSubscriber, instrument, Level, trace, warn } from "tracing";
3636
import { match, P } from "ts-pattern";
3737

38+
export * from "./schemas.ts";
39+
3840
if (
3941
Deno.permissions.querySync({ name: "env", variable: "LOG_LEVEL" }).state ===
4042
"granted"
@@ -51,11 +53,9 @@ if (
5153
FmtSubscriber.setGlobalDefault({ level, color: true });
5254
}
5355

54-
export * from "./schemas.ts";
55-
5656
// Should match the cargo package version
5757
/** The version of the webview binary that's expected */
58-
export const BIN_VERSION = "0.1.14";
58+
export const BIN_VERSION = "0.2.0";
5959

6060
type WebViewNotification = Extract<
6161
Message,

src/clients/python/src/webview_python/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
)
4848

4949
# Constants
50-
BIN_VERSION = "0.1.14"
50+
BIN_VERSION = "0.2.0"
5151

5252
T = TypeVar("T", bound=WebViewNotification)
5353

0 commit comments

Comments
 (0)