From b2c14b19cfb9b193dd671b6942a4585ee636255c Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 10:34:48 -0800 Subject: [PATCH 1/6] Added support for compiling to WASIX and published to Wasmer --- Cargo.toml | 3 ++- build-wasmer.sh | 7 +++++++ wasmer.toml | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 build-wasmer.sh create mode 100644 wasmer.toml diff --git a/Cargo.toml b/Cargo.toml index 927376362..696809506 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,5 @@ resolver = "2" [profile.release] strip = true -codegen-units = 1 +opt-level = 'z' +lto = true diff --git a/build-wasmer.sh b/build-wasmer.sh new file mode 100755 index 000000000..e97709d15 --- /dev/null +++ b/build-wasmer.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# You'll need to have Cargo WASIX installed (`cargo install cargo-wasix`) +cargo wasix build --release --no-default-features + +# Then, for publishing +# wasmer publish diff --git a/wasmer.toml b/wasmer.toml new file mode 100644 index 000000000..6b4c5fc43 --- /dev/null +++ b/wasmer.toml @@ -0,0 +1,15 @@ +[package] +name = 'jaq/jaq' +version = '0.1.0' +description = 'Just another JSON query tool' + +# See more keys and definitions at https://docs.wasmer.io/registry/manifest + +[[module]] +name = 'jaq' +source = 'target/wasm32-wasmer-wasi/release/jaq.wasm' +abi = 'wasi' + +[[command]] +name = 'jaq' +module = 'jaq' From 3138a5e9de2a917472225394a61bdc55642a0467 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 10:37:53 -0800 Subject: [PATCH 2/6] Improved the readme --- README.md | 6 ++++++ wasmer.toml | 1 + 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 686afb627..2817620ac 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,12 @@ jaq should work on any system supported by Rust. If it does not, please file an issue. +You can also use [Wasmer](https://wasmer.io) to run `jaq` without an +installation required, using the [jaq/jaq package](https://wasmer.io/jaq/jaq): + + $ echo '{"a": 1, "b": 2}' | wasmer run jaq/jaq + + ## Binaries You may also install jaq using [homebrew](https://formulae.brew.sh/formula/jaq) on macOS or Linux: diff --git a/wasmer.toml b/wasmer.toml index 6b4c5fc43..70199d175 100644 --- a/wasmer.toml +++ b/wasmer.toml @@ -2,6 +2,7 @@ name = 'jaq/jaq' version = '0.1.0' description = 'Just another JSON query tool' +README = "README.md" # See more keys and definitions at https://docs.wasmer.io/registry/manifest From 514fcafe64bc3663764dffa10916600a6bb3fd48 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 10:38:15 -0800 Subject: [PATCH 3/6] Updated version --- wasmer.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasmer.toml b/wasmer.toml index 70199d175..5020d5d89 100644 --- a/wasmer.toml +++ b/wasmer.toml @@ -1,6 +1,6 @@ [package] name = 'jaq/jaq' -version = '0.1.0' +version = '0.1.1' description = 'Just another JSON query tool' README = "README.md" From 7de8af50a5b9ba92a48c02e4c5ed924685f08abd Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 10:39:27 -0800 Subject: [PATCH 4/6] Added repository --- wasmer.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wasmer.toml b/wasmer.toml index 5020d5d89..8f5ae9674 100644 --- a/wasmer.toml +++ b/wasmer.toml @@ -1,8 +1,9 @@ [package] name = 'jaq/jaq' -version = '0.1.1' +version = '0.1.2' description = 'Just another JSON query tool' README = "README.md" +repository = "https://github.com/01mf02/jaq" # See more keys and definitions at https://docs.wasmer.io/registry/manifest From e553600baaf112e1284fd7c3a2a4fe73e19f908e Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 10:42:41 -0800 Subject: [PATCH 5/6] Improved README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2817620ac..f555edfe1 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,9 @@ If it does not, please file an issue. You can also use [Wasmer](https://wasmer.io) to run `jaq` without an installation required, using the [jaq/jaq package](https://wasmer.io/jaq/jaq): - $ echo '{"a": 1, "b": 2}' | wasmer run jaq/jaq + $ echo '{"a": 1, "b": 2}' | wasmer run jaq/jaq '.a' + + $ seq 1000 | wasmer run jaq/jaq -- -n 'foreach inputs as $x (0; . + $x)' ## Binaries From db8e598cccb44a472360857ff0e8334a0f1a8e6b Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 29 Nov 2023 11:12:35 -0800 Subject: [PATCH 6/6] Improved readme --- wasmer.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wasmer.toml b/wasmer.toml index 8f5ae9674..97a40a7b5 100644 --- a/wasmer.toml +++ b/wasmer.toml @@ -1,8 +1,8 @@ [package] name = 'jaq/jaq' -version = '0.1.2' +version = '0.1.3' description = 'Just another JSON query tool' -README = "README.md" +readme = "README.md" repository = "https://github.com/01mf02/jaq" # See more keys and definitions at https://docs.wasmer.io/registry/manifest