Skip to content

Commit c53a63a

Browse files
committed
chore(build): spin off pub_prepare.sh from pub_publish.sh
1 parent 621fa49 commit c53a63a

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

scripts/publish/pub_prepare.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# This script prepares build artifacts for upload to pub.
4+
#
5+
# Usage:
6+
#
7+
# scripts/publish/pub_prepare.sh PACKAGE_NAME
8+
9+
set -ex
10+
shopt -s extglob
11+
12+
NAME=$1
13+
ROOT_DIR=$(cd $(dirname $0)/../..; pwd)
14+
cd $ROOT_DIR
15+
16+
PKG_DIR=$ROOT_DIR/dist/pub
17+
FILES='!(e2e_test|pubspec.lock)'
18+
19+
PUBLISH_DIR=$PKG_DIR/$NAME
20+
rm -fr $PUBLISH_DIR
21+
mkdir -p $PUBLISH_DIR
22+
23+
cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR
24+
25+
node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml

scripts/publish/pub_publish.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ gulp build.dart.material
2121

2222
PKG_DIR=$ROOT_DIR/dist/pub
2323
rm -fr $PKG_DIR
24-
FILES='!(e2e_test|pubspec.lock)'
2524

2625
function publishModule {
2726
NAME=$1
2827
PUBLISH_DIR=$PKG_DIR/$NAME
29-
rm -fr $PUBLISH_DIR
30-
mkdir -p $PUBLISH_DIR
3128

32-
cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR
33-
34-
node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml
29+
scripts/publish/pub_prepare.sh $NAME
3530

3631
if [[ "$DRY_RUN" == "false" ]]; then
3732
(cd $PUBLISH_DIR && pub publish -f)

0 commit comments

Comments
 (0)