2018-12-12 18:39:14 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux -o pipefail
|
2019-02-20 12:58:42 -05:00
|
|
|
|
|
|
|
function installLocalPackages() {
|
|
|
|
# Install Angular packages that are built locally from HEAD.
|
|
|
|
# This also gets around the bug whereby yarn caches local `file://` urls.
|
|
|
|
# See https://github.com/yarnpkg/yarn/issues/2165
|
|
|
|
readonly pwd=$(pwd)
|
|
|
|
readonly packages=(
|
|
|
|
animations common compiler core forms platform-browser
|
|
|
|
platform-browser-dynamic router bazel compiler-cli language-service upgrade
|
|
|
|
)
|
|
|
|
local local_packages=()
|
|
|
|
for package in "${packages[@]}"; do
|
|
|
|
local_packages+=("@angular/${package}@file:${pwd}/../../../dist/packages-dist/${package}")
|
|
|
|
done
|
|
|
|
yarn add "${local_packages[@]}"
|
|
|
|
}
|
2018-12-12 18:39:14 -05:00
|
|
|
|
2018-12-18 18:44:13 -05:00
|
|
|
function testBazel() {
|
2018-12-12 18:39:14 -05:00
|
|
|
# Set up
|
|
|
|
bazel version
|
2019-01-28 14:03:04 -05:00
|
|
|
ng version
|
2018-12-12 18:39:14 -05:00
|
|
|
rm -rf demo
|
|
|
|
# Create project
|
2019-03-27 12:58:59 -04:00
|
|
|
ng new demo --collection=@angular/bazel --routing --skip-git --skip-install --style=scss
|
2018-12-12 18:39:14 -05:00
|
|
|
cd demo
|
2019-02-02 04:02:16 -05:00
|
|
|
# Do an initial install to ensure packages like node-sass are built.
|
|
|
|
yarn
|
|
|
|
# Force more recent TS version until new Angular CLI projects also use it.
|
|
|
|
# --ignore-scripts is necessary because there is a postinstall script that uses ngc.
|
|
|
|
yarn add typescript@3.3.3333 --dev --ignore-scripts
|
2019-02-20 12:58:42 -05:00
|
|
|
installLocalPackages
|
|
|
|
yarn webdriver-manager update --gecko=false --standalone=false ${CI_CHROMEDRIVER_VERSION_ARG:---versions.chrome 2.45}
|
2019-01-17 16:21:31 -05:00
|
|
|
ng generate component widget --style=css
|
2019-01-24 14:51:20 -05:00
|
|
|
ng build
|
2018-12-17 16:17:13 -05:00
|
|
|
ng test
|
|
|
|
ng e2e
|
2019-03-18 19:44:03 -04:00
|
|
|
ng e2e --prod
|
2019-03-06 20:50:57 -05:00
|
|
|
if [ -e 'WORKSPACE' ] || [ -e 'BUILD.bazel' ]; then
|
|
|
|
echo 'WORKSPACE / BUILD.bazel file should not exist in project'
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-12-12 18:39:14 -05:00
|
|
|
}
|
|
|
|
|
2018-12-18 18:44:13 -05:00
|
|
|
function testNonBazel() {
|
|
|
|
# Replace angular.json that uses Bazel builder with the default generated by CLI
|
2019-01-28 14:03:04 -05:00
|
|
|
mv ./angular.json.bak ./angular.json
|
2019-02-19 20:58:21 -05:00
|
|
|
mv ./tsconfig.json.bak ./tsconfig.json
|
2018-12-18 18:44:13 -05:00
|
|
|
rm -rf dist src/main.dev.ts src/main.prod.ts
|
2019-01-04 13:27:09 -05:00
|
|
|
ng build --progress=false
|
|
|
|
ng test --progress=false --watch=false
|
2019-01-28 14:03:04 -05:00
|
|
|
ng e2e --configuration=production --webdriver-update=false
|
2018-12-18 18:44:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
testBazel
|
|
|
|
testNonBazel
|