chore(build): spin off pub_prepare.sh from pub_publish.sh

This commit is contained in:
Yegor Jbanov 2015-11-17 22:09:19 -08:00 committed by Yegor
parent 621fa490c7
commit c53a63acca
2 changed files with 26 additions and 6 deletions

25
scripts/publish/pub_prepare.sh Executable file
View File

@ -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

View File

@ -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)