Skip to content

Commit 9137655

Browse files
author
James Salas
authored
fix: Issue with example-app compilation, script rework, minor cleanup (#71)
* fix: resolve issue with example-app compilation * chore: rework build scripts, include ability to run example-app as monorepo script
1 parent 94617b3 commit 9137655

File tree

10 files changed

+50
-41
lines changed

10 files changed

+50
-41
lines changed

package.json

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
{
22
"name": "platform",
33
"private": true,
4-
"workspaces": [
5-
"packages/*"
6-
],
4+
"workspaces": {
5+
"packages": [
6+
"packages/*"
7+
],
8+
"nohoist": [
9+
"example-app/@angular-redux/store",
10+
"example-app/@angular-redux/form",
11+
"example-app/@angular-redux/router",
12+
"example-app/ng-packagr"
13+
]
14+
},
715
"scripts": {
816
"build": "npm-run-all build:*",
9-
"build:store": "ng-packagr -p packages/store",
10-
"build:form": "ng-packagr -p packages/form",
11-
"build:router": "ng-packagr -p packages/router",
12-
"release:canary": "lerna publish --canary --npm-tag next --npm-client npm",
17+
"build:store": "yarn workspace @angular-redux/store build",
18+
"build:form": "yarn workspace @angular-redux/form build",
19+
"build:router": "yarn workspace @angular-redux/router build",
20+
"release:canary": "lerna publish --canary --contents dist --dist-tag next",
1321
"release:stable": "lerna version",
14-
"release:stable:ci": "lerna publish from-git",
22+
"release:stable:ci": "lerna publish from-git --contents dist",
1523
"clean": "npm-run-all -p clean:*",
1624
"clean:deps": "npm-run-all -p clean:deps:*",
1725
"clean:deps:workspace": "rimraf node_modules",
@@ -26,7 +34,8 @@
2634
"test:ci": "jest --coverage --ci --maxWorkers=2",
2735
"test:watch": "jest --watch",
2836
"commit": "commit",
29-
"prettier": "prettier --write \"**/*.*(ts|js|css|scss|json|md)\""
37+
"prettier": "prettier --write \"**/*.*(ts|js|css|scss|json|md)\"",
38+
"run:app": "yarn workspace example-app bootstrap && yarn workspace example-app start"
3039
},
3140
"lint-staged": {
3241
"*.{ts,js,css,scss,json,md}": [

packages/example-app/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ application.
1010
- [@angular-redux/form](/packages/form) Time travel with Angular forms
1111
- [Redux DevTools Chrome Extension](https://github.com/zalmoxisus/redux-devtools-extension)
1212

13+
## Bootstrapping
14+
15+
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`.
16+
1317
## Development server
1418

1519
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.
3135
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
3236
Before running the tests make sure you are serving the app via `ng serve`.
3337

38+
## Using the folder as a standalone
39+
40+
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.
41+
3442
## Further help
3543

3644
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).

packages/example-app/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
"build": "ng build",
1010
"test": "ng test",
1111
"lint": "ng lint",
12-
"e2e": "ng e2e"
12+
"e2e": "ng e2e",
13+
"bootstrap": "npm-run-all bootstrap:*",
14+
"bootstrap:store": "npm explore @angular-redux/store -- npm run build",
15+
"bootstrap:form": "npm explore @angular-redux/form -- npm run build",
16+
"bootstrap:router": "npm explore @angular-redux/router -- npm run build"
1317
},
1418
"engines": {
1519
"node": ">=8"

packages/example-app/src/app/store/reducers.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import { combineReducers } from 'redux';
55
import { createAnimalAPIReducer } from '../animals/api/reducer';
66
import { ANIMAL_TYPES } from '../animals/model';
77

8-
const elephant = createAnimalAPIReducer(ANIMAL_TYPES.ELEPHANT);
98
// Define the global store shape by combining our application's
109
// reducers together into a given structure.
1110
export const rootReducer = composeReducers(
1211
defaultFormReducer<unknown>(),
1312
combineReducers({
14-
elephant,
13+
elephant: createAnimalAPIReducer(ANIMAL_TYPES.ELEPHANT),
1514
lion: createAnimalAPIReducer(ANIMAL_TYPES.LION),
1615
router: routerReducer,
1716
}),
+2-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"sourceMap": true,
4-
"declaration": false,
5-
"moduleResolution": "node",
6-
"emitDecoratorMetadata": true,
7-
"experimentalDecorators": true,
8-
"lib": ["es2016", "dom"],
94
"outDir": "../out-tsc/app",
10-
"target": "es5",
11-
"module": "es2015",
12-
"baseUrl": ".",
13-
"types": [],
14-
"paths": {
15-
"@angular/*": ["../node_modules/@angular/*"]
16-
},
17-
18-
// Causes problems for @Outputs. See https://github.com/angular/angular/issues/17131.
19-
// "noUnusedParameters": true,
20-
// "noUnusedLocals": true,
21-
22-
"forceConsistentCasingInFileNames": true,
23-
"pretty": true
5+
"types": []
246
},
257
"exclude": ["test.ts", "**/*.spec.ts"]
268
}

packages/example-app/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
"experimentalDecorators": true,
1212
"importHelpers": true,
1313
"target": "es5",
14-
"typeRoots": ["node_modules/@types"],
1514
"lib": ["es2018", "dom"],
1615
"paths": {
17-
"@angular/*": ["../node_modules/@angular/*"]
16+
"@angular-redux/*": ["node_modules/@angular-redux/*/dist"]
1817
},
1918

2019
// Causes problems for @Outputs with AoT.

packages/form/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"author": "Chris Bond",
66
"license": "MIT",
77
"homepage": "https://github.com/angular-redux/platform",
8+
"main": "src/index.ts",
9+
"scripts": {
10+
"build": "ng-packagr -p ."
11+
},
812
"repository": {
913
"type": "git",
1014
"url": "git+https://github.com/angular-redux/platform.git"
@@ -33,6 +37,5 @@
3337
},
3438
"dependencies": {
3539
"immutable": "^4.0.0-rc.12"
36-
},
37-
"main": "src/index.ts"
40+
}
3841
}

packages/router/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"author": "Dag Stuan",
66
"license": "MIT",
77
"homepage": "https://github.com/angular-redux/platform",
8+
"main": "src/index.ts",
9+
"scripts": {
10+
"build": "ng-packagr -p ."
11+
},
812
"repository": {
913
"type": "git",
1014
"url": "git+https://github.com/angular-redux/platform.git"
@@ -32,6 +36,5 @@
3236
"@angular/router": "^7.0.0",
3337
"redux": "^4.0.0",
3438
"rxjs": "^6.0.0"
35-
},
36-
"main": "src/index.ts"
39+
}
3740
}

packages/router/src/router.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export class NgReduxRouter {
1919
constructor(
2020
private router: Router,
2121
private ngRedux: NgRedux<any>,
22-
// private applicationRef: ApplicationRef,
2322
private location: Location,
2423
) {}
2524

packages/store/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"author": "William Buchwalter <[email protected]> (http://github.com/wbuchwalter)",
66
"license": "MIT",
77
"homepage": "https://github.com/angular-redux/platform",
8+
"main": "src/index.ts",
9+
"scripts": {
10+
"build": "ng-packagr -p ."
11+
},
812
"repository": {
913
"type": "git",
1014
"url": "git+https://github.com/angular-redux/platform.git"
@@ -32,6 +36,5 @@
3236
},
3337
"devDependencies": {
3438
"redux-devtools-extension": "^2.13.7"
35-
},
36-
"main": "src/index.ts"
39+
}
3740
}

0 commit comments

Comments
 (0)