Skip to content

Commit fe2e657

Browse files
manekinekkoalexeagle
authored andcommitted
feat: improve the code generator process
1 parent 30bcbba commit fe2e657

281 files changed

Lines changed: 1496 additions & 4319 deletions

File tree

Some content is hidden

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

‎package.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"rxjs": "6.4.0",
2323
"systemjs": "0.21.6",
2424
"tslib": "1.9.3",
25+
"tslint": "^5.15.0",
2526
"zone.js": "0.9.0"
2627
},
2728
"devDependencies": {
@@ -43,6 +44,7 @@
4344
"husky": "0.14.3",
4445
"named-amd": "1.0.0",
4546
"protractor": "6.0.0",
47+
"ts-morph": "^1.3.3",
4648
"typescript": "3.3.3333"
4749
},
4850
"scripts": {
@@ -60,7 +62,7 @@
6062
"bazel:lint-fix": "yarn bazel:format --lint=fix",
6163
"format": "git-clang-format",
6264
"precommit": "check-clang-format \"yarn format\"",
63-
"generate:clean": "rimraf ./src/app/billing ./src/app/compute ./src/app/datastore ./src/app/functions ./src/app/logging ./src/app/monitoring ./src/app/networking ./src/app/registry ./src/app/storage ./src/app/support",
64-
"generate": "node tools/generate.js"
65+
"generate": "node tools/generator/index.js",
66+
"generate:clean": "node tools/generator/index.js --clean"
6567
}
6668
}

