From 2f2bbb3a8b685b974e164ea067c71335bfaa1e80 Mon Sep 17 00:00:00 2001 From: ProTheory8 <59506423+protheory8@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:16:05 +0500 Subject: [PATCH] Add metadata (#45) * Add wasm-pack metadata * Add Wasm tests directory * Add basic Cargo manifest metadata * Make web frontend unpublishable to npm --- Cargo.lock | 20 ++++++++++---------- client/cli/Cargo.toml | 6 ++++-- client/web/package.json | 1 + client/web/wasm/Cargo.toml | 33 ++++++++++++++++++++++++--------- client/web/wasm/tests/web.rs | 10 ++++++++++ core/document/Cargo.toml | 6 ++++-- core/editor/Cargo.toml | 4 ++++ core/renderer/Cargo.toml | 6 ++++-- 8 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 client/web/wasm/tests/web.rs diff --git a/Cargo.lock b/Cargo.lock index 3000b026..2aef4a0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,6 +47,16 @@ dependencies = [ name = "graphite-renderer-core" version = "0.1.0" +[[package]] +name = "graphite-wasm-wrapper" +version = "0.1.0" +dependencies = [ + "console_error_panic_hook", + "graphite-editor-core", + "wasm-bindgen", + "wasm-bindgen-test", +] + [[package]] name = "js-sys" version = "0.3.49" @@ -202,16 +212,6 @@ dependencies = [ "quote", ] -[[package]] -name = "wasm-wrapper" -version = "0.1.0" -dependencies = [ - "console_error_panic_hook", - "graphite-editor-core", - "wasm-bindgen", - "wasm-bindgen-test", -] - [[package]] name = "web-sys" version = "0.3.49" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index fc43ec9d..f56de160 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -3,7 +3,9 @@ name = "graphite-cli" version = "0.1.0" authors = ["Graphite Authors "] edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +readme = "../../README.md" +homepage = "https://www.graphite.design" +repository = "https://github.com/GraphiteEditor/Graphite" +license = "Apache-2.0" [dependencies] diff --git a/client/web/package.json b/client/web/package.json index 3aa06672..cbacbf70 100644 --- a/client/web/package.json +++ b/client/web/package.json @@ -2,6 +2,7 @@ "name": "graphite-web-frontend", "version": "0.1.0", "description": "Graphite's web app frontend. Planned to be replaced by a Rust native GUI framework in the future.", + "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", diff --git a/client/web/wasm/Cargo.toml b/client/web/wasm/Cargo.toml index 84414645..f970c9f4 100644 --- a/client/web/wasm/Cargo.toml +++ b/client/web/wasm/Cargo.toml @@ -1,9 +1,13 @@ [package] -name = "wasm-wrapper" -publish = false +name = "graphite-wasm-wrapper" version = "0.1.0" authors = ["Graphite Authors "] edition = "2018" +readme = "../../../README.md" +homepage = "https://www.graphite.design" +repository = "https://github.com/GraphiteEditor/Graphite" +license = "Apache-2.0" +publish = false [lib] crate-type = ["cdylib", "rlib"] @@ -12,14 +16,25 @@ crate-type = ["cdylib", "rlib"] default = ["console_error_panic_hook"] [dependencies] -wasm-bindgen = "0.2.72" -graphite-editor-core = { path = "../../../core/editor" } - -# The `console_error_panic_hook` crate provides better debugging of panics by -# logging them with `console.error`. This is great for development, but requires -# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for -# code size when deploying. console_error_panic_hook = { version = "0.1.6", optional = true } +graphite-editor-core = { path = "../../../core/editor" } +wasm-bindgen = "0.2.72" [dev-dependencies] wasm-bindgen-test = "0.3.22" + +[package.metadata.wasm-pack.profile.dev] +wasm-opt = false + +[package.metadata.wasm-pack.profile.dev.wasm-bindgen] +debug-js-glue = true +demangle-name-section = true +dwarf-debug-info = true + +[package.metadata.wasm-pack.profile.release] +wasm-opt = ["-Os"] + +[package.metadata.wasm-pack.profile.release.wasm-bindgen] +debug-js-glue = false +demangle-name-section = false +dwarf-debug-info = false diff --git a/client/web/wasm/tests/web.rs b/client/web/wasm/tests/web.rs new file mode 100644 index 00000000..db945dfd --- /dev/null +++ b/client/web/wasm/tests/web.rs @@ -0,0 +1,10 @@ +#![cfg(target_arch = "wasm32")] + +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); + +#[wasm_bindgen_test] +fn pass() { + assert_eq!(1 + 1, 2); +} diff --git a/core/document/Cargo.toml b/core/document/Cargo.toml index d56a8f10..109121d3 100644 --- a/core/document/Cargo.toml +++ b/core/document/Cargo.toml @@ -3,7 +3,9 @@ name = "graphite-document-core" version = "0.1.0" authors = ["Graphite Authors "] edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +readme = "../../README.md" +homepage = "https://www.graphite.design" +repository = "https://github.com/GraphiteEditor/Graphite" +license = "Apache-2.0" [dependencies] diff --git a/core/editor/Cargo.toml b/core/editor/Cargo.toml index 207a64c2..25e8a4b9 100644 --- a/core/editor/Cargo.toml +++ b/core/editor/Cargo.toml @@ -3,6 +3,10 @@ name = "graphite-editor-core" version = "0.1.0" authors = ["Graphite Authors "] edition = "2018" +readme = "../../README.md" +homepage = "https://www.graphite.design" +repository = "https://github.com/GraphiteEditor/Graphite" +license = "Apache-2.0" [dependencies] log = "0.4" diff --git a/core/renderer/Cargo.toml b/core/renderer/Cargo.toml index 046d04da..a740934b 100644 --- a/core/renderer/Cargo.toml +++ b/core/renderer/Cargo.toml @@ -3,7 +3,9 @@ name = "graphite-renderer-core" version = "0.1.0" authors = ["Graphite Authors "] edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +readme = "../../README.md" +homepage = "https://www.graphite.design" +repository = "https://github.com/GraphiteEditor/Graphite" +license = "Apache-2.0" [dependencies]