interfaces_update.sh (1358B)
1 #!/bin/bash 2 set -eux -o pipefail 3 4 SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P) 5 WPT_ROOT=$SCRIPT_DIR/../.. 6 7 main () { 8 # Find the latest version of the package to install. 9 VERSION=$(npm info @webref/idl version) 10 11 # Install @webref/idl in a temporary directory. 12 TMPDIR=$(mktemp -d) 13 cd $TMPDIR 14 npm install @webref/idl@$VERSION 15 16 # Delete interfaces/*.idl except tentative ones 17 cd $WPT_ROOT 18 find interfaces/ -name '*.idl' -not -name '*.tentative.idl' -delete 19 20 # Handle cssom.idl with preamble first. 21 cat <<EOF > interfaces/cssom.idl 22 // GENERATED PREAMBLE - DO NOT EDIT 23 // CSSOMString is an implementation-defined type of either DOMString or 24 // USVString in CSSOM: https://drafts.csswg.org/cssom/#cssomstring-type 25 // For web-platform-tests, use DOMString because USVString has additional 26 // requirements in type conversion and could result in spurious failures for 27 // implementations that use DOMString. 28 typedef DOMString CSSOMString; 29 30 EOF 31 cat $TMPDIR/node_modules/@webref/idl/cssom.idl >> interfaces/cssom.idl 32 rm $TMPDIR/node_modules/@webref/idl/cssom.idl 33 34 # Move remaining *.idl from @webref/idl to interfaces/ 35 mv $TMPDIR/node_modules/@webref/idl/*.idl interfaces/ 36 37 # Cleanup 38 rm -rf $TMPDIR 39 40 if [ -n "$GITHUB_ENV" ]; then 41 echo webref_idl_version=$VERSION >> $GITHUB_ENV 42 fi 43 } 44 45 main