Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
fix: add @ngtools/webpack to project deps only if @angular-devkit/bui…
Browse files Browse the repository at this point in the history
…ld-angular is not a dependency (#594)

* fix: add @ngtools/webpack to project deps only if
@angular-devkit/build-angular is not a dependency

Revert to adding @ngtools/webpack instead of
@angular-devkit/build-angular because the later is ~150mb bigger and
slows down the {N} cloud builds.
Add @ngtools/webpack to the project dependencies only if
@angular-devkit/build-angular isn't there already. That's because the
@angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the
plugin from adding multiple instances of @ngtools/webpack to the project
which would cause the build to fail.

related to #571, #569

BREAKING CHANGES

Not really a breaking change but:
It's a good idea to remove the `@angular-devkit/build-angular` from the
package.json and add `@ngtools/webpack` instead as this will speed up
the build.

fixes #595

* test(e2e): update demo Angular deps
  • Loading branch information
sis0k0 authored Jul 4, 2018
1 parent 5d44890 commit 7b15418
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo/AngularApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0-beta.1",
"@ngtools/webpack": "~6.1.0-rc.0",
"@angular/compiler-cli": "~6.1.0-beta.1",
"@types/chai": "^4.0.2",
"@types/mocha": "^2.2.41",
Expand Down
30 changes: 23 additions & 7 deletions dependencyManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function removeObsoleteDeps(packageJson) {
"nativescript-worker-loader",
"extract-text-webpack-plugin",
"uglifyjs-webpack-plugin",
"@ngtools/webpack",
"@angular-devkit/core",
"resolve-url-loader",
"awesome-typescript-loader",
Expand All @@ -82,12 +81,29 @@ function addDependency(deps, name, version, force) {
}

function getRequiredDeps(packageJson) {
return isAngular({packageJson}) ?
{
"@angular-devkit/build-angular": "~0.7.0-rc.0",
"@angular/compiler-cli": "~6.1.0-beta.1",
} :
{ };
if (!isAngular({packageJson})) {
return false;
}

const deps = {
"@angular/compiler-cli": "~6.1.0-beta.3",
};

if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
deps["@ngtools/webpack"] = "~6.1.0-rc.0";
}

return deps;
}


function dependsOn(packageJson, package) {
if (!packageJson) {
return false;
}

return packageJson.dependencies.hasOwnProperty(package) ||
packageJson.devDependencies.hasOwnProperty(package);
}

function showHelperMessages({ newDepsAdded, hasOldDeps }) {
Expand Down

0 comments on commit 7b15418

Please sign in to comment.