The logic to create additional files needed for Bazel are currently hosted in `ng new`. Such files include the main.*.ts files needed for AOT and a different angular.json to use Bazel builder, among others. This commit refactors the logic into `ng add` so that it can be used to perform the same modifications in an existing project. Users could do so by running `ng add @angular/bazel`. With this change, `ng new` effectively becomes an orchestrator that runs the original `ng new` followed by `ng add @angular/bazel`. PR Close #28436
34 lines
906 B
Bash
Executable File
34 lines
906 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eux -o pipefail
|
|
|
|
function testBazel() {
|
|
# Set up
|
|
bazel version
|
|
ng version
|
|
rm -rf demo
|
|
# Create project
|
|
ng new demo --collection=@angular/bazel --defaults --skip-git --style=scss
|
|
node replace_angular_repo.js "./demo/WORKSPACE"
|
|
cd demo
|
|
yarn add @angular/bazel@file:../../../dist/packages-dist/bazel
|
|
yarn webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG
|
|
cp ../package.json.replace ./package.json
|
|
ng generate component widget --style=css
|
|
ng build
|
|
ng test
|
|
ng e2e
|
|
}
|
|
|
|
function testNonBazel() {
|
|
# Replace angular.json that uses Bazel builder with the default generated by CLI
|
|
mv ./angular.json.bak ./angular.json
|
|
rm -rf dist src/main.dev.ts src/main.prod.ts
|
|
ng build --progress=false
|
|
ng test --progress=false --watch=false
|
|
ng e2e --configuration=production --webdriver-update=false
|
|
}
|
|
|
|
testBazel
|
|
testNonBazel
|