@tech4good/angular-schematics 17.0.3 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/package.json +4 -4
- package/src/collection.json +0 -16
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +22 -8
- package/src/component/index.js +2 -45
- package/src/component/index.js.map +1 -1
- package/src/component/schema.json +0 -5
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +12 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +1 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +41 -0
- package/src/entity/index.js +29 -50
- package/src/entity/index.js.map +1 -1
- package/src/init/files/.firebaserc.template +8 -0
- package/src/init/files/README.md.template +6 -6
- package/src/init/files/angular.json.template +18 -11
- package/src/init/files/package.json.template +28 -29
- package/src/init/files/src/app/admin/{waitlist/waitlist.animations.ts.template → admin-panel/admin-panel.animations.ts.template} +1 -1
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.html.template → admin-panel/admin-panel.component.html.template} +3 -3
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.scss.template → admin-panel/admin-panel.component.scss.template} +1 -1
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +25 -0
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.ts.template +99 -0
- package/src/init/files/src/app/app.component.html.template +1 -0
- package/src/init/files/src/app/app.component.ts.template +14 -8
- package/src/init/files/src/app/app.config.ts.template +63 -0
- package/src/init/files/src/app/app.routes.ts.template +32 -0
- package/src/init/files/src/app/core/analytics/log.service.ts.template +122 -89
- package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +9 -17
- package/src/init/files/src/app/core/auth/auth.guard.ts.template +25 -22
- package/src/init/files/src/app/core/firebase/cached-listeners.service.ts.template +291 -0
- package/src/init/files/src/app/core/firebase/database.service.ts.template +56 -0
- package/src/init/files/src/app/core/firebase/firebase.mock.service.ts.template +276 -0
- package/src/init/files/src/app/core/firebase/firebase.service.ts.template +265 -215
- package/src/init/files/src/app/core/local-storage/session.service.ts.template +3 -4
- package/src/init/files/src/app/core/store/app.model.ts.template +19 -0
- package/src/init/files/src/app/core/store/app.store.ts.template +1074 -0
- package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +20 -0
- package/src/init/files/src/app/core/store/auth/auth.store.ts.template +136 -0
- package/src/init/files/src/app/core/store/batch-write.firebase.service.ts.template +58 -0
- package/src/init/files/src/app/core/store/batch-write.mock.service.ts.template +105 -0
- package/src/init/files/src/app/core/store/batch-write.service.ts.template +126 -0
- package/src/init/files/src/app/core/store/user/user.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user/user.model.ts.template +1 -1
- package/src/init/files/src/app/core/store/user/user.store.ts.template +41 -0
- package/src/init/files/src/app/core/store/user-context/user-context.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +1 -0
- package/src/init/files/src/app/core/store/user-context/user-context.store.ts.template +41 -0
- package/src/init/files/src/app/core/utils/rand.utils.ts.template +13 -0
- package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.html.template +8 -13
- package/src/init/files/src/app/first-time/consent/consent.component.ts.template +90 -0
- package/src/init/files/src/app/first-time/early-access/early-access.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.html.template +69 -0
- package/src/init/files/src/app/{onboarding/waiting/waiting.component.scss.template → first-time/early-access/early-access.component.scss.template} +1 -1
- package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +25 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.ts.template +194 -0
- package/src/init/files/src/app/first-time/early-access/early-access.model.ts.template +7 -0
- package/src/init/files/src/app/{general → first-time}/landing/landing.component.html.template +1 -1
- package/src/init/files/src/app/first-time/landing/landing.component.ts.template +44 -0
- package/src/init/files/src/app/first-time/login/login.component.html.template +10 -0
- package/src/init/files/src/app/first-time/login/login.component.ts.template +45 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.html.template +2 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.scss.template +5 -0
- package/src/init/files/src/app/{admin/waitlist/waitlist.component.spec.ts.template → first-time/onboarding/onboarding.component.spec.ts.template} +6 -6
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.ts.template +41 -0
- package/src/init/files/src/app/main/home/home.component.html.template +5 -0
- package/src/init/files/src/app/main/home/home.component.ts.template +51 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.html.template +15 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.scss.template +43 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +25 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.ts.template +40 -0
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +9 -0
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.ts.template +17 -6
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.service.ts.template +2 -2
- package/src/init/files/src/assets/images/close-x.svg +3 -0
- package/src/init/files/src/environments/environment.ts.template +1 -0
- package/src/init/files/src/index.html.template +1 -1
- package/src/init/files/tsconfig.json.template +0 -1
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +0 -26
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +0 -48
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +0 -20
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +0 -13
- package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +0 -3
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +0 -5
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +0 -25
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -90
- package/src/container/index.d.ts +0 -2
- package/src/container/index.js +0 -127
- package/src/container/index.js.map +0 -1
- package/src/container/index_spec.d.ts +0 -1
- package/src/container/index_spec.js +0 -23
- package/src/container/index_spec.js.map +0 -1
- package/src/container/schema.json +0 -50
- package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -249
- package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -270
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.model.ts.template +0 -3
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/index.d.ts +0 -2
- package/src/entity-in-example/index.js +0 -141
- package/src/entity-in-example/index.js.map +0 -1
- package/src/entity-in-example/index_spec.d.ts +0 -1
- package/src/entity-in-example/index_spec.js +0 -23
- package/src/entity-in-example/index_spec.js.map +0 -1
- package/src/entity-in-example/schema.json +0 -45
- package/src/init/files/CHANGELOG.md.template +0 -10
- package/src/init/files/src/app/admin/admin-routing.module.ts.template +0 -17
- package/src/init/files/src/app/admin/admin.module.spec.ts.template +0 -13
- package/src/init/files/src/app/admin/admin.module.ts.template +0 -28
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +0 -23
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +0 -50
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.model.ts.template +0 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +0 -39
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +0 -13
- package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +0 -141
- package/src/init/files/src/app/app-routing.module.ts.template +0 -26
- package/src/init/files/src/app/app.module.ts.template +0 -34
- package/src/init/files/src/app/core/core.module.ts.template +0 -75
- package/src/init/files/src/app/core/setup/firebase-setup.ts.template +0 -25
- package/src/init/files/src/app/core/setup/module-import-guard.ts.template +0 -5
- package/src/init/files/src/app/core/snackbar/snackbar.actions.ts.template +0 -24
- package/src/init/files/src/app/core/snackbar/snackbar.effects.ts.template +0 -41
- package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +0 -249
- package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +0 -8
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/app.actions.ts.template +0 -92
- package/src/init/files/src/app/core/store/app.effects.ts.template +0 -175
- package/src/init/files/src/app/core/store/app.reducer.ts.template +0 -36
- package/src/init/files/src/app/core/store/app.selectors.ts.template +0 -42
- package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +0 -77
- package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +0 -163
- package/src/init/files/src/app/core/store/auth/auth.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +0 -26
- package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +0 -25
- package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +0 -405
- package/src/init/files/src/app/core/store/cached-selectors.service.ts.template +0 -376
- package/src/init/files/src/app/core/store/effects.helpers.ts.template +0 -66
- package/src/init/files/src/app/core/store/user/user.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user/user.effects.ts.template +0 -149
- package/src/init/files/src/app/core/store/user/user.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user/user.reducer.ts.template +0 -50
- package/src/init/files/src/app/core/store/user/user.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +0 -50
- package/src/init/files/src/app/core/utils/string-case.utils.ts.template +0 -96
- package/src/init/files/src/app/general/general-routing.module.ts.template +0 -25
- package/src/init/files/src/app/general/general.module.spec.ts.template +0 -13
- package/src/init/files/src/app/general/general.module.ts.template +0 -36
- package/src/init/files/src/app/general/home/+state/home.actions.ts.template +0 -26
- package/src/init/files/src/app/general/home/+state/home.effects.ts.template +0 -48
- package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
- package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/home/+state/home.state.ts.template +0 -13
- package/src/init/files/src/app/general/home/home.component.html.template +0 -5
- package/src/init/files/src/app/general/home/home.component.ts.template +0 -88
- package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +0 -26
- package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +0 -48
- package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
- package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +0 -13
- package/src/init/files/src/app/general/landing/landing.component.ts.template +0 -98
- package/src/init/files/src/app/general/login/login.component.html.template +0 -11
- package/src/init/files/src/app/general/login/login.component.ts.template +0 -80
- package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +0 -23
- package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +0 -47
- package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +0 -20
- package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +0 -151
- package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +0 -19
- package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +0 -13
- package/src/init/files/src/app/onboarding/onboarding.module.ts.template +0 -32
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +0 -26
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +0 -52
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +0 -9
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +0 -42
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +0 -4
- package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +0 -57
- package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +0 -25
- package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +0 -281
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.html.template +0 -10
- package/src/init/files/src/app/shared/shared.module.ts.template +0 -87
- package/src/init/files/src/main.ts.template +0 -12
- package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +0 -15
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +0 -13
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +0 -24
- package/src/module/index.d.ts +0 -2
- package/src/module/index.js +0 -97
- package/src/module/index.js.map +0 -1
- package/src/module/index_spec.d.ts +0 -1
- package/src/module/index_spec.js +0 -23
- package/src/module/index_spec.js.map +0 -1
- package/src/module/schema.json +0 -38
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.animations.ts.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.scss.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.scss.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.spec.ts.template +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="navbar-container">
|
|
2
|
+
<!--<img class="logo" src="assets/images/logo.svg">-->
|
|
3
|
+
@if (currentUser()) {
|
|
4
|
+
<div class="user-setting-section">
|
|
5
|
+
<img class="profile-pic" [src]= 'currentUser().photoURL' [matMenuTriggerFor]="menu" #menuTrigger/>
|
|
6
|
+
<mat-menu #menu="matMenu">
|
|
7
|
+
<div class="logout" (click)="logout()">
|
|
8
|
+
<span>
|
|
9
|
+
Logout
|
|
10
|
+
</span>
|
|
11
|
+
</div>
|
|
12
|
+
</mat-menu>
|
|
13
|
+
</div>
|
|
14
|
+
}
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.navbar-container {
|
|
2
|
+
height: 70px;
|
|
3
|
+
width: 100%;
|
|
4
|
+
background: #FFFFFF;
|
|
5
|
+
box-shadow: -4px 0px 4px rgba(200, 224, 212, 0.25);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
align-items: center; // Center items vertically
|
|
9
|
+
padding: 8px 16px; // Add padding to the container
|
|
10
|
+
|
|
11
|
+
.logo {
|
|
12
|
+
width: 46px;
|
|
13
|
+
height: 46px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
margin-right: 16px; // Add margin between logo and user section
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.user-setting-section {
|
|
19
|
+
margin-left: auto; // Push to the right
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center; // Center items vertically
|
|
22
|
+
color: #2DBDB1;
|
|
23
|
+
.profile-pic{
|
|
24
|
+
height: 46px;
|
|
25
|
+
width: 46px;
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// material target, can't be nested
|
|
33
|
+
.logout {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
gap: 20px;
|
|
38
|
+
font-size: 20px;
|
|
39
|
+
font-weight: 300;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
padding: 10px;
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NavbarComponent } from './navbar.component';
|
|
4
|
+
|
|
5
|
+
describe('NavbarComponent', () => {
|
|
6
|
+
let component: NavbarComponent;
|
|
7
|
+
let fixture: ComponentFixture<NavbarComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(waitForAsync(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
imports: [NavbarComponent],
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(NavbarComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { inject, Component, OnInit, ChangeDetectionStrategy, Input, Output, EventEmitter, Signal } from '@angular/core';
|
|
2
|
+
import { User } from 'src/app/core/store/user/user.model';
|
|
3
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
4
|
+
import { MatMenuTrigger, MatMenu } from '@angular/material/menu';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-navbar',
|
|
8
|
+
templateUrl: './navbar.component.html',
|
|
9
|
+
styleUrls: ['./navbar.component.scss'],
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [MatMenuTrigger, MatMenu],
|
|
13
|
+
})
|
|
14
|
+
export class NavbarComponent implements OnInit {
|
|
15
|
+
readonly authStore = inject(AuthStore);
|
|
16
|
+
|
|
17
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
18
|
+
|
|
19
|
+
/** The current signed in user. */
|
|
20
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
21
|
+
|
|
22
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
23
|
+
|
|
24
|
+
// --------------- COMPUTED DATA -----------------------
|
|
25
|
+
|
|
26
|
+
// --------------- EVENT HANDLING ----------------------
|
|
27
|
+
|
|
28
|
+
/** Logout. */
|
|
29
|
+
logout() {
|
|
30
|
+
this.authStore.logout();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// --------------- OTHER -------------------------------
|
|
34
|
+
|
|
35
|
+
constructor() {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ngOnInit(): void {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@if (showRedeploymentWarning) {
|
|
2
|
+
<div class="warning-container">
|
|
3
|
+
<div class="header">
|
|
4
|
+
<div class="title">This version is out of date!</div>
|
|
5
|
+
<img (click)="close()" src="/assets/img/close-x.svg" />
|
|
6
|
+
</div>
|
|
7
|
+
<button (click)="update()" class="update">Update Now</button>
|
|
8
|
+
</div>
|
|
9
|
+
}
|
|
@@ -5,17 +5,18 @@ import { DetectRedeploymentService } from './redeployment-warning.service';
|
|
|
5
5
|
selector: 'app-redeployment-warning',
|
|
6
6
|
templateUrl: './redeployment-warning.component.html',
|
|
7
7
|
styleUrls: ['./redeployment-warning.component.scss'],
|
|
8
|
+
standalone: true,
|
|
8
9
|
})
|
|
9
10
|
export class RedeploymentWarningComponent implements OnInit {
|
|
11
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
12
|
+
|
|
13
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
14
|
+
|
|
10
15
|
showRedeploymentWarning: boolean = false;
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
// --------------- COMPUTED DATA -----------------------
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
this.detectRedeployment.redeployed().subscribe(() => {
|
|
16
|
-
this.showRedeploymentWarning = true;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
+
// --------------- EVENT HANDLING ----------------------
|
|
19
20
|
|
|
20
21
|
/** Triggers a refresh. */
|
|
21
22
|
update() {
|
|
@@ -26,4 +27,14 @@ export class RedeploymentWarningComponent implements OnInit {
|
|
|
26
27
|
close() {
|
|
27
28
|
this.showRedeploymentWarning = false;
|
|
28
29
|
}
|
|
30
|
+
|
|
31
|
+
// --------------- OTHER -------------------------------
|
|
32
|
+
|
|
33
|
+
constructor(public detectRedeployment: DetectRedeploymentService) {}
|
|
34
|
+
|
|
35
|
+
ngOnInit() {
|
|
36
|
+
this.detectRedeployment.redeployed().subscribe(() => {
|
|
37
|
+
this.showRedeploymentWarning = true;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
29
40
|
}
|
|
@@ -15,7 +15,7 @@ export class DetectRedeploymentService {
|
|
|
15
15
|
/** Sets redeployed$ and returns it. */
|
|
16
16
|
public init() {
|
|
17
17
|
// Matches the filename of the main javascript file, which contains the hash in the name
|
|
18
|
-
const regexp = /main[-a-
|
|
18
|
+
const regexp = /main[-a-zA-Z0-9]*\.js/;
|
|
19
19
|
|
|
20
20
|
const observable: ConnectableObservable<void> = interval(2 * 60 * 1000) // every 2 minutes
|
|
21
21
|
.pipe(
|
|
@@ -30,7 +30,7 @@ export class DetectRedeploymentService {
|
|
|
30
30
|
// No biggie, we'll just do nothing.
|
|
31
31
|
return null;
|
|
32
32
|
} else {
|
|
33
|
-
return m[
|
|
33
|
+
return m[0];
|
|
34
34
|
}
|
|
35
35
|
}),
|
|
36
36
|
filter((val) => !!val),
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="11" viewBox="0 0 8 7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.29816 3.11482L3.89258 3.48439L4.29816 3.85397L6.98425 6.30163L6.91547 6.3643L6.61163 6.08744L4.16057 3.85394L3.82382 3.54708L3.48705 3.85393L0.731908 6.36431L0.663132 6.30164L3.34943 3.85398L3.75504 3.48441L3.34945 3.11482L0.663181 0.666989L0.732086 0.604227L3.48702 3.11483L3.82379 3.42173L4.16057 3.11484L6.91547 0.604478L6.98425 0.667152L6.74922 0.881321L4.29816 3.11482ZM0.530277 6.54803C0.530385 6.54793 0.530492 6.54783 0.530599 6.54774L0.530292 6.54802L0.530277 6.54803Z" fill="#6D6D6D" stroke="#6D6D6D" />
|
|
3
|
+
</svg>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
|
11
11
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
12
12
|
</head>
|
|
13
|
-
<body
|
|
13
|
+
<body>
|
|
14
14
|
<app-root></app-root>
|
|
15
15
|
</body>
|
|
16
16
|
</html>
|
package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Action } from '@ngrx/store';
|
|
2
|
-
import { User } from '../<%= containerToCorePath %>/store/user/user.model';
|
|
3
|
-
|
|
4
|
-
export enum <%= classify(name) %>ActionTypes {
|
|
5
|
-
LOAD_DATA = '[<%= classify(name) %>] load data',
|
|
6
|
-
CLEANUP = '[<%= classify(name) %>] cleanup',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** Action for loading required DB data. */
|
|
10
|
-
export class LoadData implements Action {
|
|
11
|
-
readonly type = <%= classify(name) %>ActionTypes.LOAD_DATA;
|
|
12
|
-
|
|
13
|
-
constructor(public payload: {
|
|
14
|
-
currentUser: User,
|
|
15
|
-
}, public correlationId: string) { }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Action for cleaning up loading subscriptions. */
|
|
19
|
-
export class Cleanup implements Action {
|
|
20
|
-
readonly type = <%= classify(name) %>ActionTypes.CLEANUP;
|
|
21
|
-
constructor(public correlationId: string) { }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type <%= classify(name) %>Actions =
|
|
25
|
-
LoadData |
|
|
26
|
-
Cleanup;
|
package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Action } from '@ngrx/store';
|
|
3
|
-
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
4
|
-
|
|
5
|
-
import { of, Observable } from 'rxjs';
|
|
6
|
-
import { mergeMap, tap, map } from 'rxjs/operators';
|
|
7
|
-
|
|
8
|
-
import { select, Store } from '@ngrx/store';
|
|
9
|
-
import * as fromStore from '../<%= containerToCorePath %>/store/app.reducer';
|
|
10
|
-
import { FirebaseService } from '../<%= containerToCorePath %>/firebase/firebase.service';
|
|
11
|
-
import { EffectsHelpers } from '../<%= containerToCorePath %>/store/effects.helpers';
|
|
12
|
-
import { <%= classify(name) %>State } from './<%= dasherize(name) %>.state';
|
|
13
|
-
|
|
14
|
-
import { ActionFlow, RouterNavigate, LoadAction, Unsubscribe } from '../<%= containerToCorePath %>/store/app.actions';
|
|
15
|
-
import { <%= classify(name) %>ActionTypes, Cleanup, LoadData } from './<%= dasherize(name) %>.actions';
|
|
16
|
-
|
|
17
|
-
@Injectable()
|
|
18
|
-
export class <%= classify(name) %>Effects {
|
|
19
|
-
/** Load data from Firebase. */
|
|
20
|
-
loadData$: Observable<Action> = createEffect(
|
|
21
|
-
() => this.actions$.pipe(
|
|
22
|
-
ofType<LoadData>(<%= classify(name) %>ActionTypes.LOAD_DATA),
|
|
23
|
-
mergeMap((action: LoadData) => {
|
|
24
|
-
const loadId = action.correlationId;
|
|
25
|
-
const currentUser = action.payload.currentUser;
|
|
26
|
-
|
|
27
|
-
return [
|
|
28
|
-
];
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
/** Unsubscribe connections from Firebase. */
|
|
34
|
-
cleanup$: Observable<Action> = createEffect(
|
|
35
|
-
() => this.actions$.pipe(
|
|
36
|
-
ofType<Cleanup>(<%= classify(name) %>ActionTypes.CLEANUP),
|
|
37
|
-
map((action: Cleanup) => new Unsubscribe(action.correlationId)),
|
|
38
|
-
),
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
private actions$: Actions,
|
|
43
|
-
private store: Store<fromStore.State>,
|
|
44
|
-
private state: <%= classify(name) %>State,
|
|
45
|
-
private db: FirebaseService,
|
|
46
|
-
private eh: EffectsHelpers,
|
|
47
|
-
) {}
|
|
48
|
-
}
|
|
File without changes
|
package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Store, select } from '@ngrx/store';
|
|
3
|
-
import * as fromStore from '../<%= containerToCorePath %>/store/app.reducer';
|
|
4
|
-
import { EntitySelectorService } from '../<%= containerToCorePath %>/store/app.selectors';
|
|
5
|
-
|
|
6
|
-
import { Observable, of, combineLatest } from 'rxjs';
|
|
7
|
-
import { bufferTime, distinctUntilChanged, shareReplay, mergeMap, filter, switchMap, map } from 'rxjs/operators';
|
|
8
|
-
|
|
9
|
-
@Injectable({
|
|
10
|
-
providedIn: 'root',
|
|
11
|
-
})
|
|
12
|
-
export class <%= classify(name) %>Selectors {
|
|
13
|
-
constructor(
|
|
14
|
-
private slRx: EntitySelectorService,
|
|
15
|
-
) { }
|
|
16
|
-
|
|
17
|
-
cleanup(cId: string) {
|
|
18
|
-
this.slRx.release(cId);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
|
|
5
|
-
@Injectable({
|
|
6
|
-
providedIn: 'root',
|
|
7
|
-
})
|
|
8
|
-
export class <%= classify(name) %>State {
|
|
9
|
-
// --------------- LOCAL UI STATE ----------------------
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
) { }
|
|
13
|
-
}
|
package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
|
|
4
|
-
|
|
5
|
-
describe('<%= classify(name) %>Component', () => {
|
|
6
|
-
let component: <%= classify(name) %>Component;
|
|
7
|
-
let fixture: ComponentFixture<<%= classify(name) %>Component>;
|
|
8
|
-
|
|
9
|
-
beforeEach(waitForAsync(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [<%= classify(name) %>Component],
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(<%= classify(name) %>Component);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { <%= classify(name) %>Animations } from './<%= dasherize(name) %>.animations';
|
|
3
|
-
import { ParamMap, ActivatedRoute } from '@angular/router';
|
|
4
|
-
import { Store, select } from '@ngrx/store';
|
|
5
|
-
import * as fromStore from '<%= containerToCorePath %>/store/app.reducer';
|
|
6
|
-
import * as fromAuth from '<%= containerToCorePath %>/store/auth/auth.reducer';
|
|
7
|
-
import { FirebaseService } from '<%= containerToCorePath %>/firebase/firebase.service';
|
|
8
|
-
import { Observable, Subject, BehaviorSubject, combineLatest } from 'rxjs';
|
|
9
|
-
import { withLatestFrom, filter, take, takeUntil } from 'rxjs/operators';
|
|
10
|
-
|
|
11
|
-
import { <%= classify(name) %>State } from './+state/<%= dasherize(name) %>.state';
|
|
12
|
-
import { <%= classify(name) %>Selectors } from './+state/<%= dasherize(name) %>.selectors';
|
|
13
|
-
|
|
14
|
-
import { LoadData, Cleanup } from './+state/<%= dasherize(name) %>.actions';
|
|
15
|
-
import { RouterNavigate } from '<%= containerToCorePath %>/store/app.actions';
|
|
16
|
-
|
|
17
|
-
import { User } from '<%= containerToCorePath %>/store/user/user.model';
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'app-<%= dasherize(name) %>',
|
|
21
|
-
templateUrl: './<%= dasherize(name) %>.component.html',
|
|
22
|
-
styleUrls: ['./<%= dasherize(name) %>.component.scss'],
|
|
23
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
-
animations: <%= classify(name) %>Animations,
|
|
25
|
-
})
|
|
26
|
-
export class <%= classify(name) %>Component implements OnInit, OnDestroy {
|
|
27
|
-
// --------------- ROUTE PARAMS & CURRENT USER ---------
|
|
28
|
-
|
|
29
|
-
// TODO: Delete this block of code if you don't need the currentUser (and make sure
|
|
30
|
-
// to remove it from LoadData too
|
|
31
|
-
/** The currently signed in user. */
|
|
32
|
-
currentUser$: Observable<User> = this.store.pipe(
|
|
33
|
-
select(fromAuth.selectUser),
|
|
34
|
-
filter((user) => user !== null), // null indicates LoadAuth hasn't been processed
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
// --------------- LOCAL AND GLOBAL STATE --------------
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// --------------- DB ENTITY DATA ----------------------
|
|
41
|
-
|
|
42
|
-
/** Container id for selectors and loading. */
|
|
43
|
-
containerId: string = this.db.createId();
|
|
44
|
-
|
|
45
|
-
// --------------- DATA BINDING ------------------------
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// --------------- EVENT BINDING -----------------------
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// --------------- HELPER FUNCTIONS AND OTHER ----------
|
|
52
|
-
|
|
53
|
-
/** Unsubscribe observable for subscriptions. */
|
|
54
|
-
unsubscribe$: Subject<void> = new Subject();
|
|
55
|
-
|
|
56
|
-
constructor(
|
|
57
|
-
private state: <%= classify(name) %>State,
|
|
58
|
-
private route: ActivatedRoute,
|
|
59
|
-
private selectors: <%= classify(name) %>Selectors,
|
|
60
|
-
private store: Store<fromStore.State>,
|
|
61
|
-
private db: FirebaseService,
|
|
62
|
-
) {
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
ngOnInit() {
|
|
66
|
-
// --------------- EVENT HANDLING ----------------------
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// --------------- LOAD DATA ---------------------------
|
|
70
|
-
|
|
71
|
-
// Once everything is set up, load the data for the role.
|
|
72
|
-
this.currentUser$.pipe(
|
|
73
|
-
takeUntil(this.unsubscribe$),
|
|
74
|
-
).subscribe((currentUser) => {
|
|
75
|
-
this.store.dispatch( new LoadData({
|
|
76
|
-
currentUser,
|
|
77
|
-
}, this.containerId) );
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
ngOnDestroy() {
|
|
82
|
-
// Unsubscribe subscriptions.
|
|
83
|
-
this.unsubscribe$.next();
|
|
84
|
-
this.unsubscribe$.complete();
|
|
85
|
-
|
|
86
|
-
// Unsubscribe from firebase connection from load and free up memoized selector values.
|
|
87
|
-
this.store.dispatch( new Cleanup(this.containerId) );
|
|
88
|
-
this.selectors.cleanup(this.containerId);
|
|
89
|
-
}
|
|
90
|
-
}
|
package/src/container/index.d.ts
DELETED
package/src/container/index.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.container = void 0;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const change_1 = require("@schematics/angular/utility/change");
|
|
15
|
-
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
16
|
-
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
17
|
-
const validation_1 = require("@schematics/angular/utility/validation");
|
|
18
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
19
|
-
const core_1 = require("@angular-devkit/core");
|
|
20
|
-
const statements_adder_1 = require("../shared/statements-adder");
|
|
21
|
-
function addInserts(options) {
|
|
22
|
-
return (host, context) => {
|
|
23
|
-
if (!options.module) {
|
|
24
|
-
return host;
|
|
25
|
-
}
|
|
26
|
-
const classifiedName = core_1.strings.classify(options.name);
|
|
27
|
-
const dasherizedName = core_1.strings.dasherize(options.name);
|
|
28
|
-
const containerPath = `/${options.path}/` +
|
|
29
|
-
core_1.strings.dasherize(options.name) + '/' +
|
|
30
|
-
core_1.strings.dasherize(options.name) + '.component';
|
|
31
|
-
// Add to module
|
|
32
|
-
const modulePath = options.module;
|
|
33
|
-
const moduleText = (0, statements_adder_1.getSourceText)(host, modulePath);
|
|
34
|
-
const moduleToContainerPath = (0, find_module_1.buildRelativePath)(modulePath, containerPath);
|
|
35
|
-
const effectsPath = `/${options.path}/` +
|
|
36
|
-
core_1.strings.dasherize(options.name) + '/+state/' +
|
|
37
|
-
core_1.strings.dasherize(options.name) + '.effects';
|
|
38
|
-
const moduleToEffectsPath = (0, find_module_1.buildRelativePath)(modulePath, effectsPath);
|
|
39
|
-
let insertChangesInModule = (0, statements_adder_1.simpleInsert)(moduleText, modulePath, [
|
|
40
|
-
'// Containers',
|
|
41
|
-
'EffectsModule.forFeature([',
|
|
42
|
-
'// Containers'
|
|
43
|
-
], [
|
|
44
|
-
`import { ${classifiedName}Component } from '${moduleToContainerPath}';\nimport { ${classifiedName}Effects } from '${moduleToEffectsPath}';`,
|
|
45
|
-
` ${classifiedName}Effects,`,
|
|
46
|
-
` ${classifiedName}Component,`
|
|
47
|
-
]);
|
|
48
|
-
// Add routing module changes
|
|
49
|
-
context.logger.info(modulePath);
|
|
50
|
-
const moduleDir = (0, core_1.normalize)(modulePath).split('/').slice(0, -1).join('/');
|
|
51
|
-
const moduleFileName = (0, core_1.normalize)(modulePath).split('/').pop() || '';
|
|
52
|
-
const moduleName = moduleFileName.split('.')[0];
|
|
53
|
-
const moduleRoutingPath = `${moduleDir}/${moduleName}-routing.module.ts`;
|
|
54
|
-
context.logger.info(moduleRoutingPath);
|
|
55
|
-
const moduleRoutingText = (0, statements_adder_1.getSourceText)(host, moduleRoutingPath);
|
|
56
|
-
const moduleRoutingToContainerPath = (0, find_module_1.buildRelativePath)(moduleRoutingPath, containerPath);
|
|
57
|
-
context.logger.info("moduleRoutingPath: " + moduleRoutingPath);
|
|
58
|
-
let insertChangesInRoutingModule = (0, statements_adder_1.simpleInsert)(moduleRoutingText, moduleRoutingPath, [
|
|
59
|
-
'// Containers',
|
|
60
|
-
'const routes: Routes = ['
|
|
61
|
-
], [
|
|
62
|
-
`import { ${classifiedName}Component } from '${moduleRoutingToContainerPath}';`,
|
|
63
|
-
` { path: '${dasherizedName}', component: ${classifiedName}Component, canActivate: [AuthGuard] },`
|
|
64
|
-
]);
|
|
65
|
-
context.logger.info(`about to start committing`);
|
|
66
|
-
// For each of the files and corresponding set of changes, commit to the tree
|
|
67
|
-
[
|
|
68
|
-
[modulePath, insertChangesInModule],
|
|
69
|
-
[moduleRoutingPath, insertChangesInRoutingModule],
|
|
70
|
-
].map(([filePath, insertChanges]) => {
|
|
71
|
-
const declarationRecorder = host.beginUpdate(filePath);
|
|
72
|
-
for (const change of insertChanges) {
|
|
73
|
-
if (change instanceof change_1.InsertChange) {
|
|
74
|
-
declarationRecorder.insertLeft(change.pos, change.toAdd);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
host.commitUpdate(declarationRecorder);
|
|
78
|
-
});
|
|
79
|
-
return host;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function container(options) {
|
|
83
|
-
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
// Make sure the command is executed in the directory where the container should be generated
|
|
85
|
-
if (!options.inDirectory) {
|
|
86
|
-
context.logger.info("Please navigate to the directory where you want to generate the container.");
|
|
87
|
-
return (0, schematics_1.noop)();
|
|
88
|
-
}
|
|
89
|
-
const workspace = yield (0, workspace_1.getWorkspace)(tree);
|
|
90
|
-
const project = workspace.projects.get(options.project);
|
|
91
|
-
if (!project) {
|
|
92
|
-
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
93
|
-
}
|
|
94
|
-
context.logger.info(`options.path: ${options.path}`);
|
|
95
|
-
if (options.path === undefined) {
|
|
96
|
-
options.path = (0, workspace_1.buildDefaultPath)(project);
|
|
97
|
-
}
|
|
98
|
-
context.logger.info(`options.path: ${options.path}`);
|
|
99
|
-
options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
|
|
100
|
-
context.logger.info(`options.module: ${options.module}`);
|
|
101
|
-
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
102
|
-
options.name = parsedPath.name;
|
|
103
|
-
options.path = parsedPath.path;
|
|
104
|
-
(0, validation_1.validateHtmlSelector)(options.selector);
|
|
105
|
-
// Define relative path parameters
|
|
106
|
-
const containerPath = `/${options.path}/` +
|
|
107
|
-
core_1.strings.dasherize(options.name) + '/' +
|
|
108
|
-
core_1.strings.dasherize(options.name) + '.component';
|
|
109
|
-
const moduleDir = (0, core_1.normalize)(options.module).split('/').slice(0, -1).join('/');
|
|
110
|
-
context.logger.info(`moduleDir: ${moduleDir}`);
|
|
111
|
-
const moduleToContainerPath = (0, find_module_1.buildRelativePath)(options.module, containerPath);
|
|
112
|
-
context.logger.info(`moduleToContainer: ${moduleToContainerPath}`);
|
|
113
|
-
// This is just a hacky way of figuring how many ../ we need to get to core
|
|
114
|
-
const containerToCorePath = moduleToContainerPath.split('/')
|
|
115
|
-
.slice(0, -1).map(() => '..').join('/') + '/core';
|
|
116
|
-
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
117
|
-
(0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { containerToCorePath })),
|
|
118
|
-
(0, schematics_1.move)(parsedPath.path),
|
|
119
|
-
]);
|
|
120
|
-
return (0, schematics_1.chain)([
|
|
121
|
-
addInserts(options),
|
|
122
|
-
(0, schematics_1.mergeWith)(templateSource)
|
|
123
|
-
]);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
exports.container = container;
|
|
127
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAIoC;AACpC,+DAA0E;AAC1E,yEAAmG;AACnG,uEAAmE;AACnE,uEAA8E;AAC9E,qEAAuF;AAEvF,+CAAyD;AAEzD,iEAAyE;AAEzE,SAAS,UAAU,CAAC,OAAY;IAC9B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,IAAI,CAAC;SACb;QAED,MAAM,cAAc,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,cAAc,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,aAAa,GACjB,IAAI,OAAO,CAAC,IAAI,GAAG;YACnB,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG;YACrC,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;QAEjD,gBAAgB;QACh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use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
-
describe('container', () => {
|
|
17
|
-
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
-
const tree = yield runner.runSchematic('container', {}, schematics_1.Tree.empty());
|
|
20
|
-
expect(tree.files).toEqual([]);
|
|
21
|
-
}));
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index_spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAG7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAGlE,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEtE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|