From 659afab6801fe22546a2ef13396a03d080a7d976 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Fri, 10 Nov 2023 16:51:21 -0500 Subject: [PATCH] Add conditional exports --- Cargo.lock | 2 +- Cargo.toml | 2 +- scripts/build.sh | 7 ++++- templates/package.json | 59 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 templates/package.json diff --git a/Cargo.lock b/Cargo.lock index 113ead09..2b9e55a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1174,7 +1174,7 @@ dependencies = [ [[package]] name = "parquet-wasm" -version = "0.5.0" +version = "0.6.0-beta.1" dependencies = [ "arrow", "arrow-wasm", diff --git a/Cargo.toml b/Cargo.toml index 936ec42e..fcd9a487 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parquet-wasm" -version = "0.5.0" +version = "0.6.0-beta.1" authors = ["Kyle Barron "] edition = "2021" description = "WebAssembly Parquet reader and writer." diff --git a/scripts/build.sh b/scripts/build.sh index d373e26c..ed617e6e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -99,7 +99,12 @@ cp tmp_build/{bundler,bundler2}/arrow* pkg/bundler/ cp tmp_build/{esm,esm2}/arrow* pkg/esm cp tmp_build/{node,node2}/arrow* pkg/node -cp tmp_build/bundler/{package.json,LICENSE_APACHE,LICENSE_MIT,README.md} pkg/ +cp tmp_build/bundler/{LICENSE_APACHE,LICENSE_MIT,README.md} pkg/ + +# Copy in combined package.json from template +# https://stackoverflow.com/a/24904276 +# Note that keys from the second file will overwrite keys from the first. +jq -s '.[0] * .[1]' templates/package.json tmp_build/bundler/package.json > pkg/package.json # Create minimal package.json in esm/ folder with type: module echo '{"type": "module"}' > pkg/esm/package.json diff --git a/templates/package.json b/templates/package.json new file mode 100644 index 00000000..79b5e755 --- /dev/null +++ b/templates/package.json @@ -0,0 +1,59 @@ +{ + "name": "parquet-wasm", + "collaborators": [ + "Kyle Barron " + ], + "description": "WebAssembly Parquet reader and writer.", + "version": "0.5.0", + "license": "MIT OR Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/kylebarron/parquet-wasm" + }, + "files": [ + "*" + ], + "module": "bundler/arrow2.js", + "types": "bundler/arrow2.d.ts", + "sideEffects": [ + "./arrow1.js", + "./snippets/*" + ], + "keywords": [ + "parquet", + "webassembly", + "arrow" + ], + "exports": { + "./arrow1": { + "import": { + "types": "./esm/arrow1.d.ts", + "import": "./esm/arrow1.js" + }, + "browser": { + "types": "./esm/arrow1.d.ts", + "import": "./esm/arrow1.js" + }, + "node": { + "types": "./node/arrow1.d.ts", + "require": "./node/arrow1.js", + "import": "./node/arrow1.js" + } + }, + "./arrow2": { + "import": { + "types": "./esm/arrow2.d.ts", + "import": "./esm/arrow2.js" + }, + "browser": { + "types": "./esm/arrow2.d.ts", + "import": "./esm/arrow2.js" + }, + "node": { + "types": "./node/arrow2.d.ts", + "require": "./node/arrow2.js", + "import": "./node/arrow2.js" + } + } + } +}