diff --git a/Cargo.toml b/Cargo.toml index cc2e534..bf7089a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "rtf-parser" description = "A Rust RTF parser & lexer library designed for speed and memory efficiency." repository = "https://github.com/d0rianb/rtf-parser" -version = "0.3.0" +version = "0.4.0" edition = "2021" license = "MIT" keywords = ["rtf", "rich", "text", "format", "parser"] diff --git a/build_wasm.sh b/build_wasm.sh index 74cb8e0..88ba26d 100755 --- a/build_wasm.sh +++ b/build_wasm.sh @@ -1,2 +1,4 @@ +#!/bin/bash + #cargo build --target web -- --features serde wasm-pack build --release --target web -- --features serde diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..c3f882b --- /dev/null +++ b/publish.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Check if Cargo.toml exist in this directory +if [ ! -f Cargo.toml ]; then + echo "Cargo.toml doesn't exist in this directory" + exit 1 +fi + +version=$(grep '^version =' Cargo.toml | cut -d '"' -f 2) + +echo "Publishing rtf-parser v$version" +echo "Build WASM released module" +./build_wasm.sh + +#echo "Commiting the last changes" +git add . +git commit -m "Publishing v$version" +git push origin master + +echo "Publish to NPM" +# Rename from 'rtf-parser' to 'rtf-parser-wasm' for NPM +sed -i '' 's/"name": "[^"]*"/"name": "rtf-parser-wasm"/' pkg/package.json +wasm-pack publish + +echo "Publish to Cargo" +cargo publish diff --git a/src/parser.rs b/src/parser.rs index 1771599..cc010d3 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,10 +1,10 @@ use std::collections::HashMap; use std::{fmt, mem}; -use derivative::Derivative; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; -#[cfg(target_arch = "wasm32")] + +use derivative::Derivative; use wasm_bindgen::prelude::wasm_bindgen; use crate::document::RtfDocument;