Skip to content

Commit 5978612

Browse files
refactor: rename package to @angular-component/router (#80)
Closes #65
1 parent 90e975f commit 5978612

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+117
-98
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- restore_cache:
3232
keys:
3333
- *cache_key
34-
- run: yarn nx build angular-routing --prod
34+
- run: yarn build
3535

3636
test:
3737
<<: *run_in_node
@@ -40,7 +40,7 @@ jobs:
4040
- restore_cache:
4141
keys:
4242
- *cache_key
43-
- run: yarn nx test angular-routing
43+
- run: yarn test
4444

4545
test-e2e:
4646
<<: *run_in_browser
@@ -49,7 +49,7 @@ jobs:
4949
- restore_cache:
5050
keys:
5151
- *cache_key
52-
- run: yarn nx e2e example-app-e2e
52+
- run: yarn affected:e2e --base=origin/master
5353

5454
workflows:
5555
version: 2

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 Brandon Roberts
3+
Copyright (c) 2020-2021 Brandon Roberts
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Angular Routing
1+
# Angular Component Router
22

33
[![npm version](https://img.shields.io/npm/v/angular-routing.svg)](https://www.npmjs.com/package/angular-routing)
44

@@ -15,36 +15,36 @@
1515
Use your package manager of choice to install the package.
1616

1717
```sh
18-
npm install angular-routing
18+
npm install @angular-component/router
1919
```
2020

2121
OR
2222

2323
```sh
24-
yarn add angular-routing
24+
yarn add @angular-component/router
2525
```
2626

2727
## Installation with ng add
2828

2929
You can use ng add to install the package by using the command below.
3030

3131
```sh
32-
ng add angular-routing
32+
ng add @angular-component/router
3333
```
3434

35-
The above command will install the package, and add the RoutingModule import in the AppModule.
35+
The above command will install the package, and add the ComponentRouterModule import in the AppModule.
3636

3737
## Usage
3838

39-
To register the Router, add the `RoutingModule.forRoot()` to your AppModule imports.
39+
To register the Router, add the `ComponentRouterModule.forRoot()` to your AppModule imports.
4040

4141
```ts
42-
import { RoutingModule } from 'angular-routing';
42+
import { ComponentRouterModule } from '@angular-component/router';
4343

4444
@NgModule({
4545
imports: [
4646
// ... other imports
47-
RoutingModule.forRoot(),
47+
ComponentRouterModule.forRoot(),
4848
],
4949
})
5050
export class AppModule {}
@@ -53,12 +53,12 @@ export class AppModule {}
5353
Or in a feature module
5454

5555
```ts
56-
import { RoutingModule } from 'angular-routing';
56+
import { ComponentRouterModule } from '@angular-component/router';
5757

5858
@NgModule({
5959
imports: [
6060
// ... other imports
61-
RoutingModule,
61+
ComponentRouterModule,
6262
],
6363
})
6464
export class FeatureModule {}
@@ -170,7 +170,7 @@ To navigate from a component class, or get global route information, such as the
170170

171171
```ts
172172
import { Component } from '@angular/core';
173-
import { Router } from 'angular-routing';
173+
import { Router } from '@angular-component/router';
174174

175175
@Component({...})
176176
export class MyComponent {
@@ -201,7 +201,7 @@ To get the route params, inject the `RouteParams` observable. Provide a type for
201201

202202
```ts
203203
import { Component } from '@angular/core';
204-
import { RouteParams } from 'angular-routing';
204+
import { RouteParams } from '@angular-component/router';
205205

206206
@Component({...})
207207
export class MyComponent {
@@ -221,7 +221,7 @@ To get the route params, inject the `QueryParams` observable. Provide a type for
221221

222222
```ts
223223
import { Component } from '@angular/core';
224-
import { QueryParams } from 'angular-routing';
224+
import { QueryParams } from '@angular-component/router';
225225

226226
@Component({...})
227227
export class MyComponent {
@@ -260,7 +260,7 @@ Register a component to register the child routes.
260260

261261
```ts
262262
import { NgModule, Component } from '@angular/core';
263-
import { ModuleWithRoute } from 'angular-routing';
263+
import { ModuleWithRoute } from '@angular-component/router';
264264

265265
@Component({
266266
template: `

angular.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"version": 1,
33
"projects": {
4-
"angular-routing": {
4+
"router": {
55
"projectType": "library",
6-
"root": "libs/angular-routing",
7-
"sourceRoot": "libs/angular-routing/src",
6+
"root": "libs/router",
7+
"sourceRoot": "libs/router/src",
88
"prefix": "reactiveangular",
99
"architect": {
1010
"build-package": {
1111
"builder": "@nrwl/angular:package",
1212
"options": {
13-
"tsConfig": "libs/angular-routing/tsconfig.lib.json",
14-
"project": "libs/angular-routing/ng-package.json"
13+
"tsConfig": "libs/router/tsconfig.lib.json",
14+
"project": "libs/router/ng-package.json"
1515
},
1616
"configurations": {
1717
"production": {
18-
"tsConfig": "libs/angular-routing/tsconfig.lib.prod.json"
18+
"tsConfig": "libs/router/tsconfig.lib.prod.json"
1919
}
2020
}
2121
},
@@ -25,10 +25,10 @@
2525
"parallel": false,
2626
"commands": [
2727
{
28-
"command": "ng run angular-routing:build-package"
28+
"command": "ng run router:build-package"
2929
},
3030
{
31-
"command": "yarn tsc -p libs/angular-routing/tsconfig.schematics.json"
31+
"command": "yarn tsc -p libs/router/tsconfig.schematics.json"
3232
}
3333
]
3434
}
@@ -37,19 +37,19 @@
3737
"builder": "@angular-devkit/build-angular:tslint",
3838
"options": {
3939
"tsConfig": [
40-
"libs/angular-routing/tsconfig.lib.json",
41-
"libs/angular-routing/tsconfig.spec.json"
40+
"libs/router/tsconfig.lib.json",
41+
"libs/router/tsconfig.spec.json"
4242
],
43-
"exclude": ["**/node_modules/**", "!libs/angular-routing/**/*"]
43+
"exclude": ["**/node_modules/**", "!libs/router/**/*"]
4444
}
4545
},
4646
"test": {
4747
"builder": "@nrwl/jest:jest",
4848
"options": {
49-
"jestConfig": "libs/angular-routing/jest.config.js",
50-
"tsConfig": "libs/angular-routing/tsconfig.spec.json",
49+
"jestConfig": "libs/router/jest.config.js",
50+
"tsConfig": "libs/router/tsconfig.spec.json",
5151
"passWithNoTests": true,
52-
"setupFile": "libs/angular-routing/src/test-setup.ts"
52+
"setupFile": "libs/router/src/test-setup.ts"
5353
}
5454
}
5555
},
@@ -548,5 +548,5 @@
548548
"unitTestRunner": "jest"
549549
}
550550
},
551-
"defaultProject": "angular-routing"
551+
"defaultProject": "router"
552552
}

apps/example-app/src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
33
import { HttpClientModule } from '@angular/common/http';
44
import { BrowserModule } from '@angular/platform-browser';
55
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
6-
import { RoutingModule } from 'angular-routing';
6+
import { ComponentRouterModule } from '@angular-component/router';
77

88
import { StoreModule } from '@ngrx/store';
99
import { EffectsModule } from '@ngrx/effects';
@@ -21,7 +21,7 @@ import { AppComponent } from '@example-app/core/containers';
2121
BrowserModule,
2222
BrowserAnimationsModule,
2323
HttpClientModule,
24-
RoutingModule.forRoot(),
24+
ComponentRouterModule.forRoot(),
2525

2626
/**
2727
* StoreModule.forRoot is imported once in the root module, accepting a reducer

apps/example-app/src/app/auth/effects/auth.effects.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestBed } from '@angular/core/testing';
22
import { MatDialog } from '@angular/material/dialog';
3-
import { Router } from 'angular-routing';
3+
import { Router } from '@angular-component/router';
44
import { Actions } from '@ngrx/effects';
55
import { provideMockActions } from '@ngrx/effects/testing';
66
import { cold, hot } from 'jasmine-marbles';

apps/example-app/src/app/auth/effects/auth.effects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
22
import { MatDialog } from '@angular/material/dialog';
3-
import { Router } from 'angular-routing';
3+
import { Router } from '@angular-component/router';
44
import { Actions, ofType, createEffect } from '@ngrx/effects';
55
import { of } from 'rxjs';
66
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';

apps/example-app/src/app/books/books.module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import {
2020

2121
import { MaterialModule } from '@example-app/material';
2222
import { PipesModule } from '@example-app/shared/pipes';
23-
import { RoutingModule, ModuleWithRoute } from 'angular-routing';
23+
import {
24+
ComponentRouterModule,
25+
ModuleWithRoute,
26+
} from '@angular-component/router';
2427
import { AuthGuard } from '@example-app/auth/services';
2528
import { BookEffects, CollectionEffects } from '@example-app/books/effects';
2629

@@ -70,7 +73,7 @@ export const CONTAINERS = [
7073
imports: [
7174
CommonModule,
7275
MaterialModule,
73-
RoutingModule,
76+
ComponentRouterModule,
7477
PipesModule,
7578
/**
7679
* StoreModule.forFeature is used for composing state

apps/example-app/src/app/books/containers/collection-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
3-
import { RoutingModule } from 'angular-routing';
3+
import { ComponentRouterModule } from '@angular-component/router';
44

55
import { MockStore, provideMockStore } from '@ngrx/store/testing';
66

@@ -23,7 +23,7 @@ describe('Collection Page', () => {
2323

2424
beforeEach(() => {
2525
TestBed.configureTestingModule({
26-
imports: [NoopAnimationsModule, MaterialModule, RoutingModule],
26+
imports: [NoopAnimationsModule, MaterialModule, ComponentRouterModule],
2727
declarations: [
2828
CollectionPageComponent,
2929
BookPreviewListComponent,

apps/example-app/src/app/books/containers/find-book-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { ReactiveFormsModule } from '@angular/forms';
33
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
4-
import { RoutingModule } from 'angular-routing';
4+
import { ComponentRouterModule } from '@angular-component/router';
55

66
import { MockStore, provideMockStore } from '@ngrx/store/testing';
77

@@ -27,7 +27,7 @@ describe('Find Book Page', () => {
2727
TestBed.configureTestingModule({
2828
imports: [
2929
NoopAnimationsModule,
30-
RoutingModule,
30+
ComponentRouterModule,
3131
MaterialModule,
3232
ReactiveFormsModule,
3333
],

0 commit comments

Comments
 (0)