parent
cca89ec36e
commit
361eaf1888
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -u -e -o pipefail
|
|
||||||
|
|
||||||
BIN=$(cd .. && npm bin)
|
|
||||||
|
|
||||||
$BIN/tsc -p worker/tsconfig.json
|
|
||||||
$BIN/rollup -c worker/rollup-worker.config.js
|
|
||||||
|
|
||||||
|
|
||||||
$BIN/tsc -p cli/tsconfig.json
|
|
||||||
$BIN/rollup -c cli/rollup-cli.config.js
|
|
||||||
|
|
||||||
cp ./safety-worker.js ../../dist/packages-dist/service-worker/safety-worker.js
|
|
||||||
|
|
||||||
echo "#!/usr/bin/env node" > ../../dist/packages-dist/service-worker/ngsw-config.js
|
|
||||||
|
|
||||||
cat ../../dist/packages-dist/service-worker/ngsw-config-tmp.js >> ../../dist/packages-dist/service-worker/ngsw-config.js
|
|
||||||
rm ../../dist/packages-dist/service-worker/ngsw-config-tmp.js
|
|
|
@ -1,9 +0,0 @@
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
System.import('index').catch(console.error.bind(console));
|
|
|
@ -1,30 +0,0 @@
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
// this bundle is almost identical to the angular2.umd.js
|
|
||||||
// the only difference being "testing" exports
|
|
||||||
exports.core = require('angular2/core');
|
|
||||||
exports.common = require('angular2/common');
|
|
||||||
exports.compiler = require('angular2/compiler');
|
|
||||||
exports.platform = {
|
|
||||||
browser: require('angular2/platform/browser'),
|
|
||||||
common_dom: require('angular2/platform/common_dom'),
|
|
||||||
|
|
||||||
// this is included as compared to the angular2-all.umd.js bundle
|
|
||||||
testing: {browser: require('angular2/platform/testing/browser')}
|
|
||||||
};
|
|
||||||
exports.http = require('angular2/http');
|
|
||||||
exports.router = require('angular2/router');
|
|
||||||
exports.router_link_dsl = require('angular2/router/router_link_dsl.js');
|
|
||||||
exports.instrumentation = require('angular2/instrumentation');
|
|
||||||
exports.upgrade = require('angular2/upgrade');
|
|
||||||
|
|
||||||
// this is included as compared to the angular2-all.umd.js bundle
|
|
||||||
exports.testing = require('angular2/testing');
|
|
||||||
exports.http.testing = require('angular2/http/testing');
|
|
||||||
exports.router.testing = require('angular2/router/testing');
|
|
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.core = require('angular2/core');
|
|
||||||
exports.common = require('angular2/common');
|
|
||||||
exports.compiler = require('angular2/compiler');
|
|
||||||
exports.platform = {
|
|
||||||
browser: require('angular2/platform/browser'),
|
|
||||||
common_dom: require('angular2/platform/common_dom')
|
|
||||||
};
|
|
||||||
exports.http = require('angular2/http');
|
|
||||||
exports.router = require('angular2/router');
|
|
||||||
exports.router_link_dsl = require('angular2/router/router_link_dsl.js');
|
|
||||||
exports.instrumentation = require('angular2/instrumentation');
|
|
||||||
exports.upgrade = require('angular2/upgrade');
|
|
|
@ -1,39 +0,0 @@
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
var webpack = require('webpack');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps the original `webpack` function to convert execution
|
|
||||||
* result to a promise and properly report errors.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* @returns {Function}
|
|
||||||
*/
|
|
||||||
function webPackPromiseify(options) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
|
|
||||||
webpack(options, function(err, stats) {
|
|
||||||
var jsonStats = stats.toJson() || {};
|
|
||||||
var statsErrors = jsonStats.errors || [];
|
|
||||||
|
|
||||||
if (err) {
|
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (statsErrors.length) {
|
|
||||||
return reject(statsErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolve(stats);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = webPackPromiseify;
|
|
|
@ -1,92 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script for updating code.angularjs.org repo from current local build.
|
|
||||||
|
|
||||||
echo "#################################"
|
|
||||||
echo "## Update code.angularjs.org ###"
|
|
||||||
echo "#################################"
|
|
||||||
|
|
||||||
ARG_DEFS=(
|
|
||||||
"--action=(prepare|publish)"
|
|
||||||
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
|
|
||||||
)
|
|
||||||
|
|
||||||
function init {
|
|
||||||
TMP_DIR=$(resolveDir ../../tmp)
|
|
||||||
BUILD_DIR=$(resolveDir ../../dist/js/bundle)
|
|
||||||
REPO_DIR=$TMP_DIR/code.angularjs.org
|
|
||||||
# TODO: replace with version read from the bundle dir.
|
|
||||||
NEW_VERSION=$VERSION_NUMBER
|
|
||||||
if [[ "$NEW_VERSION" =~ sha ]]; then
|
|
||||||
IS_SNAPSHOT_BUILD=true
|
|
||||||
else
|
|
||||||
IS_SNAPSHOT_BUILD=
|
|
||||||
fi
|
|
||||||
RX_BUNDLE_DIR=$(resolveDir ../../node_modules/rxjs/bundles)
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ -d "$REPO_DIR" ]; then
|
|
||||||
(
|
|
||||||
cd $REPO_DIR
|
|
||||||
git fetch --update-shallow origin
|
|
||||||
git checkout master
|
|
||||||
git merge --ff-only origin/master
|
|
||||||
)
|
|
||||||
else
|
|
||||||
echo "-- Cloning code.angularjs.org into $REPO_DIR"
|
|
||||||
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "-- Updating code.angularjs.org"
|
|
||||||
|
|
||||||
if [[ $IS_SNAPSHOT_BUILD ]]; then
|
|
||||||
#
|
|
||||||
# update the snapshot folder
|
|
||||||
#
|
|
||||||
rm -rf $REPO_DIR/snapshot-angular2/
|
|
||||||
mkdir $REPO_DIR/snapshot-angular2
|
|
||||||
cp -r $BUILD_DIR/* $REPO_DIR/snapshot-angular2/
|
|
||||||
else
|
|
||||||
#
|
|
||||||
# copy the files from the build
|
|
||||||
#
|
|
||||||
mkdir $REPO_DIR/$NEW_VERSION
|
|
||||||
cp -r $BUILD_DIR/* $REPO_DIR/$NEW_VERSION/
|
|
||||||
cp -r $RX_BUNDLE_DIR/* $REPO_DIR/$NEW_VERSION/
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# commit
|
|
||||||
#
|
|
||||||
echo "-- Committing code.angularjs.org"
|
|
||||||
cd $REPO_DIR
|
|
||||||
git add -A
|
|
||||||
git commit -m "v$NEW_VERSION"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function _update_code() {
|
|
||||||
cd $REPO_DIR
|
|
||||||
|
|
||||||
echo "-- Pushing code.angularjs.org"
|
|
||||||
git push origin master
|
|
||||||
|
|
||||||
for backend in "$@" ; do
|
|
||||||
echo "-- Refreshing code.angularjs.org: backend=$backend"
|
|
||||||
curl http://$backend:8003/gitFetchSite.php
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function publish {
|
|
||||||
# The TXT record for backends.angularjs.org is a CSV of the IP addresses for
|
|
||||||
# the currently serving Compute Engine backends.
|
|
||||||
# code.angularjs.org is served out of port 8003 on these backends.
|
|
||||||
backends=("$(dig backends.angularjs.org +short TXT | python -c 'print raw_input()[1:-1].replace(",", "\n")')")
|
|
||||||
_update_code ${backends[@]}
|
|
||||||
}
|
|
||||||
|
|
||||||
source $(dirname $0)/../utils.inc
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script for removing specified release dir from code.angularjs.org.
|
|
||||||
|
|
||||||
echo "################################################"
|
|
||||||
echo "## Remove a version from code.angular.js.org ###"
|
|
||||||
echo "################################################"
|
|
||||||
|
|
||||||
ARG_DEFS=(
|
|
||||||
"--action=(prepare|publish)"
|
|
||||||
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
|
|
||||||
)
|
|
||||||
|
|
||||||
function init {
|
|
||||||
TMP_DIR=$(resolveDir ../../tmp)
|
|
||||||
REPO_DIR=$TMP_DIR/code.angularjs.org
|
|
||||||
echo "code tmp $TMP_DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare {
|
|
||||||
echo "-- Cloning code.angularjs.org"
|
|
||||||
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR
|
|
||||||
|
|
||||||
#
|
|
||||||
# Remove the files from the repo
|
|
||||||
#
|
|
||||||
echo "-- Removing $VERSION_NUMBER from code.angularjs.org"
|
|
||||||
cd $REPO_DIR
|
|
||||||
if [ -d "$VERSION_NUMBER" ]; then
|
|
||||||
git rm -r $VERSION_NUMBER
|
|
||||||
echo "-- Committing removal to code.angularjs.org"
|
|
||||||
git commit -m "removing v$VERSION_NUMBER"
|
|
||||||
else
|
|
||||||
echo "-- Version: $VERSION_NUMBER does not exist in code.angularjs.org!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function publish {
|
|
||||||
cd $REPO_DIR
|
|
||||||
|
|
||||||
echo "-- Pushing code.angularjs.org to github"
|
|
||||||
git push origin master
|
|
||||||
}
|
|
||||||
|
|
||||||
source $(dirname $0)/../utils.inc
|
|
|
@ -1,17 +0,0 @@
|
||||||
Rollup tree-shaking test
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
The purpose of this test is to verify how much stuff can be tree-shaken from our packages.
|
|
||||||
|
|
||||||
The test generates an empty js file that imports everything from a particular package but doesn't
|
|
||||||
use any of the imported references.
|
|
||||||
|
|
||||||
In the ideal scenario Rollup should detect that none of the references are being used and should
|
|
||||||
create an empty bundle file.
|
|
||||||
|
|
||||||
In reality there is a lot of stuff preserved in the bundle because Rollup is currently not able to
|
|
||||||
make a safe decision to remove many of the unused symbols.
|
|
||||||
|
|
||||||
To run execute: `./tools/tree-shaking-test/test.sh`
|
|
||||||
|
|
||||||
then inspect `dist/tree-shaking/test/**/*.bundle.js`
|
|
|
@ -1,28 +0,0 @@
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
class RollupNG2 {
|
|
||||||
resolveId(id, from) {
|
|
||||||
if (id.startsWith('@angular/')) {
|
|
||||||
const packageName = id.split('/')[1];
|
|
||||||
return `${__dirname}/../../packages-dist/${packageName}/@angular/packageName.es5.js`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(id.startsWith('rxjs/')){
|
|
||||||
// return `${__dirname}/../../../node_modules/rxjs-es/${id.replace('rxjs/', '')}.js`;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
entry: 'test.js',
|
|
||||||
format: 'es6',
|
|
||||||
plugins: [
|
|
||||||
new RollupNG2(),
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -1,35 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -ex -o pipefail
|
|
||||||
|
|
||||||
cd `dirname $0`
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
export NODE_PATH=${NODE_PATH}:$(pwd)/dist-packages/
|
|
||||||
|
|
||||||
DEST_DIR=./dist/trees-shaking-test
|
|
||||||
|
|
||||||
rm -rf ${DEST_DIR}
|
|
||||||
|
|
||||||
for PACKAGE in \
|
|
||||||
core \
|
|
||||||
compiler \
|
|
||||||
common \
|
|
||||||
platform-browser \
|
|
||||||
platform-server \
|
|
||||||
http \
|
|
||||||
router \
|
|
||||||
upgrade
|
|
||||||
do
|
|
||||||
echo "======= Tree-shaking TEST: ${SRCDIR} ====="
|
|
||||||
TEST_DIR=${DEST_DIR}/${PACKAGE}
|
|
||||||
TEST_ENTRY_POINT=${TEST_DIR}/test.js
|
|
||||||
mkdir -p ${TEST_DIR}
|
|
||||||
cp ./tools/tree-shaking-test/rollup.config.js ${TEST_DIR}/
|
|
||||||
echo "import * as x from '@angular/${PACKAGE}'" > ${TEST_ENTRY_POINT}
|
|
||||||
(
|
|
||||||
cd ${TEST_DIR}
|
|
||||||
$(npm bin)/rollup --config rollup.config.js --output ${PACKAGE}.bundle.js
|
|
||||||
)
|
|
||||||
|
|
||||||
done
|
|
Loading…
Reference in New Issue