From d7958e7070651f77e772efe05e02ecf68794bb75 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 2 Jun 2020 09:06:05 -0500 Subject: [PATCH] build: fix path resolution with library dependencies (#2554) Updating to use ng-packagr builder to correctly resolve external dependencies for built packages --- angular.json | 50 +++++++++++++------ modules/component-store/tsconfig-build.json | 2 +- .../component-store/tsconfig.schematics.json | 2 +- modules/component/tsconfig-build.json | 2 +- modules/data/tsconfig-build.json | 8 +-- modules/data/tsconfig.schematics.json | 2 +- modules/effects/tsconfig-build.json | 6 +-- modules/effects/tsconfig.schematics.json | 2 +- modules/entity/tsconfig-build.json | 6 +-- modules/entity/tsconfig.schematics.json | 2 +- modules/router-store/tsconfig-build.json | 6 +-- modules/router-store/tsconfig.schematics.json | 2 +- modules/schematics/tsconfig-bazel-build.json | 2 +- modules/schematics/tsconfig-build.json | 2 +- modules/schematics/tsconfig.schematics.json | 2 +- modules/store-devtools/tsconfig-build.json | 6 +-- .../store-devtools/tsconfig.schematics.json | 2 +- modules/store/tsconfig-build.json | 2 +- modules/store/tsconfig.schematics.json | 2 +- nx.json | 4 ++ 20 files changed, 61 insertions(+), 51 deletions(-) diff --git a/angular.json b/angular.json index d04f6b92b8..b5a98b5158 100644 --- a/angular.json +++ b/angular.json @@ -124,7 +124,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/store/tsconfig-build.json", "project": "modules/store/ng-package.json" @@ -136,10 +136,16 @@ "parallel": false, "commands": [ { - "command": "nx build store" + "command": "ng build store" }, { "command": "yarn tsc -p modules/store/tsconfig.schematics.json" + }, + { + "command": "yarn mkdirp node_modules/@ngrx/store" + }, + { + "command": "ncp dist/modules/store node_modules/@ngrx/store" } ] } @@ -173,7 +179,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/effects/tsconfig-build.json", "project": "modules/effects/ng-package.json" @@ -185,10 +191,16 @@ "parallel": false, "commands": [ { - "command": "nx build effects" + "command": "ng build effects" }, { "command": "yarn tsc -p modules/effects/tsconfig.schematics.json" + }, + { + "command": "yarn mkdirp node_modules/@ngrx/effects" + }, + { + "command": "ncp dist/modules/effects node_modules/@ngrx/effects" } ] } @@ -222,7 +234,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/data/tsconfig-build.json", "project": "modules/data/ng-package.json" @@ -234,7 +246,7 @@ "parallel": false, "commands": [ { - "command": "nx build data" + "command": "ng build data" }, { "command": "yarn tsc -p modules/data/tsconfig.schematics.json" @@ -271,7 +283,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/entity/tsconfig-build.json", "project": "modules/entity/ng-package.json" @@ -283,10 +295,16 @@ "parallel": false, "commands": [ { - "command": "nx build entity" + "command": "ng build entity" }, { "command": "yarn tsc -p modules/entity/tsconfig.schematics.json" + }, + { + "command": "yarn mkdirp node_modules/@ngrx/entity" + }, + { + "command": "ncp dist/modules/entity node_modules/@ngrx/entity" } ] } @@ -320,7 +338,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/store-devtools/tsconfig-build.json", "project": "modules/store-devtools/ng-package.json" @@ -332,7 +350,7 @@ "parallel": false, "commands": [ { - "command": "nx build store-devtools" + "command": "ng build store-devtools" }, { "command": "yarn tsc -p modules/store-devtools/tsconfig.schematics.json" @@ -369,7 +387,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/router-store/tsconfig-build.json", "project": "modules/router-store/ng-package.json" @@ -381,7 +399,7 @@ "parallel": false, "commands": [ { - "command": "nx build router-store" + "command": "ng build router-store" }, { "command": "yarn tsc -p modules/router-store/tsconfig.schematics.json" @@ -502,7 +520,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/component/tsconfig-build.json", "project": "modules/component/ng-package.json" @@ -514,7 +532,7 @@ "parallel": false, "commands": [ { - "command": "nx build component" + "command": "ng build component" } ] } @@ -548,7 +566,7 @@ "prefix": "ngrx", "architect": { "build": { - "builder": "@nrwl/angular:package", + "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "modules/component-store/tsconfig-build.json", "project": "modules/component-store/ng-package.json" @@ -560,7 +578,7 @@ "parallel": false, "commands": [ { - "command": "nx build component-store" + "command": "ng build component-store" } ] } diff --git a/modules/component-store/tsconfig-build.json b/modules/component-store/tsconfig-build.json index db6de4f2cf..e8b2f51a1a 100644 --- a/modules/component-store/tsconfig-build.json +++ b/modules/component-store/tsconfig-build.json @@ -16,7 +16,7 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/component-store/tsconfig.schematics.json b/modules/component-store/tsconfig.schematics.json index 0472a9be1c..c18c7acf71 100644 --- a/modules/component-store/tsconfig.schematics.json +++ b/modules/component-store/tsconfig.schematics.json @@ -10,7 +10,7 @@ "paths": {}, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/component/tsconfig-build.json b/modules/component/tsconfig-build.json index e4962b9728..e61990cf6d 100644 --- a/modules/component/tsconfig-build.json +++ b/modules/component/tsconfig-build.json @@ -18,7 +18,7 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/data/tsconfig-build.json b/modules/data/tsconfig-build.json index 7316cc065f..0b03925c34 100644 --- a/modules/data/tsconfig-build.json +++ b/modules/data/tsconfig-build.json @@ -12,15 +12,11 @@ "noImplicitReturns": true, "downlevelIteration": true, "outDir": "../../dist/modules/data", - "paths": { - "@ngrx/store": ["../../dist/modules/store"], - "@ngrx/effects": ["../../dist/modules/effects"], - "@ngrx/entity": ["../../dist/modules/entity"] - }, + "paths": {}, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/data/tsconfig.schematics.json b/modules/data/tsconfig.schematics.json index 23be71ce62..10cc7e381d 100644 --- a/modules/data/tsconfig.schematics.json +++ b/modules/data/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/effects/tsconfig-build.json b/modules/effects/tsconfig-build.json index f1c0ba28a4..a63e26ebc9 100644 --- a/modules/effects/tsconfig-build.json +++ b/modules/effects/tsconfig-build.json @@ -12,13 +12,11 @@ "noImplicitReturns": true, "downlevelIteration": true, "outDir": "../../dist/modules/effects", - "paths": { - "@ngrx/store": ["../../dist/modules/store"] - }, + "paths": {}, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/effects/tsconfig.schematics.json b/modules/effects/tsconfig.schematics.json index 5421488e07..88dcd0495a 100644 --- a/modules/effects/tsconfig.schematics.json +++ b/modules/effects/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/entity/tsconfig-build.json b/modules/entity/tsconfig-build.json index bc7dbf17a2..c278b9b5d1 100644 --- a/modules/entity/tsconfig-build.json +++ b/modules/entity/tsconfig-build.json @@ -12,13 +12,11 @@ "noImplicitReturns": true, "downlevelIteration": true, "outDir": "../../dist/modules/entity", - "paths": { - "@ngrx/store": ["../../dist/modules/store"] - }, + "paths": {}, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/entity/tsconfig.schematics.json b/modules/entity/tsconfig.schematics.json index cde3ace15f..6e4991381c 100644 --- a/modules/entity/tsconfig.schematics.json +++ b/modules/entity/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/router-store/tsconfig-build.json b/modules/router-store/tsconfig-build.json index bd57cfb1e7..675249f4f6 100644 --- a/modules/router-store/tsconfig-build.json +++ b/modules/router-store/tsconfig-build.json @@ -12,13 +12,11 @@ "noImplicitReturns": true, "downlevelIteration": true, "outDir": "../../dist/modules/router-store", - "paths": { - "@ngrx/store": ["../../dist/modules/store"] - }, + "paths": {}, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/router-store/tsconfig.schematics.json b/modules/router-store/tsconfig.schematics.json index 6f0ec9e394..b8ca15b6e3 100644 --- a/modules/router-store/tsconfig.schematics.json +++ b/modules/router-store/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/schematics/tsconfig-bazel-build.json b/modules/schematics/tsconfig-bazel-build.json index a1d934e954..34951df11e 100644 --- a/modules/schematics/tsconfig-bazel-build.json +++ b/modules/schematics/tsconfig-bazel-build.json @@ -10,7 +10,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/schematics/tsconfig-build.json b/modules/schematics/tsconfig-build.json index f8c4a4506a..153f8480d5 100644 --- a/modules/schematics/tsconfig-build.json +++ b/modules/schematics/tsconfig-build.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/schematics/tsconfig.schematics.json b/modules/schematics/tsconfig.schematics.json index 4dcb0af50c..3fc1f247f3 100644 --- a/modules/schematics/tsconfig.schematics.json +++ b/modules/schematics/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/store-devtools/tsconfig-build.json b/modules/store-devtools/tsconfig-build.json index b0ca41d38a..1b97d30aa2 100644 --- a/modules/store-devtools/tsconfig-build.json +++ b/modules/store-devtools/tsconfig-build.json @@ -12,13 +12,11 @@ "noImplicitReturns": true, "downlevelIteration": true, "outDir": "../../dist/modules/store-devtools", - "paths": { - "@ngrx/store": ["../../dist/modules/store"] - }, + "paths": {}, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "target": "es2015", "skipLibCheck": true }, diff --git a/modules/store-devtools/tsconfig.schematics.json b/modules/store-devtools/tsconfig.schematics.json index 72f5a3c910..2dfddef2e7 100644 --- a/modules/store-devtools/tsconfig.schematics.json +++ b/modules/store-devtools/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/store/tsconfig-build.json b/modules/store/tsconfig-build.json index abcaa6c508..00b77b84f5 100644 --- a/modules/store/tsconfig-build.json +++ b/modules/store/tsconfig-build.json @@ -13,7 +13,7 @@ "sourceMap": true, "inlineSources": true, "target": "es2015", - "lib": ["es2015", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/modules/store/tsconfig.schematics.json b/modules/store/tsconfig.schematics.json index 76c1360564..e53393e33e 100644 --- a/modules/store/tsconfig.schematics.json +++ b/modules/store/tsconfig.schematics.json @@ -12,7 +12,7 @@ }, "sourceMap": true, "inlineSources": true, - "lib": ["es2017", "dom"], + "lib": ["es2018", "dom"], "skipLibCheck": true, "strict": true }, diff --git a/nx.json b/nx.json index 38d3db7ab5..e43fafb95c 100644 --- a/nx.json +++ b/nx.json @@ -7,6 +7,10 @@ "tslint.json": "*", "nx.json": "*" }, + "workspaceLayout": { + "appsDir": "projects", + "libsDir": "modules" + }, "tasksRunnerOptions": { "default": { "runner": "@nrwl/workspace/tasks-runners/default",