powershell - How to prevent TeamCity publishing a successful build when Angular AOT compilation fails -


we have angular application deployed through teamcity. final build step (before web deploy), powershell script, follows.

$branch = "%teamcity.build.branch%"  if($branch.contains("release")) {   npm run-script publish-qa } elseif($branch.contains("develop")) {   npm run-script publish-dev } elseif($branch.contains("master")) {   npm run-script publish } 

the npm scripts

"publish": "ng build --prod --bh /hubs/", "publish-qa": "ng build --env=qa --bh /hubs/", "publish-dev": "ng build --env=dev"     

when deploy master, angular app compiles using aot compilation. when there build fail, logged in build logs npm error build still exits code 0, tries publish empty folder.

this end of build log

[step 5/5] error in cannot determine module class datesvalidityvalidatordirective in  d:/teamcity/buildagent/work/a880d6f55c430ab6/src/app/hubs/offer-picker/card-dates-validator.directive.ts! add datesvalidityvalidatordirective ngmodule fix it. [12:36:36][step 5/5]  [12:36:36][step 5/5] error in ./src/main.ts [12:36:36][step 5/5] module not found: error: can't resolve './$$_gendir/app/app.module.ngfactory' in 'd:\teamcity\buildagent\work\a880d6f55c430ab6\src' [12:36:36][step 5/5]  @ ./src/main.ts 3:0-74 [12:36:36][step 5/5]  @ multi ./src/main.ts [12:36:36][step 5/5] npm err! argv "c:\\program files\\nodejs\\node.exe" "c:\\program files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "publish"                 ... [12:36:36][step 5/5] process exited code 0 [12:36:36]publishing internal artifacts [12:36:36]publishing artifacts 

any way can force error prevent build finishing can correctly monitor failed builds?

thanks


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -