From 31b0e6a78002745cea3246c400da2ec28919d710 Mon Sep 17 00:00:00 2001
From: James Salas <j@jamesbs.com>
Date: Thu, 24 Jan 2019 13:09:42 -0500
Subject: [PATCH 1/3] fix: remove upgrade artifacts, move build scripts into
 child

---
 package.json                                  | 27 ++++++++++++-------
 packages/example-app/README.md                |  8 ++++++
 packages/example-app/package.json             |  6 ++++-
 .../example-app/src/app/store/reducers.ts     |  3 +--
 packages/example-app/src/tsconfig.app.json    | 22 ++-------------
 packages/example-app/tsconfig.json            |  3 +--
 packages/form/package.json                    |  7 +++--
 packages/router/package.json                  |  7 +++--
 packages/router/src/router.ts                 |  1 -
 packages/store/package.json                   |  7 +++--
 10 files changed, 50 insertions(+), 41 deletions(-)

diff --git a/package.json b/package.json
index c2ff27f5..2295660c 100644
--- a/package.json
+++ b/package.json
@@ -1,17 +1,25 @@
 {
   "name": "platform",
   "private": true,
-  "workspaces": [
-    "packages/*"
-  ],
+  "workspaces": {
+    "packages": [
+      "packages/*"
+    ],
+    "nohoist": [
+      "example-app/@angular-redux/store",
+      "example-app/@angular-redux/form",
+      "example-app/@angular-redux/router",
+      "example-app/ng-packagr"
+    ]
+  },
   "scripts": {
     "build": "npm-run-all build:*",
-    "build:store": "ng-packagr -p packages/store",
-    "build:form": "ng-packagr -p packages/form",
-    "build:router": "ng-packagr -p packages/router",
-    "release:canary": "lerna publish --canary --npm-tag next --npm-client npm",
+    "build:store": "yarn workspace store build",
+    "build:form": "yarn workspace form build",
+    "build:router": "yarn workspace router build",
+    "release:canary": "lerna publish --canary --contents dist --dist-tag next",
     "release:stable": "lerna version",
-    "release:stable:ci": "lerna publish from-git",
+    "release:stable:ci": "lerna publish from-git --contents dist",
     "clean": "npm-run-all -p clean:*",
     "clean:deps": "npm-run-all -p clean:deps:*",
     "clean:deps:workspace": "rimraf node_modules",
@@ -26,7 +34,8 @@
     "test:ci": "jest --coverage --ci --maxWorkers=2",
     "test:watch": "jest --watch",
     "commit": "commit",
-    "prettier": "prettier --write \"**/*.*(ts|js|css|scss|json|md)\""
+    "prettier": "prettier --write \"**/*.*(ts|js|css|scss|json|md)\"",
+    "run:app": ""
   },
   "lint-staged": {
     "*.{ts,js,css,scss,json,md}": [
diff --git a/packages/example-app/README.md b/packages/example-app/README.md
index 3407229a..d72767d6 100644
--- a/packages/example-app/README.md
+++ b/packages/example-app/README.md
@@ -10,6 +10,10 @@ application.
 - [@angular-redux/form](/packages/form) Time travel with Angular forms
 - [Redux DevTools Chrome Extension](https://github.com/zalmoxisus/redux-devtools-extension)
 
+## Bootstrapping
+
+Before being able to run the app, you will need to bootstrap the workspace dependencies linked by yarn. This can be done using the command `yarn bootstrap`.
+
 ## Development server
 
 Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
@@ -31,6 +35,10 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
 Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
 Before running the tests make sure you are serving the app via `ng serve`.
 
+## Using the folder as a standalone
+
+The versions included in `package.json` for the `@angular-redux` dependencies are linked using **yarn workspaces** and will need to be changed to a _latest_ or _next_ version if you want to detach the app as a standalone.
+
 ## Further help
 
 To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/packages/example-app/package.json b/packages/example-app/package.json
index ffbc9ab1..c0a2d4f0 100644
--- a/packages/example-app/package.json
+++ b/packages/example-app/package.json
@@ -9,7 +9,11 @@
     "build": "ng build",
     "test": "ng test",
     "lint": "ng lint",
-    "e2e": "ng e2e"
+    "e2e": "ng e2e",
+    "bootstrap": "npm-run-all bootstrap:*",
+    "bootstrap:store": "npm explore @angular-redux/store -- npm run build",
+    "bootstrap:form": "npm explore @angular-redux/form -- npm run build",
+    "bootstrap:router": "npm explore @angular-redux/router -- npm run build"
   },
   "engines": {
     "node": ">=8"
diff --git a/packages/example-app/src/app/store/reducers.ts b/packages/example-app/src/app/store/reducers.ts
index 06e6610a..a9e1dc7b 100644
--- a/packages/example-app/src/app/store/reducers.ts
+++ b/packages/example-app/src/app/store/reducers.ts
@@ -5,13 +5,12 @@ import { combineReducers } from 'redux';
 import { createAnimalAPIReducer } from '../animals/api/reducer';
 import { ANIMAL_TYPES } from '../animals/model';
 
-const elephant = createAnimalAPIReducer(ANIMAL_TYPES.ELEPHANT);
 // Define the global store shape by combining our application's
 // reducers together into a given structure.
 export const rootReducer = composeReducers(
   defaultFormReducer<unknown>(),
   combineReducers({
-    elephant,
+    elephant: createAnimalAPIReducer(ANIMAL_TYPES.ELEPHANT),
     lion: createAnimalAPIReducer(ANIMAL_TYPES.LION),
     router: routerReducer,
   }),
diff --git a/packages/example-app/src/tsconfig.app.json b/packages/example-app/src/tsconfig.app.json
index 8c1fc447..fb7c566b 100644
--- a/packages/example-app/src/tsconfig.app.json
+++ b/packages/example-app/src/tsconfig.app.json
@@ -1,26 +1,8 @@
 {
+  "extends": "../tsconfig.json",
   "compilerOptions": {
-    "sourceMap": true,
-    "declaration": false,
-    "moduleResolution": "node",
-    "emitDecoratorMetadata": true,
-    "experimentalDecorators": true,
-    "lib": ["es2016", "dom"],
     "outDir": "../out-tsc/app",
-    "target": "es5",
-    "module": "es2015",
-    "baseUrl": ".",
-    "types": [],
-    "paths": {
-      "@angular/*": ["../node_modules/@angular/*"]
-    },
-
-    // Causes problems for @Outputs. See https://github.com/angular/angular/issues/17131.
-    // "noUnusedParameters": true,
-    // "noUnusedLocals": true,
-
-    "forceConsistentCasingInFileNames": true,
-    "pretty": true
+    "types": []
   },
   "exclude": ["test.ts", "**/*.spec.ts"]
 }
diff --git a/packages/example-app/tsconfig.json b/packages/example-app/tsconfig.json
index 58eb9941..7e45f7a8 100644
--- a/packages/example-app/tsconfig.json
+++ b/packages/example-app/tsconfig.json
@@ -11,10 +11,9 @@
     "experimentalDecorators": true,
     "importHelpers": true,
     "target": "es5",
-    "typeRoots": ["node_modules/@types"],
     "lib": ["es2018", "dom"],
     "paths": {
-      "@angular/*": ["../node_modules/@angular/*"]
+      "@angular-redux/*": ["node_modules/@angular-redux/*/dist"]
     },
 
     // Causes problems for @Outputs with AoT.
diff --git a/packages/form/package.json b/packages/form/package.json
index 872e6e6e..3979c698 100644
--- a/packages/form/package.json
+++ b/packages/form/package.json
@@ -5,6 +5,10 @@
   "author": "Chris Bond",
   "license": "MIT",
   "homepage": "https://github.com/angular-redux/platform",
+  "main": "src/index.ts",
+  "scripts": {
+    "build": "ng-packagr -p ."
+  },
   "repository": {
     "type": "git",
     "url": "git+https://github.com/angular-redux/platform.git"
@@ -33,6 +37,5 @@
   },
   "dependencies": {
     "immutable": "^4.0.0-rc.12"
-  },
-  "main": "src/index.ts"
+  }
 }
diff --git a/packages/router/package.json b/packages/router/package.json
index d5d78f1a..a2a14fb7 100644
--- a/packages/router/package.json
+++ b/packages/router/package.json
@@ -5,6 +5,10 @@
   "author": "Dag Stuan",
   "license": "MIT",
   "homepage": "https://github.com/angular-redux/platform",
+  "main": "src/index.ts",
+  "scripts": {
+    "build": "ng-packagr -p ."
+  },
   "repository": {
     "type": "git",
     "url": "git+https://github.com/angular-redux/platform.git"
@@ -32,6 +36,5 @@
     "@angular/router": "^7.0.0",
     "redux": "^4.0.0",
     "rxjs": "^6.0.0"
-  },
-  "main": "src/index.ts"
+  }
 }
diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts
index a7bf573c..be6e5182 100644
--- a/packages/router/src/router.ts
+++ b/packages/router/src/router.ts
@@ -19,7 +19,6 @@ export class NgReduxRouter {
   constructor(
     private router: Router,
     private ngRedux: NgRedux<any>,
-    // private applicationRef: ApplicationRef,
     private location: Location,
   ) {}
 
diff --git a/packages/store/package.json b/packages/store/package.json
index 23169057..ac55a903 100644
--- a/packages/store/package.json
+++ b/packages/store/package.json
@@ -5,6 +5,10 @@
   "author": "William Buchwalter <wbuchwalter@gmail.com> (http://github.com/wbuchwalter)",
   "license": "MIT",
   "homepage": "https://github.com/angular-redux/platform",
+  "main": "src/index.ts",
+  "scripts": {
+    "build": "ng-packagr -p ."
+  },
   "repository": {
     "type": "git",
     "url": "git+https://github.com/angular-redux/platform.git"
@@ -32,6 +36,5 @@
   },
   "devDependencies": {
     "redux-devtools-extension": "^2.13.7"
-  },
-  "main": "src/index.ts"
+  }
 }