‎src/BUILD.bazel‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ ts_devserver(
115115
"@npm//node_modules/tslib:tslib.js",
116116
":rxjs_umd_modules",
117117
":require.config.js",
118-
119118
# We are manaully adding a browserify generated named UMD date-fns bundle here that
120119
# was generated in our package.json postinstall step. This is a temporary work-around
121120
# to get commonjs modules & npm packages working with ts_devserver. A more ergonomic
@@ -129,6 +128,12 @@ ts_devserver(
129128
deps = ["//src"],
130129
)
131130

131+
# This list is auto-updated by /tools/generator
132+
# Make sure not to rename this variable
133+
GENERATED_FEATURES = [
134+
135+
]
136+
132137
rollup_bundle(
133138
name = "bundle",
134139
# These Angular routes may be lazy-loaded at runtime.
@@ -140,17 +145,7 @@ rollup_bundle(
140145
"src/app/home/home.ngfactory",
141146
"src/app/hello-world/hello-world.module.ngfactory",
142147
"src/app/todos/todos.module.ngfactory",
143-
"src/app/billing/billing.module.ngfactory",
144-
"src/app/compute/compute.module.ngfactory",
145-
"src/app/datastore/datastore.module.ngfactory",
146-
"src/app/functions/functions.module.ngfactory",
147-
"src/app/logging/logging.module.ngfactory",
148-
"src/app/monitoring/monitoring.module.ngfactory",
149-
"src/app/networking/networking.module.ngfactory",
150-
"src/app/registry/registry.module.ngfactory",
151-
"src/app/storage/storage.module.ngfactory",
152-
"src/app/support/support.module.ngfactory",
153-
],
148+
] + GENERATED_FEATURES,
154149
entry_point = "src/main.prod",
155150
deps = [
156151
"//src",

‎src/app/BUILD.bazel‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,22 @@ NG_FACTORY_ADDED_IMPORTS = [
1010
"@npm//@angular/forms",
1111
]
1212

13+
# This list is auto-updated by /tools/generator
14+
# Make sure not to rename this variable
15+
GENERATED_FEATURES = [
16+
17+
]
18+
1319
ng_module(
1420
name = "app",
1521
srcs = glob(["*.ts"]),
1622
assets = ["app.component.html"],
1723
tsconfig = "//src:tsconfig.json",
18-
deps = NG_FACTORY_ADDED_IMPORTS + [
19-
"//src/app/billing",
20-
"//src/app/compute",
21-
"//src/app/datastore",
22-
"//src/app/support",
23-
"//src/app/logging",
24-
"//src/app/monitoring",
25-
"//src/app/networking",
26-
"//src/app/storage",
27-
"//src/app/registry",
28-
"//src/app/functions",
24+
deps = NG_FACTORY_ADDED_IMPORTS + GENERATED_FEATURES + [
2925
"//src/app/hello-world",
3026
"//src/app/home",
31-
"//src/shared/material",
3227
"//src/app/todos",
28+
"//src/shared/material",
3329
"@npm//@angular/core",
3430
"@npm//@angular/router",
3531
"@npm//@angular/platform-browser",

‎src/app/app-routing.module.ts‎

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
33

44
// These are lazy-loaded routes - note that we dynamic-import the modules here
55
// to avoid having an eager dependency on them.
6+
7+
// IMPORTANT: this array is auto-updated by script/generator
8+
// dont rename the 'routes' variable.
69
const routes: Routes = [
710
{
811
path: '',
@@ -19,67 +22,7 @@ const routes: Routes = [
1922
path: 'todos',
2023
pathMatch: 'full',
2124
loadChildren: () => import('./todos/todos.module.ngfactory').then(m => m.TodosModuleNgFactory)
22-
},
23-
{
24-
path: 'billing',
25-
pathMatch: 'full',
26-
loadChildren: () =>
27-
import('./billing/billing.module.ngfactory').then(m => m.BillingModuleNgFactory)
28-
},
29-
{
30-
path: 'compute',
31-
pathMatch: 'full',
32-
loadChildren: () =>
33-
import('./compute/compute.module.ngfactory').then(m => m.ComputeModuleNgFactory)
34-
},
35-
{
36-
path: 'datastore',
37-
pathMatch: 'full',
38-
loadChildren: () =>
39-
import('./datastore/datastore.module.ngfactory').then(m => m.DatastoreModuleNgFactory)
40-
},
41-
{
42-
path: 'functions',
43-
pathMatch: 'full',
44-
loadChildren: () =>
45-
import('./functions/functions.module.ngfactory').then(m => m.FunctionsModuleNgFactory)
46-
},
47-
{
48-
path: 'logging',
49-
pathMatch: 'full',
50-
loadChildren: () =>
51-
import('./logging/logging.module.ngfactory').then(m => m.LoggingModuleNgFactory)
52-
},
53-
{
54-
path: 'monitoring',
55-
pathMatch: 'full',
56-
loadChildren: () =>
57-
import('./monitoring/monitoring.module.ngfactory').then(m => m.MonitoringModuleNgFactory)
58-
},
59-
{
60-
path: 'networking',
61-
pathMatch: 'full',
62-
loadChildren: () =>
63-
import('./networking/networking.module.ngfactory').then(m => m.NetworkingModuleNgFactory)
64-
},
65-
{
66-
path: 'registry',
67-
pathMatch: 'full',
68-
loadChildren: () =>
69-
import('./registry/registry.module.ngfactory').then(m => m.RegistryModuleNgFactory)
70-
},
71-
{
72-
path: 'storage',
73-
pathMatch: 'full',
74-
loadChildren: () =>
75-
import('./storage/storage.module.ngfactory').then(m => m.StorageModuleNgFactory)
76-
},
77-
{
78-
path: 'support',
79-
pathMatch: 'full',
80-
loadChildren: () =>
81-
import('./support/support.module.ngfactory').then(m => m.SupportModuleNgFactory)
82-
},
25+
}
8326
];
8427

8528
@NgModule({

‎src/app/app.component.html‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<nav>
22
<mat-toolbar class="mat-secondary">
3-
<p class="show-small"><button mat-button (click)="drawer.toggle()"><mat-icon>menu</mat-icon></button></p>
3+
<p class="show-small"><button mat-button (click)="drawer.toggle()">
4+
<mat-icon>menu</mat-icon>
5+
</button></p>
46
<a mat-button href="http://angular.io" class="hide-small">
57
<img class="nav-logo" src="/assets/angular-logo-with-text.svg">
68
</a>
@@ -22,18 +24,18 @@
2224
<mat-drawer #drawer opened mode="side">
2325
<mat-nav-list>
2426
<a mat-list-item routerLink="/"> Home </a>
25-
<a mat-list-item routerLink="/billing"><mat-icon>credit_card</mat-icon> Billing </a>
26-
<a mat-list-item routerLink="/compute"><mat-icon>memory</mat-icon> Compute </a>
27-
<a mat-list-item routerLink="/datastore"><mat-icon>view_agenda</mat-icon> Datastore </a>
28-
<a mat-list-item routerLink="/functions"><mat-icon>functions</mat-icon> Functions </a>
29-
<a mat-list-item routerLink="/logging"><mat-icon>format_align_left</mat-icon> Logging </a>
30-
<a mat-list-item routerLink="/monitoring"><mat-icon>device_unknown</mat-icon> Monitoring </a>
31-
<a mat-list-item routerLink="/networking"><mat-icon>settings_ethernet</mat-icon> Networking </a>
32-
<a mat-list-item routerLink="/registry"><mat-icon>ballot</mat-icon> Registry </a>
33-
<a mat-list-item routerLink="/storage"><mat-icon>folder</mat-icon> Storage </a>
34-
<a mat-list-item routerLink="/support"><mat-icon>headset_mic</mat-icon> Support </a>
3527
<a mat-list-item routerLink="/hello"> Hello World </a>
36-
<a mat-list-item routerLink="/todos"> Todos </a>
28+
<a mat-list-item routerLink="/todos"> Todos </a
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
3739
</mat-nav-list>
3840
</mat-drawer>
3941

@@ -42,4 +44,4 @@
4244
<router-outlet></router-outlet>
4345
</div>
4446
</mat-drawer-content>
45-
</mat-drawer-container>
47+
</mat-drawer-container>

‎src/app/app.module.ts‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,14 @@ import {MaterialModule} from '../shared/material/material.module';
88

99
import {AppRoutingModule} from './app-routing.module';
1010
import {AppComponent} from './app.component';
11-
import {BillingModule} from './billing/billing.module';
12-
import {ComputeModule} from './compute/compute.module';
13-
import {DatastoreModule} from './datastore/datastore.module';
14-
import {FunctionsModule} from './functions/functions.module';
1511
import {HomeModule} from './home/home';
16-
import {LoggingModule} from './logging/logging.module';
17-
import {MonitoringModule} from './monitoring/monitoring.module';
18-
import {NetworkingModule} from './networking/networking.module';
19-
import {RegistryModule} from './registry/registry.module';
20-
import {StorageModule} from './storage/storage.module';
21-
import {SupportModule} from './support/support.module';
2212
import {todoReducer} from './todos/reducers/reducers';
2313

2414
@NgModule({
2515
declarations: [AppComponent],
2616
imports: [
2717
AppRoutingModule, BrowserModule, BrowserAnimationsModule, MaterialModule, HomeModule,
28-
StoreModule.forRoot({todoReducer}), BillingModule, ComputeModule, DatastoreModule,
29-
FunctionsModule, LoggingModule, MonitoringModule, NetworkingModule, RegistryModule,
30-
StorageModule, SupportModule
18+
StoreModule.forRoot({todoReducer})
3119
],
3220
exports: [AppComponent],
3321
bootstrap: [AppComponent],

‎src/app/billing/BUILD.bazel‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎src/app/billing/billing.module.ts‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎src/app/billing/index/index.component.html‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎src/app/billing/index/index.component.spec.ts‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)