diff --git a/scripts/publish/pub_prepare.sh b/scripts/publish/pub_prepare.sh new file mode 100755 index 0000000000..6d7a681e8b --- /dev/null +++ b/scripts/publish/pub_prepare.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# This script prepares build artifacts for upload to pub. +# +# Usage: +# +# scripts/publish/pub_prepare.sh PACKAGE_NAME + +set -ex +shopt -s extglob + +NAME=$1 +ROOT_DIR=$(cd $(dirname $0)/../..; pwd) +cd $ROOT_DIR + +PKG_DIR=$ROOT_DIR/dist/pub +FILES='!(e2e_test|pubspec.lock)' + +PUBLISH_DIR=$PKG_DIR/$NAME +rm -fr $PUBLISH_DIR +mkdir -p $PUBLISH_DIR + +cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR + +node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml diff --git a/scripts/publish/pub_publish.sh b/scripts/publish/pub_publish.sh index 404d2673b1..627d7851cf 100755 --- a/scripts/publish/pub_publish.sh +++ b/scripts/publish/pub_publish.sh @@ -21,17 +21,12 @@ gulp build.dart.material PKG_DIR=$ROOT_DIR/dist/pub rm -fr $PKG_DIR -FILES='!(e2e_test|pubspec.lock)' function publishModule { NAME=$1 PUBLISH_DIR=$PKG_DIR/$NAME - rm -fr $PUBLISH_DIR - mkdir -p $PUBLISH_DIR - cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR - - node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml + scripts/publish/pub_prepare.sh $NAME if [[ "$DRY_RUN" == "false" ]]; then (cd $PUBLISH_DIR && pub publish -f)