chore(packaging): pub publish script
This commit is contained in:
parent
f30e3e59b5
commit
f783841f16
|
@ -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",
|
||||
|
|
|
@ -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
|
|
@ -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));
|
Loading…
Reference in New Issue