问题
I am looking to deploy Angular 5 application with continuous integration from bitbucket on an Apache server
Now because I am new to the field, I am unaware of the possible options to do this
Like do we need to integrate webpack with Jenkins, or do we need to write some other code on Jenkins, or we can do it without Jenkins and do we need to integrate it along with Sonar
Some pages do not give any clue about webpack, while some say you just have to write webpack script in Jenkins
Anyone having experience in this, please enlighten us
回答1:
If you are using angular cli to building the application, then its pretty straight forward to do the same via jenkins/teamcity.
Install node js on jenkins - https://wiki.jenkins.io/display/JENKINS/NodeJS+Plugin Further you can follow this blog - https://blog.couchbase.com/create-continuous-deployment-pipeline-nodejs-jenkins/
Specific to angular 2/4/5 -You just need to pass the angular CLI commands via shell script and push the build generated towards the desired server.
Something like - ng build With that you can use following flags as well 1. '--prod' - reduces the build size considerably, as it eliminates dead code while using tree shaking 2. '--build-optimizer' - it performs further code optimization, e.g removing decorators etc (works with angular 5, CLI 1.5)
Command will look something like - ng build --prod --build-optimizer
For more in-depth you can read wiki - https://github.com/angular/angular-cli/wiki/build
来源:https://stackoverflow.com/questions/47315228/deploying-an-angular-application-using-continuous-integration-from-git-or-gitlab