From 0ae48d333a0702679efd7f5c72a4c553d7712357 Mon Sep 17 00:00:00 2001
From: James Salas <j@jamesbs.com>
Date: Thu, 24 Jan 2019 15:06:57 -0500
Subject: [PATCH 2/3] chore: include ability to run example-app as monorepo
 script

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 2295660c..b7b80b93 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
     "test:watch": "jest --watch",
     "commit": "commit",
     "prettier": "prettier --write \"**/*.*(ts|js|css|scss|json|md)\"",
-    "run:app": ""
+    "run:app": "yarn workspace example-app bootstrap && yarn workspace example-app start"
   },
   "lint-staged": {
     "*.{ts,js,css,scss,json,md}": [

From 640302f1eeca604d9898ef5e40a6bf394ef41e0b Mon Sep 17 00:00:00 2001
From: James Salas <j@jamesbs.com>
Date: Thu, 24 Jan 2019 15:15:46 -0500
Subject: [PATCH 3/3] fix: incorrect workspace names provided to build scripts

---
 package.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index b7b80b93..4f65aa31 100644
--- a/package.json
+++ b/package.json
@@ -14,9 +14,9 @@
   },
   "scripts": {
     "build": "npm-run-all build:*",
-    "build:store": "yarn workspace store build",
-    "build:form": "yarn workspace form build",
-    "build:router": "yarn workspace router build",
+    "build:store": "yarn workspace @angular-redux/store build",
+    "build:form": "yarn workspace @angular-redux/form build",
+    "build:router": "yarn workspace @angular-redux/router build",
     "release:canary": "lerna publish --canary --contents dist --dist-tag next",
     "release:stable": "lerna version",
     "release:stable:ci": "lerna publish from-git --contents dist",