commit 3e65b0b4a4818685e3f6a879366f8f5a183929cc
parent ea8865e25f664914911eb88b6440e8c7d46d35c8
Author: triesap <tyson@radroots.org>
Date: Sat, 13 Jun 2026 14:11:40 -0700
wasm: align generated package metadata
Diffstat:
7 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,9 +1,22 @@
.PHONY: all build clean help \
+ clean-hyphenated-wasm-output \
build-events-codec-wasm build-replica-db-wasm build-replica-sync-wasm
SHELL := /bin/bash
.SHELLFLAGS := -e -o pipefail -c
+EVENTS_CODEC_WASM_PACKAGE := @radroots/radroots_events-codec-wasm
+EVENTS_CODEC_WASM_DESCRIPTION := WebAssembly bindings for radroots_events_codec
+REPLICA_DB_WASM_PACKAGE := @radroots/radroots_replica-db-wasm
+REPLICA_DB_WASM_DESCRIPTION := WebAssembly bindings for radroots_replica_db
+REPLICA_SYNC_WASM_PACKAGE := @radroots/radroots_replica-sync-wasm
+REPLICA_SYNC_WASM_DESCRIPTION := WebAssembly bindings for radroots_replica_sync
+
+HYPHENATED_WASM_OUTPUT_DIRS := \
+ crates/events-codec-wasm \
+ crates/replica-db-wasm \
+ crates/replica-sync-wasm
+
BUILD_TARGETS := \
build-events-codec-wasm \
build-replica-db-wasm \
@@ -11,7 +24,7 @@ BUILD_TARGETS := \
all: build
-build: $(BUILD_TARGETS)
+build: clean-hyphenated-wasm-output $(BUILD_TARGETS)
clean:
cargo clean
@@ -24,14 +37,22 @@ help:
@echo " make help"
@printf "%s\n" $(BUILD_TARGETS)
+clean-hyphenated-wasm-output:
+ rm -rf $(HYPHENATED_WASM_OUTPUT_DIRS)
+
+normalize_wasm_package_json = python3 -c 'import json, pathlib, sys; path = pathlib.Path(sys.argv[1]); data = json.loads(path.read_text()); data["name"] = sys.argv[2]; data["description"] = sys.argv[3]; path.write_text(json.dumps(data, indent=2) + "\n")' "$(1)" "$(2)" "$(3)"
+
build-replica-db-wasm:
wasm-pack build crates/replica_db_wasm --release --target web \
--out-dir pkg/dist --scope radroots
+ $(call normalize_wasm_package_json,crates/replica_db_wasm/pkg/dist/package.json,$(REPLICA_DB_WASM_PACKAGE),$(REPLICA_DB_WASM_DESCRIPTION))
build-events-codec-wasm:
wasm-pack build crates/events_codec_wasm --release --target web \
--out-dir pkg/dist --scope radroots
+ $(call normalize_wasm_package_json,crates/events_codec_wasm/pkg/dist/package.json,$(EVENTS_CODEC_WASM_PACKAGE),$(EVENTS_CODEC_WASM_DESCRIPTION))
build-replica-sync-wasm:
wasm-pack build crates/replica_sync_wasm --release --target web \
--out-dir pkg/dist --scope radroots
+ $(call normalize_wasm_package_json,crates/replica_sync_wasm/pkg/dist/package.json,$(REPLICA_SYNC_WASM_PACKAGE),$(REPLICA_SYNC_WASM_DESCRIPTION))
diff --git a/crates/events_codec_wasm/Cargo.toml b/crates/events_codec_wasm/Cargo.toml
@@ -6,7 +6,7 @@ edition.workspace = true
authors = ["Tyson Lupul <tyson@radroots.org>"]
rust-version.workspace = true
license.workspace = true
-description = "WebAssembly bindings for radroots-events-codec"
+description = "WebAssembly bindings for radroots_events_codec"
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/radroots_events_codec_wasm"
diff --git a/crates/events_codec_wasm/pkg/package.json b/crates/events_codec_wasm/pkg/package.json
@@ -1,5 +1,6 @@
{
- "name": "@radroots/events-codec-wasm",
+ "name": "@radroots/radroots_events-codec-wasm",
+ "description": "WebAssembly bindings for radroots_events_codec",
"version": "0.1.0",
"private": true,
"type": "module",
diff --git a/crates/replica_db_wasm/Cargo.toml b/crates/replica_db_wasm/Cargo.toml
@@ -6,7 +6,7 @@ edition.workspace = true
authors = ["Tyson Lupul <tyson@radroots.org>"]
rust-version.workspace = true
license.workspace = true
-description = "WebAssembly bindings for radroots-replica-db"
+description = "WebAssembly bindings for radroots_replica_db"
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/radroots_replica_db_wasm"
diff --git a/crates/replica_db_wasm/pkg/package.json b/crates/replica_db_wasm/pkg/package.json
@@ -1,5 +1,6 @@
{
- "name": "@radroots/replica-db-wasm",
+ "name": "@radroots/radroots_replica-db-wasm",
+ "description": "WebAssembly bindings for radroots_replica_db",
"version": "0.1.0",
"private": true,
"type": "module",
@@ -16,4 +17,4 @@
}
},
"sideEffects": false
-}
-\ No newline at end of file
+}
diff --git a/crates/replica_sync_wasm/Cargo.toml b/crates/replica_sync_wasm/Cargo.toml
@@ -6,7 +6,7 @@ edition.workspace = true
authors = ["Tyson Lupul <tyson@radroots.org>"]
rust-version.workspace = true
license.workspace = true
-description = "WebAssembly bindings for radroots-replica-sync"
+description = "WebAssembly bindings for radroots_replica_sync"
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/radroots_replica_sync_wasm"
diff --git a/crates/replica_sync_wasm/pkg/package.json b/crates/replica_sync_wasm/pkg/package.json
@@ -1,5 +1,6 @@
{
- "name": "@radroots/replica-sync-wasm",
+ "name": "@radroots/radroots_replica-sync-wasm",
+ "description": "WebAssembly bindings for radroots_replica_sync",
"version": "0.1.0",
"private": true,
"type": "module",