Skip to content

Commit

Permalink
docs(AngularCLI): Separated docs and added required section about dep…
Browse files Browse the repository at this point in the history
…endencies (ngrx#128)
  • Loading branch information
pontusr authored and brandonroberts committed Jun 6, 2016
1 parent bbdbb1e commit 5d1d646
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ That's it! You are ready to begin taking advantage of reactive routing!
* [Route and Query Parameters](./docs/overview/params.md)
* [Guarding Routes](./docs/overview/guards.md)
* [SystemJS Configuration](./docs/overview/systemjs.md)
* [Angular CLI Configuration](./docs/overview/systemjs.md#angular-cli-configuration)
* [Angular CLI Configuration](./docs/overview/angular-cli.md)
62 changes: 62 additions & 0 deletions docs/overview/angular-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Angular CLI Configuration
`Angular-CLI` is a CLI for making Angular 2 applications. In order to integrate `ngrx/router` into a CLI project we must install the ngrx/router and it's dependencies using NPM and edit the CLI project configuration so that the CLI project knows where to look for the ngrx/router.

## Installation
`npm install @ngrx/router @ngrx/core --save`

## Setup
The `angular-cli-build.js` and `system-config.ts` files must be updated for the CLI project to know where to find `ngrx/router`.

### angular-cli-build.js
The `vendorNpmFiles` array in the `angular-cli-build.js` file must be updated to include the ngrx/router and it's dependencies.

```js
vendorNpmFiles: [
'systemjs/dist/system-polyfills.js',
'systemjs/dist/system.src.js',
'zone.js/dist/**/*.+(js|js.map)',
'es6-shim/es6-shim.js',
'reflect-metadata/**/*.+(js|js.map)',
'rxjs/**/*.+(js|js.map)',
'@angular/**/*.+(js|js.map)',

/* ngrx/router begin */
'@ngrx/**/*.+(js|js.map)',
'path-to-regexp/*.+(js|js.map)',
'isarray/*.+(js|js.map)',
'query-string/*.+(js|js.map)',
'strict-uri-encode/*.+(js|js.map)',
'object-assign/*.+(js|js.map)'
/* ngrx/router end */
]
```

### system-config.ts
The `map` and `packages` constants must be updated in the `system-config.ts` file.

```js
/** Map relative paths to URLs. */
const map: any = {
/* ngrx/router begin */
'@ngrx': 'vendor/@ngrx',
'path-to-regexp": "vendor/path-to-regexp',
'isarray': 'vendor/isarray',
'query-string': 'vendor/query-string',
'strict-uri-encode': 'vendor/strict-uri-encode',
'object-assign': 'vendor/object-assign'
/* ngrx/router end */
};

/** User packages configuration. */
const packages: any = {
/* ngrx/router begin */
'@ngrx/core': { main: 'index' },
'@ngrx/router': { main: 'index' },
'path-to-regexp': { main: 'index' },
'isarray': { main: 'index' },
'query-string': { main: 'index' },
'strict-uri-encode': { main: 'index' },
'object-assign': { main: 'index' }
/* ngrx/router end */
};
```
47 changes: 0 additions & 47 deletions docs/overview/systemjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,50 +60,3 @@ System.config({
}
});
```

# Angular CLI Configuration
`Angular-CLI` is a cli for making Angular 2 applications. In order to integrate `ngrx/router` into a CLI project, it must be added to the CLI project configuration.

## Setup

The `system-config.ts` and `angular-cli-build.js` files must be updated for `ngrx/router`.

### system-config.ts

The `map` and `packages` sections must be updated in the `system-config.ts` file.

```js
/** Map relative paths to URLs. */
const map: any = {
'@ngrx': 'vendor/@ngrx',
"path-to-regexp": "vendor/path-to-regexp",
'isarray': 'vendor/isarray',
'query-string': 'vendor/query-string',
"strict-uri-encode": "vendor/strict-uri-encode",
"object-assign": "vendor/object-assign"
};

/** User packages configuration. */
const packages: any = {
"@ngrx/core": { main: 'index' },
"@ngrx/router": { main: 'index' },
"path-to-regexp": { main: 'index' },
"isarray": { main: 'index' },
"query-string": { main: 'index' },
"strict-uri-encode": { main: 'index' },
"object-assign": { main: 'index' }
};
```

### angular-cli-build.js

The `ngrx` scope and `ngrx/router` dependencies must also be added to the `vendorNpmFiles` section.

```js
'@ngrx/**/*.+(js|js.map)',
'path-to-regexp/*.+(js|js.map)',
'isarray/*.+(js|js.map)',
'query-string/*.+(js|js.map)',
'strict-uri-encode/*.+(js|js.map)',
'object-assign/*.+(js|js.map)'
```

0 comments on commit 5d1d646

Please sign in to comment.