2015-02-10 18:18:16 -05:00
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
2015-02-24 17:52:05 -05:00
|
|
|
shopt -s extglob
|
2015-02-10 18:18:16 -05:00
|
|
|
|
|
|
|
ROOT_DIR=$(cd $(dirname $0)/../..; pwd)
|
|
|
|
cd $ROOT_DIR
|
2015-02-24 17:52:05 -05:00
|
|
|
|
2015-02-10 18:18:16 -05:00
|
|
|
gulp clean
|
2015-08-11 19:33:03 -04:00
|
|
|
# benchpress.bundle and bundles.js will implicitly build everything we need
|
|
|
|
gulp benchpress.bundle bundles.js docs/typings
|
2015-02-10 18:18:16 -05:00
|
|
|
|
2015-02-24 17:52:05 -05:00
|
|
|
NPM_DIR=$ROOT_DIR/dist/npm
|
|
|
|
rm -fr $NPM_DIR
|
|
|
|
FILES='!(test|e2e_test|docs)'
|
2015-08-11 19:33:03 -04:00
|
|
|
DTS_FILES='*.d.ts'
|
2015-02-24 17:52:05 -05:00
|
|
|
|
|
|
|
function publishModule {
|
|
|
|
NAME=$1
|
|
|
|
PUBLISH_DIR=$NPM_DIR/$NAME
|
|
|
|
rm -fr $PUBLISH_DIR
|
|
|
|
mkdir -p $PUBLISH_DIR
|
|
|
|
|
|
|
|
mkdir -p $PUBLISH_DIR/es6/dev
|
|
|
|
cp -r $ROOT_DIR/dist/js/dev/es6/$NAME/$FILES $PUBLISH_DIR/es6/dev
|
|
|
|
mkdir -p $PUBLISH_DIR/es6/prod
|
|
|
|
cp -r $ROOT_DIR/dist/js/prod/es6/$NAME/$FILES $PUBLISH_DIR/es6/prod
|
2015-06-08 21:35:45 -04:00
|
|
|
mkdir -p $PUBLISH_DIR/ts
|
|
|
|
cp -r $ROOT_DIR/modules/$NAME/$FILES $PUBLISH_DIR/ts
|
2015-02-24 17:52:05 -05:00
|
|
|
|
2015-08-11 19:33:03 -04:00
|
|
|
if [ $NAME = "angular2" ]; then
|
|
|
|
# Publish bundles and typings
|
|
|
|
mkdir -p $PUBLISH_DIR/bundles/typings/angular2
|
|
|
|
mkdir -p $PUBLISH_DIR/bundles/typings/es6-promise
|
|
|
|
mkdir -p $PUBLISH_DIR/bundles/typings/rx
|
|
|
|
# Copy Bundles
|
|
|
|
cp -r $ROOT_DIR/dist/js/bundle/$FILES $PUBLISH_DIR/bundles
|
|
|
|
# Copy Typings
|
|
|
|
cp -r $ROOT_DIR/dist/docs/typings/angular2/$DTS_FILES $PUBLISH_DIR/bundles/typings/angular2
|
|
|
|
cp -r $ROOT_DIR/modules/angular2/typings/es6-promise/$DTS_FILES $PUBLISH_DIR/bundles/typings/es6-promise
|
|
|
|
cp -r $ROOT_DIR/modules/angular2/typings/rx/$DTS_FILES $PUBLISH_DIR/bundles/typings/rx
|
|
|
|
fi
|
|
|
|
|
2015-06-23 18:26:51 -04:00
|
|
|
if [ $NAME = "benchpress" ]; then
|
|
|
|
cp -r $ROOT_DIR/dist/build/benchpress_bundle/$FILES $PUBLISH_DIR
|
|
|
|
cp -r $ROOT_DIR/dist/js/cjs/benchpress/README.md $PUBLISH_DIR
|
|
|
|
cp -r $ROOT_DIR/dist/js/cjs/benchpress/LICENSE $PUBLISH_DIR
|
|
|
|
cp -r $ROOT_DIR/dist/js/cjs/benchpress/docs $PUBLISH_DIR
|
|
|
|
else
|
|
|
|
cp -r $ROOT_DIR/dist/js/cjs/$NAME/$FILES $PUBLISH_DIR
|
|
|
|
fi
|
2015-02-24 17:52:05 -05:00
|
|
|
|
|
|
|
npm publish $PUBLISH_DIR
|
2015-02-11 13:13:49 -05:00
|
|
|
}
|
|
|
|
|
2015-02-24 17:52:05 -05:00
|
|
|
publishModule angular2
|
|
|
|
publishModule benchpress
|