Skip to content

Commit 4fe82a0

Browse files
feat(schematic-src): Remove path mappings
(#25) * feat(schematic-src): Remove path mappings Relative paths are favorable - these schematics should be usable in projects without having to set custom TS paths up. * feat(schematics): Remove template path mappings * fix template arg * get sandbox-app tests passing * adjust test scripts
1 parent d68662b commit 4fe82a0

23 files changed

+40
-42
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
4+
**/dist
55
/tmp
66
/out-tsc
77

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"build:schematic": "tsc -p tsconfig.schematic.json",
1111
"build:schematic:watch": "tsc -p tsconfig.schematic.json -watch",
1212
"clean": "git checkout HEAD -- sandbox-app && git clean -fd sandbox-app",
13-
"clean:launch": "npm run clean && npm run launch",
13+
"clean:launch": "yarn clean && yarn launch",
1414
"clean:launch:all": "yarn build:run:fileBuilder && yarn build:schematic && yarn clean:launch",
1515
"launch": "cd sandbox-app && ng g @briebug/ngrx-entity-schematic:ngrx-entity-schematic",
16-
"test:ci": "npm run clean:launch && npm run test:sandbox && npm run clean",
17-
"test:sandbox": "cd sandbox-app && npm run lint && npm run test && npm run e2e && npm run build",
16+
"test:ci": "yarn clean:launch briebug --init && yarn test:sandbox && yarn clean",
17+
"test:sandbox": "cd sandbox-app && yarn lint && yarn test && yarn e2e && yarn build",
1818
"link:schematic": "yarn link && cd sandbox-app && yarn link @briebug/ngrx-entity-schematic"
1919
},
2020
"dependencies": {

sandbox-app/e2e/src/app.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe('workspace-project App', () => {
99

1010
it('should display welcome message', () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Welcome to app!');
12+
expect(page.getParagraphText()).toEqual('Test Entities');
1313
});
1414
});

sandbox-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"ng": "ng",
66
"start": "ng serve",
77
"build": "ng build",
8-
"test": "ng test",
8+
"test": "ng test --watch=false",
99
"lint": "ng lint",
1010
"e2e": "ng e2e"
1111
},

sandbox-app/src/app/entities/containers/entity/entity.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1>Test Entity</h1>
88
[disableFields]="isLoading$ | async"
99
[showErrors]="showFormErrors"
1010
(briebugChanged)="onBriebugChanged($event)"
11-
(submit)="onSubmit($event)"
11+
(submit)="onSubmit()"
1212
></app-briebug-form>
1313

1414
<a routerLink="/entities">Back to list</a>

schematic-src/src/app/core/core.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core
22
import { CommonModule } from '@angular/common';
33
import { HttpClientModule } from '@angular/common/http';
44

5-
import { BriebugService } from '@state/briebug/briebug.service';
5+
import { BriebugService } from '../state/briebug/briebug.service';
66

