Skip to content

angular-cli in a CI/CD schenario #7767

@snarum

Description

@snarum
  • bug report -> please search issues before submitting
  • [ x] feature request
    ng version 1.1.3

I'm trying to make angular-cli fit in my continuous delivery setup, but I am having one issue with the way the bundling works.

In my initial setup I had a build which which did the following:

  • install missing packages (npm install)
  • run tests (ng tests)
  • make dist folder (ng build)
    and then collected the dist folder for artifacts.

During deploy I could just copy the artifacts to my web server. This worked very well.

But then I thought, how does this setup fit when I wish to deploy to production, and want to minify and gzip my javascript? Using ng I cannot find a way to minify the artifacts, without including the source code, and running ng --prod on the source code again.

So to fix this I moved the ng build step from the build and added it to my deployment script instead, and added all source files to the artifacts of the build. This resulted in build and deploy time to go from a few seconds to 5-6 minutes on a tiny project, mostly because node_modules is included in the artifacts.

In addition to the time consuming build, with this approach is that I don't really test the same artifacts in test and prod, as I am bundling separately for each environment.

So my question is this, am I doing something stupid here? Is there better ways to do this? If not, is it possible to add an option to ng which will take an existing dist folder and gzip/minify it? This way I could add this step to deployment when targeting to Atest/prod level environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions