chore(packaging): pub publish script

This commit is contained in:
Yegor Jbanov 2015-03-02 09:43:56 -08:00
parent f30e3e59b5
commit f783841f16
3 changed files with 52 additions and 0 deletions

View File

@ -53,6 +53,7 @@
"gulp-template": "^3.0.0",
"gulp-traceur": "0.16.*",
"gulp-webserver": "^0.8.7",
"js-yaml": "^3.2.7",
"karma": "^0.12.23",
"karma-chrome-launcher": "^0.1.4",
"karma-cli": "^0.0.4",

33
scripts/publish/pub_publish.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Publishes Angular 2 packages to pub.
set -ex
shopt -s extglob
ROOT_DIR=$(cd $(dirname $0)/../..; pwd)
cd $ROOT_DIR
gulp clean
gulp build/packages.dart
gulp build/analyze.dart
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
(cd $PUBLISH_DIR && pub publish)
}
publishModule angular2
publishModule benchpress

View File

@ -0,0 +1,18 @@
// Cleans up pubspec.yaml files prior to publishing
// Usage: node pubspec_cleaner.js --pubspec-file=PATH_TO_PUBSPEC_YAML
fs = require('fs');
yaml = require('js-yaml');
yargs = require('yargs');
var pubspecFileOpt = 'pubspec-file';
var pubspecFile = yargs
.demand([pubspecFileOpt])
.argv[pubspecFileOpt];
var doc = yaml.safeLoad(fs.readFileSync(pubspecFile, 'utf8'));
// Pub does not allow publishing with dependency_overrides
delete doc['dependency_overrides'];
fs.writeFileSync(pubspecFile, yaml.safeDump(doc));