From 42e7f45b1899046cafb414e4c617c81bfc254029 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 20 Dec 2024 16:39:15 +0100 Subject: [PATCH] Add VERSION file to wasm-internal (#92) Adds a `VERSION` file to wasm artifacts with the full git hash to the commit used to build the artifact. Resolves #12 --- crates/bitwarden-wasm-internal/build.sh | 3 +++ crates/bitwarden-wasm-internal/npm/.gitignore | 1 + crates/bitwarden-wasm-internal/npm/package.json | 7 ++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh index 3a0c266c..1c3ac63a 100755 --- a/crates/bitwarden-wasm-internal/build.sh +++ b/crates/bitwarden-wasm-internal/build.sh @@ -6,6 +6,9 @@ cd "$(dirname "$0")" # Move to the root of the repository cd ../../ +# Write VERSION file +git rev-parse HEAD > ./crates/bitwarden-wasm-internal/npm/VERSION + if [ "$1" != "-r" ]; then # Dev cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown diff --git a/crates/bitwarden-wasm-internal/npm/.gitignore b/crates/bitwarden-wasm-internal/npm/.gitignore index 99cddcd2..90f6933e 100644 --- a/crates/bitwarden-wasm-internal/npm/.gitignore +++ b/crates/bitwarden-wasm-internal/npm/.gitignore @@ -5,3 +5,4 @@ bitwarden_wasm_internal_bg.wasm.d.ts bitwarden_wasm_internal_bg.wasm.js bitwarden_wasm_internal.d.ts bitwarden_wasm_internal.js +VERSION diff --git a/crates/bitwarden-wasm-internal/npm/package.json b/crates/bitwarden-wasm-internal/npm/package.json index 7495368a..82d3a879 100644 --- a/crates/bitwarden-wasm-internal/npm/package.json +++ b/crates/bitwarden-wasm-internal/npm/package.json @@ -4,16 +4,17 @@ "license": "GPL-3.0", "files": [ "bitwarden_wasm_internal_bg.js", - "bitwarden_wasm_internal_bg.wasm", "bitwarden_wasm_internal_bg.wasm.d.ts", "bitwarden_wasm_internal_bg.wasm.js", + "bitwarden_wasm_internal_bg.wasm", "bitwarden_wasm_internal.d.ts", "bitwarden_wasm_internal.js", "index.js", - "node/bitwarden_wasm_internal_bg.wasm", "node/bitwarden_wasm_internal_bg.wasm.d.ts", + "node/bitwarden_wasm_internal_bg.wasm", "node/bitwarden_wasm_internal.d.ts", - "node/bitwarden_wasm_internal.js" + "node/bitwarden_wasm_internal.js", + "VERSION" ], "main": "node/bitwarden_wasm_internal.js", "module": "index.js",