77
@NgModule({
88
imports: [CommonModule, HttpClientModule],

schematic-src/src/app/core/in-memory-data.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Briebug } from '@state/briebug/briebug.model';
1+
import { Briebug } from '../state/briebug/briebug.model';
22

33
export class InMemoryDataService {
44
createDb() {

schematic-src/src/app/entities/components/entity-form/entity-form.component.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22
import { SimpleChange } from '@angular/core';
33
import { ReactiveFormsModule } from '@angular/forms';
44

5-
import { BriebugFormComponent } from './entity-form.component';
6-
import { generateBriebug } from '@state/briebug/briebug.model';
75
import { fromEvent } from 'rxjs';
86

7+
import { BriebugFormComponent } from './entity-form.component';
8+
import { generateBriebug } from '../../../state/briebug/briebug.model';
9+
910
describe('BreibugFormComponent', () => {
1011
let component: BriebugFormComponent;
1112
let fixture: ComponentFixture<BriebugFormComponent>;

schematic-src/src/app/entities/components/entity-form/entity-form.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import {
88
OnDestroy,
99
ChangeDetectionStrategy
1010
} from '@angular/core';
11-
12-
import { Briebug } from '@state/briebug/briebug.model';
1311
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
1412
import { Subject } from 'rxjs';
13+
1514
import { takeUntil, skip, debounceTime } from 'rxjs/operators';
1615

16+
import { Briebug } from '../../../state/briebug/briebug.model';
17+
1718
@Component({
1819
selector: 'app-briebug-form',
1920
templateUrl: './entity-form.component.html',

schematic-src/src/app/entities/containers/entity-list/entity-list.component.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { RouterTestingModule } from '@angular/router/testing';
44
import { Store, StoreModule } from '@ngrx/store';
55

66
import { BriebugListComponent } from './entity-list.component';
7-
import { appReducer } from '@state/app.reducer';
8-
import { AppState } from '@state/app.interfaces';
7+
import { appReducer } from '../../../state/app.reducer';
8+
import { AppState } from '../../../state/app.interfaces';
99
import {
1010
SearchAllBriebugEntities,
1111
SearchAllBriebugEntitiesSuccess,
1212
SearchAllBriebugEntitiesFail
13-
} from '@state/briebug/briebug.actions';
14-
import { generateBriebugArray } from '@state/briebug/briebug.model';
13+
} from '../../../state/briebug/briebug.actions';
14+
import { generateBriebugArray } from '../../../state/briebug/briebug.model';
1515

1616
describe('BriebugListComponent', () => {
1717
let component: BriebugListComponent;

schematic-src/src/app/entities/containers/entity-list/entity-list.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import {
88
getAllBriebugEntitiesAsArray,
99
getLoading,
1010
getError
11-
} from '@state/briebug';
12-
import { BriebugState } from '@state/briebug/briebug.reducer';
11+
} from '../../../state/briebug';
12+
import { BriebugState } from '../../../state/briebug/briebug.reducer';
1313
import {
1414
SearchAllBriebugEntities,
1515
DeleteBriebugById
16-
} from '@state/briebug/briebug.actions';
17-
import { Briebug } from '@state/briebug/briebug.model';
16+
} from '../../../state/briebug/briebug.actions';
17+
import { Briebug } from '../../../state/briebug/briebug.model';
1818

1919
@Component({
2020
templateUrl: './entity-list.component.html',

schematic-src/src/app/entities/containers/entity/entity.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1>Test Entity</h1>
88
[disableFields]="isLoading$ | async"
99
[showErrors]="showFormErrors"
1010
(briebugChanged)="onBriebugChanged($event)"
11-
(submit)="onSubmit($event)"
11+
(submit)="onSubmit()"
1212
></app-briebug-form>
1313

1414
<a routerLink="/entities">Back to list</a>

schematic-src/src/app/entities/containers/entity/entity.component.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import { RouterTestingModule } from '@angular/router/testing';
33
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
44
import { ActivatedRoute, convertToParamMap } from '@angular/router';
55

6-
import * as fromRoot from '@state/app.reducer';
6+
import * as fromRoot from '../../../state/app.reducer';
77
import { Store, StoreModule } from '@ngrx/store';
88
import { Subject } from 'rxjs';
99

1010
import { BriebugComponent } from './entity.component';
1111
import { BriebugFormComponent } from '../../components/entity-form/entity-form.component';
12-
import { AppState } from '@state/app.interfaces';
13-
import { generateBriebug } from '@state/briebug/briebug.model';
12+
import { AppState } from '../../../state/app.interfaces';
13+
import { generateBriebug } from '../../../state/briebug/briebug.model';
1414
import {
1515
LoadBriebugById,
1616
LoadBriebugByIdSuccess,
1717
SelectBriebugById,
1818
LoadBriebugByIdFail,
1919
UpdateBriebug,
2020
InsertBriebug
21-
} from '@state/briebug/briebug.actions';
21+
} from '../../../state/briebug/briebug.actions';
2222
import { skip } from 'rxjs/operators';
2323

2424
describe('BriebugComponent', () => {

schematic-src/src/app/entities/containers/entity/entity.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import {
1212
combineLatest
1313
} from 'rxjs/operators';
1414

15-
import { getLoading, getSelectedBriebug, getError } from '@state/briebug';
16-
import { Briebug } from '@state/briebug/briebug.model';
15+
import { getLoading, getSelectedBriebug, getError } from '../../../state/briebug';
16+
import { Briebug } from '../../../state/briebug/briebug.model';
1717
import {
1818
LoadBriebugById,
1919
InsertBriebug,
2020
UpdateBriebug,
2121
SelectBriebugById
22-
} from '@state/briebug/briebug.actions';
23-
import { BriebugState } from '@state/briebug/briebug.reducer';
22+
} from '../../../state/briebug/briebug.actions';
23+
import { BriebugState } from '../../../state/briebug/briebug.reducer';
2424

2525
@Component({
2626
templateUrl: './entity.component.html',

schematic-src/src/app/state/briebug/briebug.actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Action } from '@ngrx/store';
22
import { Update } from '@ngrx/entity';
33
import { Briebug } from './briebug.model';
4-
import { BriebugSearchQuery } from '@state/briebug/briebug.reducer';
4+
import { BriebugSearchQuery } from './briebug.reducer';
55

66
export enum BriebugActionTypes {
77
InsertBriebug = '[Briebug] Insert',

schematic-src/src/app/state/briebug/briebug.effects.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import { generateBriebug, generateBriebugArray } from './briebug.model';
2424
// TODO: Change this path when you move your service file:
2525
import { BriebugService } from './briebug.service';
26-
import { BriebugEffects } from '@state/briebug/briebug.effects';
26+
import { BriebugEffects } from './briebug.effects';
2727

2828
describe('BriebugEffects', () => {
2929
let actions: Observable<any>;

schematic-src/src/app/state/briebug/briebug.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { HttpClient } from '@angular/common/http';
99

1010
import { Observable, of } from 'rxjs';
1111
import { switchMap } from 'rxjs/operators';
12-
import { Briebug } from '@state/briebug/briebug.model';
12+
import { Briebug } from './briebug.model';
1313

1414
@Injectable({
1515
providedIn: 'root'

schematic-src/src/app/state/state.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { StoreModule } from '@ngrx/store';
99
import { appMetaReducers, appReducer } from './app.reducer';
1010
import { CustomRouterStateSerializer } from './state-utils';
1111
import { environment } from '../../environments/environment';
12-
import { BriebugEffects } from '@state/briebug/briebug.effects';
12+
import { BriebugEffects } from './briebug/briebug.effects';
1313

1414
@NgModule({
1515
imports: [

schematic-src/tsconfig.json

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
"compileOnSave": false,
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"paths": {
6-
"@state/*": ["src/app/state/*"],
7-
"@core/*": ["src/app/core/*"]
8-
},
95
"outDir": "./dist/out-tsc",
106
"sourceMap": true,
117
"declaration": false,

src/ngrx-entity/__files__/__name@dasherize@if-flat__/__name@dasherize__.actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Action } from '@ngrx/store';
22
import { Update } from '@ngrx/entity';
33
import { <%= classify(name) %> } from './<%= name %>.model';
4-
import { <%= classify(name) %>SearchQuery } from '@state/<%= name %>/<%= name %>.reducer';
4+
import { <%= classify(name) %>SearchQuery } from './<%= name %>.reducer';
55

66
export enum <%= classify(name) %>ActionTypes {
77
Insert<%= classify(name) %> = '[<%= classify(name) %>] Insert',

src/ngrx-entity/__files__/__name@dasherize@if-flat__/__name@dasherize__.effects.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import { generate<%= classify(name) %>, generate<%= classify(name) %>Array } from './<%= name %>.model';
2424
// TODO: Change this path when you move your service file:
2525
import { <%= classify(name) %>Service } from './<%= name %>.service';
26-
import { <%= classify(name) %>Effects } from '@state/<%= name %>/<%= name %>.effects';
26+
import { <%= classify(name) %>Effects } from './<%= name %>.effects';
2727

2828
describe('<%= classify(name) %>Effects', () => {
2929
let actions: Observable<any>;

src/ngrx-entity/__files__/__name@dasherize@if-flat__/__name@dasherize__.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { HttpClient } from '@angular/common/http';
99

1010
import { Observable, of } from 'rxjs';
1111
import { switchMap } from 'rxjs/operators';
12-
import { <%= classify(name) %> } from '@state/<%= name %>/<%= name %>.model';
12+
import { <%= classify(name) %> } from './<%= name %>.model';
1313

1414
@Injectable({
1515
providedIn: 'root'

src/ngrx-entity/__files__/state.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { StoreModule } from '@ngrx/store';
99
import { appMetaReducers, appReducer } from './app.reducer';
1010
import { CustomRouterStateSerializer } from './state-utils';
1111
import { environment } from '../../environments/environment';
12-
import { <%= classify(name) %>Effects } from '@state/<%= name %>/<%= name %>.effects';
12+
import { <%= classify(name) %>Effects } from './<%= name %>/<%= name %>.effects';
1313

1414
@NgModule({
1515
imports: [

0 commit comments

Comments
 (0)