OCaml HTML5 parser/serialiser based on Python's JustHTML
1#!/bin/bash 2# Release script for html5rw npm package 3# Run from npm branch after building on main 4 5set -e 6 7# Path to dune install directory (relative to repo root) 8INSTALL_DIR="_build/install/default/share/html5rw-js" 9 10# Check we're on the npm branch 11BRANCH=$(git rev-parse --abbrev-ref HEAD) 12if [ "$BRANCH" != "npm" ]; then 13 echo "Error: Must be on npm branch (currently on $BRANCH)" 14 exit 1 15fi 16 17# Check the install directory exists 18if [ ! -d "$INSTALL_DIR" ]; then 19 echo "Error: Install directory not found at $INSTALL_DIR" 20 echo "Run 'opam exec -- dune build @install' on main branch first" 21 exit 1 22fi 23 24# Copy JavaScript files 25echo "Copying JavaScript files..." 26cp "$INSTALL_DIR/htmlrw.js" . 27cp "$INSTALL_DIR/htmlrw-worker.js" . 28cp "$INSTALL_DIR/htmlrw-tests.js" . 29 30# Copy WASM loader scripts 31echo "Copying WASM loader scripts..." 32cp "$INSTALL_DIR/htmlrw.wasm.js" . 33cp "$INSTALL_DIR/htmlrw-worker.wasm.js" . 34cp "$INSTALL_DIR/htmlrw-tests.wasm.js" . 35 36# Copy WASM assets directories 37echo "Copying WASM assets..." 38rm -rf htmlrw_js_main.bc.wasm.assets htmlrw_js_worker.bc.wasm.assets htmlrw_js_tests_main.bc.wasm.assets 39cp -r "$INSTALL_DIR/htmlrw_js_main.bc.wasm.assets" . 40cp -r "$INSTALL_DIR/htmlrw_js_worker.bc.wasm.assets" . 41cp -r "$INSTALL_DIR/htmlrw_js_tests_main.bc.wasm.assets" . 42 43# Fix permissions 44echo "Fixing permissions..." 45chmod 644 *.js 46find htmlrw_js_main.bc.wasm.assets -type f -exec chmod 644 {} \; 47find htmlrw_js_worker.bc.wasm.assets -type f -exec chmod 644 {} \; 48find htmlrw_js_tests_main.bc.wasm.assets -type f -exec chmod 644 {} \; 49 50echo "Done! Ready to commit and publish." 51echo "Run: git add -A && git commit -m 'Release X.Y.Z' && npm publish"