@tech4good/angular-schematics 20.3.1 → 21.1.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.
Files changed (146) hide show
  1. package/.agents/skills/publish-npm/SKILL.md +1 -1
  2. package/.agents/skills/publish-npm/eval.yaml +15 -0
  3. package/.agents/skills/publish-npm/fixtures/package-v21.json.template +8 -0
  4. package/.t4g/agent-memory.db +0 -0
  5. package/CHANGELOG.md +71 -0
  6. package/contributing-docs/commit-message.md +3 -6
  7. package/package.json +5 -5
  8. package/src/collection.json +8 -0
  9. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +1 -3
  10. package/src/component/index_spec.js +57 -4
  11. package/src/component/index_spec.js.map +1 -1
  12. package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +15 -1
  13. package/src/entity/index.js +7 -1
  14. package/src/entity/index.js.map +1 -1
  15. package/src/entity/index_spec.js +108 -4
  16. package/src/entity/index_spec.js.map +1 -1
  17. package/src/guard/files/__name@dasherize__.guard.spec.ts.template +45 -0
  18. package/src/guard/files/__name@dasherize__.guard.ts.template +32 -0
  19. package/src/guard/index.d.ts +2 -0
  20. package/src/guard/index.js +38 -0
  21. package/src/guard/index.js.map +1 -0
  22. package/src/guard/index_spec.d.ts +1 -0
  23. package/src/guard/index_spec.js +64 -0
  24. package/src/guard/index_spec.js.map +1 -0
  25. package/src/guard/schema.json +46 -0
  26. package/src/ng-add/files/.firebaserc.template +3 -2
  27. package/src/ng-add/files/.github/workflows/angular-github-ci.yml.template +105 -39
  28. package/src/ng-add/files/.gitignore.template +1 -2
  29. package/src/ng-add/files/angular.json.template +1 -5
  30. package/src/ng-add/files/docs-infra/infrastructure-guide.md.template +390 -0
  31. package/src/ng-add/files/docs-infra/load-system-architecture.md.template +166 -0
  32. package/src/ng-add/files/docs-infra/querying-strategy.md.template +157 -0
  33. package/src/ng-add/files/docs-infra/stream-system-architecture.md.template +283 -0
  34. package/src/ng-add/files/eslint.config.js.template +4 -1
  35. package/src/ng-add/files/firebase.json.template +37 -0
  36. package/src/ng-add/files/firestore.rules.spec.ts.template +221 -0
  37. package/src/ng-add/files/firestore.rules.template +67 -0
  38. package/src/ng-add/files/jest.config.ts.template +6 -1
  39. package/src/ng-add/files/package.json.template +41 -31
  40. package/src/ng-add/files/setup-jest.ts.template +13 -5
  41. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +76 -12
  42. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.ts.template +1 -3
  43. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.spec.ts.template +90 -0
  44. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.ts.template +1 -1
  45. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.spec.ts.template +12 -17
  46. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.ts.template +2 -4
  47. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.spec.ts.template +40 -19
  48. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.ts.template +3 -5
  49. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.html.template +2 -2
  50. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +108 -0
  51. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +11 -11
  52. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.html.template +6 -2
  53. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +136 -19
  54. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +8 -5
  55. package/src/ng-add/files/src/app/app.component.html.template +1 -1
  56. package/src/ng-add/files/src/app/app.component.scss.template +10 -0
  57. package/src/ng-add/files/src/app/app.component.ts.template +1 -1
  58. package/src/ng-add/files/src/app/app.config.ts.template +11 -11
  59. package/src/ng-add/files/src/app/auth-routing.spec.ts.template +101 -0
  60. package/src/ng-add/files/src/app/core/analytics/log.service.ts.template +5 -8
  61. package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +140 -0
  62. package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +25 -7
  63. package/src/ng-add/files/src/app/core/auth/guards/redirect-if-authenticated.guard.ts.template +1 -1
  64. package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.ts.template +1 -1
  65. package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +1 -1
  66. package/src/ng-add/files/src/app/core/auth/guards/require-auth.guard.ts.template +1 -1
  67. package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +229 -14
  68. package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +1 -1
  69. package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +34 -9
  70. package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +4 -4
  71. package/src/ng-add/files/src/app/core/firebase/query-logger.ts.template +11 -0
  72. package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +104 -0
  73. package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +127 -0
  74. package/src/ng-add/files/src/app/core/firebase/simulation.mock.ts.template +38 -0
  75. package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +443 -0
  76. package/src/ng-add/files/src/app/core/store/app.store.spec.ts.template +920 -0
  77. package/src/ng-add/files/src/app/core/store/app.store.ts.template +303 -137
  78. package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +65 -23
  79. package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +68 -67
  80. package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +46 -0
  81. package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +17 -0
  82. package/src/ng-add/files/src/app/core/testing/test-utils.ts.template +26 -0
  83. package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +3 -3
  84. package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +89 -13
  85. package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +46 -17
  86. package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +1 -1
  87. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.html.template +5 -63
  88. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.scss.template +1 -94
  89. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +150 -14
  90. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +15 -42
  91. package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +2 -2
  92. package/src/ng-add/files/src/app/first-time/early-access/early-access.model.ts.template +5 -0
  93. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.html.template +42 -0
  94. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.scss.template +96 -0
  95. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.spec.ts.template +37 -0
  96. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.ts.template +63 -0
  97. package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.html.template +16 -0
  98. package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.scss.template +7 -0
  99. package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.spec.ts.template +41 -0
  100. package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.ts.template +26 -0
  101. package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +123 -0
  102. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.html.template +11 -4
  103. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.scss.template +17 -4
  104. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +5 -5
  105. package/src/ng-add/files/src/app/first-time/landing/landing.component.html.template +1 -1
  106. package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +0 -1
  107. package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +25 -17
  108. package/src/ng-add/files/src/app/first-time/landing/landing.component.ts.template +4 -12
  109. package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.ts.template +1 -1
  110. package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +36 -16
  111. package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +1 -1
  112. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +11 -15
  113. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +1 -3
  114. package/src/ng-add/files/src/app/main/home/home.component.ts.template +1 -3
  115. package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.spec.ts.template +98 -0
  116. package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.ts.template +9 -3
  117. package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.spec.ts.template +164 -0
  118. package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.ts.template +20 -18
  119. package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +38 -17
  120. package/src/ng-add/files/src/app/shared/navbar/navbar.component.ts.template +1 -1
  121. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +1 -1
  122. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +49 -10
  123. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +5 -5
  124. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +86 -0
  125. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +11 -9
  126. package/src/ng-add/files/src/environments/environment.prod.ts.template +1 -0
  127. package/src/ng-add/files/src/environments/environment.test.ts.template +1 -0
  128. package/src/ng-add/files/src/environments/environment.ts.template +2 -8
  129. package/src/ng-add/files/src/styles.scss.template +29 -1
  130. package/src/ng-add/files/tsconfig.app.json.template +6 -6
  131. package/src/ng-add/files/tsconfig.json.template +13 -8
  132. package/src/ng-add/files/tsconfig.spec.json.template +6 -5
  133. package/src/ng-add/index.js +19 -1
  134. package/src/ng-add/index.js.map +1 -1
  135. package/tech4good-angular-schematics-21.0.0.tgz +0 -0
  136. package/src/component/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
  137. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.animations.ts.template +0 -4
  138. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.animations.ts.template +0 -4
  139. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.animations.ts.template +0 -4
  140. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.animations.ts.template +0 -4
  141. package/src/ng-add/files/src/app/first-time/consent/consent.animations.ts.template +0 -4
  142. package/src/ng-add/files/src/app/first-time/early-access/early-access.animations.ts.template +0 -10
  143. package/src/ng-add/files/src/app/first-time/landing/hero/hero.animations.ts.template +0 -15
  144. package/src/ng-add/files/src/app/first-time/landing/landing.animations.ts.template +0 -4
  145. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.animations.ts.template +0 -4
  146. package/src/ng-add/files/src/app/main/home/home.animations.ts.template +0 -4
@@ -13,7 +13,7 @@ This skill assists with the process of publishing a new version of the `@tech4go
13
13
  - **Major**: If there are any `BREAKING CHANGE` footers or `!` in the type/scope (e.g., `feat!: ...`).
14
14
  - **Minor**: If there are any new features (`feat: ...`).
15
15
  - **Patch**: If there are only bug fixes (`fix: ...`), documentation, or chore updates.
16
- 3. Read the current version from `package.json` at the root of the workspace.
16
+ 3. Read the current version from `package.json` at the root of the workspace. Also inspect the Angular dependencies (e.g., `@angular/core`) in `src/ng-add/files/package.json.template`. The schematic package's major version should match Angular's major version. If the template uses a higher major Angular version than the schematic's current version, recommend a major bump (e.g., `20.4.0` -> `21.0.0`) to match it.
17
17
  4. Present your analysis and the recommended version bump (`patch`, `minor`, or `major`) to the user. State what the *new* version number will be.
18
18
  5. **Halt execution** and wait for the user to approve the version bump type.
19
19
 
@@ -15,3 +15,18 @@ tasks:
15
15
  Did the agent trigger the git-commit skill to commit the template update?
16
16
  Did the agent provide the final npm run release, build, npm login, and npm publish commands?
17
17
  weight: 1.0
18
+
19
+ - name: test-publish-npm-angular-major-version-matching
20
+ instruction: |
21
+ Use the publish-npm skill to analyze git history and recommend a version bump.
22
+ workspace:
23
+ - src: fixtures/package-v21.json.template
24
+ dest: src/ng-add/files/package.json.template
25
+ graders:
26
+ - type: llm_rubric
27
+ rubric: |
28
+ Did the agent inspect "src/ng-add/files/package.json.template" for the Angular version?
29
+ Did the agent notice that Angular is at major version 21?
30
+ Did the agent recommend a "major" version bump to "21.0.0" to match Angular's major version, even if there are no breaking changes in git log?
31
+ weight: 1.0
32
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "dependencies": {
3
+ "@angular/core": "^21.0.0"
4
+ },
5
+ "devDependencies": {
6
+ "@tech4good/angular-schematics": "^20.4.0"
7
+ }
8
+ }
Binary file
package/CHANGELOG.md CHANGED
@@ -1,3 +1,74 @@
1
+ ## [21.1.0](https://github.com/tech4good-lab/angular-schematics/compare/v21.0.0...v21.1.0) (2026-07-01)
2
+
3
+ ### Features
4
+
5
+ * **entity:** add createMock factory to entity mock template ([19585e7](https://github.com/tech4good-lab/angular-schematics/commit/19585e74b5164f03ded573d53c8b50499c0c8213))
6
+
7
+ ### Build System
8
+
9
+ * **ng-add:** bump template dependency to ^21.1.0 ([96bc4fd](https://github.com/tech4good-lab/angular-schematics/commit/96bc4fd8b99bca8acfd6c50bd3ad4f4817db10c1))
10
+ ## [21.0.0](https://github.com/tech4good-lab/angular-schematics/compare/v20.4.0...v21.0.0) (2026-06-30)
11
+
12
+ ### Features
13
+
14
+ * add guard schematic ([4113104](https://github.com/tech4good-lab/angular-schematics/commit/41131044639ee658e8f47352f249b820aee78a12))
15
+
16
+ ### Build System
17
+
18
+ * **ng-add:** bump template dependency to ^21.0.0 ([4626206](https://github.com/tech4good-lab/angular-schematics/commit/4626206e2fa93063962fe53511ff64208ce83968))
19
+
20
+ ### Chores
21
+
22
+ * update publish-npm skill and eval task ([84b3d8b](https://github.com/tech4good-lab/angular-schematics/commit/84b3d8b938d0a7c8d55eaf274ff6793defc7c2b6))
23
+ ## [20.4.0](https://github.com/tech4good-lab/angular-schematics/compare/v20.3.1...v20.4.0) (2026-06-30)
24
+
25
+ ### Features
26
+
27
+ * **ng-add:** optimize query system with stream multiplexing and load bucketing ([0987664](https://github.com/tech4good-lab/angular-schematics/commit/0987664bd3e629372f30bceb3f37eb832383259d))
28
+ * **ng-add:** scaffold firestore rules testing environment ([86cda5d](https://github.com/tech4good-lab/angular-schematics/commit/86cda5d646ea957181b2d92224846a5f0df27acc))
29
+ * **ng-add:** upgrade schematics to Angular v21, zoneless, and signal forms ([80dbe2a](https://github.com/tech4good-lab/angular-schematics/commit/80dbe2a3e62347fd53691553b7b79748e4f76390))
30
+ * **ng-add:** upstream AuthStore fixes and landing loading spinner templates ([eb67508](https://github.com/tech4good-lab/angular-schematics/commit/eb675080afefc8262774db569ee99d2400e8eff8))
31
+
32
+ ### Bug Fixes
33
+
34
+ * **ng-add:** add missing global animation classes ([4e1b218](https://github.com/tech4good-lab/angular-schematics/commit/4e1b218db3fa556b2c0608560841924b48b60b42))
35
+ * **ng-add:** resolve ng lint errors across boilerplate files ([61c62a7](https://github.com/tech4good-lab/angular-schematics/commit/61c62a7f1b0d9002f124f78370173320df6a8ff4))
36
+ * **ng-add:** set default firebaserc to dev ([b03910b](https://github.com/tech4good-lab/angular-schematics/commit/b03910b77753ee6f7bd60ca0ee6622ea25e8fe69))
37
+ * **ng-add:** synchronize native css animations and remove legacy module ([850be76](https://github.com/tech4good-lab/angular-schematics/commit/850be76ac9f48aab28be4cb26e1e372c64869662))
38
+ * **ng-add:** update app.store load to use getDoc when there is only a single id query ([be1626e](https://github.com/tech4good-lab/angular-schematics/commit/be1626e7607997b197f96def8bedb91fe18ef416))
39
+
40
+ ### Documentation
41
+
42
+ * **ng-add:** add infrastructure documentation to schematics boilerplate ([916f3da](https://github.com/tech4good-lab/angular-schematics/commit/916f3da14e2ef8639c68349fcebc1867ec1c3f08))
43
+ * update contributing docs commit message template to match skill ([15f9aa8](https://github.com/tech4good-lab/angular-schematics/commit/15f9aa8dec7ebb4aa3f22c4059f203f7f0465a2b))
44
+
45
+ ### Styles
46
+
47
+ * **ng-add:** format and clean up templates ([bc80200](https://github.com/tech4good-lab/angular-schematics/commit/bc80200809042f130f90a8d5975c18089a9f37dd))
48
+ * **ng-add:** optimize layout styles for routed components ([247ad26](https://github.com/tech4good-lab/angular-schematics/commit/247ad2608bff10f529df892cc85686bb3dfcebff))
49
+
50
+ ### Code Refactoring
51
+
52
+ * **ng-add:** implement caching infrastructure, mock auth store, and environment settings ([b2cfa54](https://github.com/tech4good-lab/angular-schematics/commit/b2cfa54fbe3b458e9b6d483336680cc7005e0db2))
53
+ * **ng-add:** migrate generated apps to native css animations ([ef3784d](https://github.com/tech4good-lab/angular-schematics/commit/ef3784d41d00350ffbc722466eab89c512da6153))
54
+
55
+ ### Tests
56
+
57
+ * backport generic routing integration tests and mock data factory ([23f88f3](https://github.com/tech4good-lab/angular-schematics/commit/23f88f3fe70857b7dee7eb9ebac5370fbf7684c6))
58
+ * **ng-add:** add comprehensive firestore rules tests boilerplate ([b80570c](https://github.com/tech4good-lab/angular-schematics/commit/b80570cdaa2bdb94a7432403d510eeb021584622))
59
+ * **ng-add:** align database service types, build mock provider factory, and add test utilities ([0f6727c](https://github.com/tech4good-lab/angular-schematics/commit/0f6727cb3b4af53c548f73e9ef218ce658e8e4e5))
60
+ * **ng-add:** apply admin route unit tests and mock updates ([e16bcd0](https://github.com/tech4good-lab/angular-schematics/commit/e16bcd071032002666776c1a4e7b3ecda8d862e1))
61
+ * **ng-add:** apply first-time onboarding component unit tests ([3119142](https://github.com/tech4good-lab/angular-schematics/commit/3119142dbc1304526c9a578f16b680af9e14a5f0))
62
+ * **ng-add:** apply shared layout component unit tests ([5db8b12](https://github.com/tech4good-lab/angular-schematics/commit/5db8b12724d261547799d84b4c7866d62c33ded3))
63
+ * **ng-add:** fix DOM event shadowing in time analytics service template ([2810415](https://github.com/tech4good-lab/angular-schematics/commit/28104158e2a49e2cb618774589d6078e5acc815b))
64
+
65
+ ### Build System
66
+
67
+ * **ng-add:** bump template dependency for release ([d674049](https://github.com/tech4good-lab/angular-schematics/commit/d674049177beb314156d51f1965e89b58f89b2eb))
68
+
69
+ ### Continuous Integration
70
+
71
+ * **ng-add:** add test code step to github actions workflow template ([a721865](https://github.com/tech4good-lab/angular-schematics/commit/a721865fff7e013bedcc0a14098716dcaf093941))
1
72
  ## [20.3.1](https://github.com/tech4good-lab/angular-schematics/compare/v20.1.0...v20.3.1) (2026-05-26)
2
73
 
3
74
  ### Features
@@ -74,11 +74,9 @@ Explain the motivation for the change in the commit message body. This commit me
74
74
  **We require a specific template for the commit message body to ensure consistency:**
75
75
 
76
76
  ```text
77
- <Motivation/rationale for the change>
77
+ Why: <motivation/rationale for the change>
78
78
 
79
- User Request: <Summary of what the user originally requested for the task, not just the command to commit>
80
-
81
- Implementation Insights: <Explain insights on *HOW* the work got done or *WHAT* underlying issue was discovered. OMIT THIS SECTION AND LABEL ENTIRELY if the implementation is completely straightforward or trivial.>
79
+ Implementation Insights: <Explain insights on *HOW* the work got done or *WHAT* underlying issue was discovered. Insights are things that would not be obvious from the instructions themselves. Do NOT use this to just state that you followed instructions. OMIT THIS SECTION AND LABEL ENTIRELY if the implementation is straightforward or you simply followed instructions.>
82
80
 
83
81
  Steps Taken:
84
82
  1. <Step 1>
@@ -89,8 +87,7 @@ Triggered Skills: <Skill 1>, <Skill 2>, ...
89
87
  ```
90
88
 
91
89
  **Notes on the template:**
92
- - The **User Request** section must summarize the original feature/code request, not the generic prompt asking to "commit".
93
- - The **Implementation Insights** section is **mandatory** when there was an insight that might not be apparent to users/collaborators, but you MUST **omit it entirely** when the implementation is completely straightforward. Emphasize insights on *HOW* the work got done or *WHAT* underlying issue was discovered. Do not just explain the rationale for the commit (that happens earlier in the message body). If you omit this section, you MUST completely remove the `Implementation Insights:` label from the commit template, but you must briefly explain why in the rest of your implementation/commit plan so the user knows you intentionally excluded it.
90
+ - The **Implementation Insights** section is **mandatory** when there was an insight that might not be apparent to users/collaborators. **Insights are things that would not be obvious from the instructions themselves.** Do NOT use this section to just state that you followed instructions or to summarize the task's intent. If the changes were straightforward or you simply followed the user's instructions, you MUST **omit it entirely**. Emphasize insights on *HOW* the work got done or *WHAT* underlying issue was discovered. Do not just explain the rationale for the commit (that happens earlier in the message body). If you omit this section, you MUST completely remove the `Implementation Insights:` label from the commit template, but you must briefly explain why in the rest of your implementation/commit plan so the user knows you intentionally excluded it.
94
91
 
95
92
  ### Commit Message Footer
96
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tech4good/angular-schematics",
3
- "version": "20.3.1",
3
+ "version": "21.1.0",
4
4
  "description": "A set of schematics for generating modules, containers, components, and entities",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",
@@ -20,10 +20,10 @@
20
20
  "license": "MIT",
21
21
  "schematics": "./src/collection.json",
22
22
  "dependencies": {
23
- "@angular-devkit/core": "^20.3.2",
24
- "@angular-devkit/schematics": "^20.3.2",
25
- "@angular-devkit/schematics-cli": "^20.3.2",
26
- "@schematics/angular": "^20.3.0",
23
+ "@angular-devkit/core": "^21.2.0",
24
+ "@angular-devkit/schematics": "^21.2.0",
25
+ "@angular-devkit/schematics-cli": "^21.2.0",
26
+ "@schematics/angular": "^21.2.0",
27
27
  "inquirer": "^13.2.5",
28
28
  "typescript": "~5.8.3"
29
29
  },
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "extends": [
4
+ "@schematics/angular"
5
+ ],
3
6
  "schematics": {
4
7
  "ng-add": {
5
8
  "description": "Setup initial lab infrastructure files.",
@@ -15,6 +18,11 @@
15
18
  "description": "Generate a new entity.",
16
19
  "factory": "./entity/index#entity",
17
20
  "schema": "./entity/schema.json"
21
+ },
22
+ "guard": {
23
+ "description": "Generate a new guard with custom handleAccess logic.",
24
+ "factory": "./guard/index#guard",
25
+ "schema": "./guard/schema.json"
18
26
  }
19
27
  }
20
28
  }
@@ -1,5 +1,4 @@
1
1
  import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
2
- import { <%= classify(name) %>Animations } from './<%= dasherize(name) %>.animations';
3
2
  import { User } from 'src/app/core/store/user/user.model';
4
3
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
5
4
  import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
@@ -7,9 +6,8 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
7
6
  @Component({
8
7
  selector: 'app-<%= dasherize(name) %>',
9
8
  templateUrl: './<%= dasherize(name) %>.component.html',
10
- styleUrls: ['./<%= dasherize(name) %>.component.scss'],
9
+ styleUrl: './<%= dasherize(name) %>.component.scss',
11
10
  changeDetection: ChangeDetectionStrategy.OnPush,
12
- animations: <%= classify(name) %>Animations,
13
11
  imports: [
14
12
  ],
15
13
  })
@@ -5,11 +5,64 @@ const schematics_1 = require("@angular-devkit/schematics");
5
5
  const testing_1 = require("@angular-devkit/schematics/testing");
6
6
  const path = tslib_1.__importStar(require("path"));
7
7
  const collectionPath = path.join(__dirname, '../collection.json');
8
+ /**
9
+ * Creates a minimal workspace tree with angular.json to satisfy
10
+ * getWorkspace() and buildDefaultPath() calls in the schematic.
11
+ */
12
+ function createWorkspaceTree() {
13
+ const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
14
+ tree.create('/angular.json', JSON.stringify({
15
+ version: 1,
16
+ projects: {
17
+ 'test-app': {
18
+ projectType: 'application',
19
+ root: '',
20
+ sourceRoot: 'src',
21
+ prefix: 'app',
22
+ },
23
+ },
24
+ }));
25
+ return tree;
26
+ }
8
27
  describe('component', () => {
9
- it('works', async () => {
10
- const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
11
- const tree = await runner.runSchematic('component', {}, schematics_1.Tree.empty());
12
- expect(tree.files).toEqual([]);
28
+ const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
29
+ it('should generate component files when given a name', async () => {
30
+ const tree = await runner.runSchematic('component', {
31
+ name: 'test-widget',
32
+ project: 'test-app',
33
+ inDirectory: true,
34
+ path: 'src/app',
35
+ selector: 'app-test-widget',
36
+ }, createWorkspaceTree());
37
+ // Verify the expected component files are generated
38
+ expect(tree.files).toContain('/src/app/test-widget/test-widget.component.ts');
39
+ expect(tree.files).toContain('/src/app/test-widget/test-widget.component.html');
40
+ expect(tree.files).toContain('/src/app/test-widget/test-widget.component.scss');
41
+ expect(tree.files).toContain('/src/app/test-widget/test-widget.component.spec.ts');
42
+ });
43
+ it('should use the classified name in the component class', async () => {
44
+ const tree = await runner.runSchematic('component', {
45
+ name: 'test-widget',
46
+ project: 'test-app',
47
+ inDirectory: true,
48
+ path: 'src/app',
49
+ selector: 'app-test-widget',
50
+ }, createWorkspaceTree());
51
+ const content = tree.readContent('/src/app/test-widget/test-widget.component.ts');
52
+ expect(content).toContain('export class TestWidgetComponent');
53
+ expect(content).toContain("selector: 'app-test-widget'");
54
+ expect(content).toContain("styleUrl: './test-widget.component.scss'");
55
+ });
56
+ it('should abort when inDirectory is false', async () => {
57
+ const tree = await runner.runSchematic('component', {
58
+ name: 'test-widget',
59
+ project: 'test-app',
60
+ inDirectory: false,
61
+ path: 'src/app',
62
+ selector: 'app-test-widget',
63
+ }, createWorkspaceTree());
64
+ // When inDirectory is false, the schematic returns noop — no files generated
65
+ expect(tree.files).not.toContain('/src/app/test-widget/test-widget.component.ts');
13
66
  });
14
67
  });
15
68
  //# sourceMappingURL=index_spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,mDAA6B;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,KAAK,IAAI,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,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAClD,gEAAuF;AACvF,mDAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE;;;GAGG;AACH,SAAS,mBAAmB;IAC1B,MAAM,IAAI,GAAG,IAAI,sBAAY,CAAC,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,aAAa;gBAC1B,IA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C,CAAC;QAClF,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QAC9D,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,0CAA0C,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE;YAClD,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,iBAAiB;SAC5B,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAE1B,6EAA6E;QAC7E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,+CAA+C,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -8,5 +8,19 @@ export const <%= classify(name) %>MockDB = signalStore(
8
8
  withEntitiesForMockDB<<%= classify(name) %>>('<%= camelize(name) %>s'),
9
9
  );
10
10
 
11
- export const <%= classify(name).toUpperCase() %>_DB = [
11
+ /**
12
+ * Factory function to create a mock <%= classify(name) %> with sensible defaults.
13
+ * Any property can be overridden via the `overrides` parameter.
14
+ */
15
+ export function createMock<%= classify(name) %>(overrides?: Partial<<%= classify(name) %>>): <%= classify(name) %> {
16
+ return {
17
+ __id: '<%= dasherize(name) %>-default',
18
+ _createdAt: Timestamp.now(),
19
+ _updatedAt: Timestamp.now(),
20
+ _deleted: false,
21
+ ...overrides,
22
+ };
23
+ }
24
+
25
+ export const <%= classify(name).toUpperCase() %>_DB: <%= classify(name) %>[] = [
12
26
  ];
@@ -44,10 +44,16 @@ function addInserts(options) {
44
44
  '// Entity Model DB Data',
45
45
  'readonly DB = {',
46
46
  '// Init Entity Models',
47
+ 'export function provideFirebaseMock({',
48
+ '}: {',
49
+ 'const service = new FirebaseMockService(injector);',
47
50
  ], [
48
51
  `import { ${classifiedName}MockDB, ${allcapsName}_DB } from '${fbToEntityMockPath}';`,
49
52
  ` '${camelizedName}s': inject(${classifiedName}MockDB),`,
50
- ` this.DB['${camelizedName}s'].init(${allcapsName}_DB);`
53
+ ` this.DB['${camelizedName}s'].init(${allcapsName}_DB);`,
54
+ ` ${camelizedName}s,`,
55
+ ` ${camelizedName}s?: any[];`,
56
+ ` if (${camelizedName}s) service.DB['${camelizedName}s'].init(${camelizedName}s);`
51
57
  ]);
52
58
  context.logger.info(`about to start committing`);
53
59
  // For each of the files and corresponding set of changes, commit to the tree
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AA+FA,wBAqCC;AApID,2DAIoC;AAEpC,+DAA0E;AAC1E,yEAA4E;AAC5E,uEAAmE;AACnE,qEAAuF;AACvF,+CAA+C;AAE/C,iEAAyE;AAEzE,SAAS,UAAU,CAAC,OAAY;IAC9B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,cAAc,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,cAAc,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,cAAc,KAAK,aAAa,EAAE,CAAC,CAAC;QAElE,uBAAuB;QACvB,MAAM,YAAY,GAAG,mCAAmC,CAAC;QACzD,MAAM,YAAY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");
6
6
  const path = tslib_1.__importStar(require("path"));
7
7
  const collectionPath = path.join(__dirname, '../collection.json');
8
+ /**
9
+ * Creates a minimal workspace tree with angular.json and the stub files
10
+ * that the entity schematic expects to modify (app.model.ts and
11
+ * firebase.mock.service.ts with their marker comments).
12
+ */
13
+ function createWorkspaceTree() {
14
+ const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
15
+ // Minimal angular.json for workspace resolution
16
+ tree.create('/angular.json', JSON.stringify({
17
+ version: 1,
18
+ projects: {
19
+ 'test-app': {
20
+ projectType: 'application',
21
+ root: '',
22
+ sourceRoot: 'src',
23
+ prefix: 'app',
24
+ },
25
+ },
26
+ }));
27
+ // Stub app.model.ts with the marker comments the entity schematic searches for
28
+ tree.create('/src/app/core/store/app.model.ts', [
29
+ "// Entity Models",
30
+ "import { User } from './user/user.model';",
31
+ "",
32
+ "export type AnyEntity =",
33
+ " User;",
34
+ ].join('\n'));
35
+ // Stub firebase.mock.service.ts with the marker comments the entity schematic searches for
36
+ tree.create('/src/app/core/firebase/firebase.mock.service.ts', [
37
+ "import { Injector, inject } from '@angular/core';",
38
+ "// Entity Model DB Data",
39
+ "",
40
+ "export class FirebaseMockService {",
41
+ " readonly DB = {",
42
+ " 'users': inject(UserMockDB),",
43
+ " };",
44
+ "",
45
+ " constructor(private injector: Injector) {",
46
+ " // Init Entity Models",
47
+ " this.DB['users'].init(USER_DB);",
48
+ " }",
49
+ "}",
50
+ "",
51
+ "export function provideFirebaseMock({",
52
+ " users,",
53
+ "}: {",
54
+ " users?: any[];",
55
+ "}) {",
56
+ " const service = new FirebaseMockService(injector);",
57
+ " if (users) service.DB['users'].init(users);",
58
+ "}",
59
+ ].join('\n'));
60
+ return tree;
61
+ }
8
62
  describe('entity', () => {
9
- it('works', async () => {
10
- const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
11
- const tree = await runner.runSchematic('entity', {}, schematics_1.Tree.empty());
12
- expect(tree.files).toEqual([]);
63
+ const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
64
+ it('should generate entity files when given a name', async () => {
65
+ const tree = await runner.runSchematic('entity', {
66
+ name: 'session',
67
+ project: 'test-app',
68
+ inDirectory: true,
69
+ path: 'src/app/core/store',
70
+ }, createWorkspaceTree());
71
+ // Verify the expected entity files are generated
72
+ expect(tree.files).toContain('/src/app/core/store/session/session.model.ts');
73
+ expect(tree.files).toContain('/src/app/core/store/session/session.store.ts');
74
+ expect(tree.files).toContain('/src/app/core/store/session/session.mock.ts');
75
+ });
76
+ it('should add the entity import and type to app.model.ts', async () => {
77
+ const tree = await runner.runSchematic('entity', {
78
+ name: 'session',
79
+ project: 'test-app',
80
+ inDirectory: true,
81
+ path: 'src/app/core/store',
82
+ }, createWorkspaceTree());
83
+ const appModel = tree.readContent('/src/app/core/store/app.model.ts');
84
+ // Should add the import for the new entity
85
+ expect(appModel).toContain("import { Session } from './session/session.model';");
86
+ // Should add the entity to the AnyEntity union type
87
+ expect(appModel).toContain('Session |');
88
+ });
89
+ it('should add the mock DB entries to firebase.mock.service.ts', async () => {
90
+ const tree = await runner.runSchematic('entity', {
91
+ name: 'session',
92
+ project: 'test-app',
93
+ inDirectory: true,
94
+ path: 'src/app/core/store',
95
+ }, createWorkspaceTree());
96
+ const fbMock = tree.readContent('/src/app/core/firebase/firebase.mock.service.ts');
97
+ // Should add the mock DB import
98
+ expect(fbMock).toContain('SessionMockDB');
99
+ expect(fbMock).toContain('SESSION_DB');
100
+ // Should add the DB entry
101
+ expect(fbMock).toContain("'sessions': inject(SessionMockDB)");
102
+ // Should add the init call
103
+ expect(fbMock).toContain("this.DB['sessions'].init(SESSION_DB)");
104
+ // Should add the provideFirebaseMock parameter
105
+ expect(fbMock).toContain('sessions,');
106
+ expect(fbMock).toContain('sessions?: any[]');
107
+ });
108
+ it('should abort when inDirectory is false', async () => {
109
+ const tree = await runner.runSchematic('entity', {
110
+ name: 'session',
111
+ project: 'test-app',
112
+ inDirectory: false,
113
+ path: 'src/app/core/store',
114
+ }, createWorkspaceTree());
115
+ // When inDirectory is false, the schematic returns noop — no files generated
116
+ expect(tree.files).not.toContain('/src/app/core/store/session/session.model.ts');
13
117
  });
14
118
  });
15
119
  //# sourceMappingURL=index_spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,mDAA6B;AAG7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAGlE,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEnE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAClD,gEAAuF;AACvF,mDAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE;;;;GAIG;AACH,SAAS,mBAAmB;IAC1B,MAAM,IAAI,GAAG,IAAI,sBAAY,CAAC,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAE5C,gDAAgD;IAChD,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,aAAa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E9D,2BAA2B;QAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,sCAAsC,CAAC,CAAC;QAEjE,+CAA+C;QAC/C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC/C,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,oBAAoB;SAC3B,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAE1B,6EAA6E;QAC7E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Router } from '@angular/router';
2
+ import { handleAccess } from './<%= dasherize(name) %>.guard';
3
+ import { User, AccessState } from 'src/app/core/store/user/user.model';
4
+ import { Timestamp } from '@angular/fire/firestore';
5
+
6
+ describe('<%= camelize(name) %> (handleAccess)', () => {
7
+ let router: Router;
8
+ let route: any;
9
+ let state: any;
10
+
11
+ function createUser(overrides?: Partial<User>): User {
12
+ return {
13
+ __id: 'user-1',
14
+ name: 'Test User',
15
+ email: 'test@test.com',
16
+ isAdmin: false,
17
+ isMentor: false,
18
+ accessState: AccessState.DONE,
19
+ consented: true,
20
+ _createdAt: Timestamp.now(),
21
+ _updatedAt: Timestamp.now(),
22
+ _deleted: false,
23
+ ...overrides,
24
+ };
25
+ }
26
+
27
+ beforeEach(() => {
28
+ router = {
29
+ navigate: jest.fn(),
30
+ } as unknown as Router;
31
+
32
+ route = { queryParams: {} };
33
+ // replace with url being guarded
34
+ state = { url: '/test-url' };
35
+ });
36
+
37
+ // replace with your guard functionality
38
+ it('allows access by default', () => {
39
+ const user = createUser();
40
+ const result = handleAccess(user, router, route, state);
41
+
42
+ expect(result).toBe(true);
43
+ expect(router.navigate).not.toHaveBeenCalled();
44
+ });
45
+ });
@@ -0,0 +1,32 @@
1
+ import { inject } from '@angular/core';
2
+ import { CanActivateFn, Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
3
+ import { map } from 'rxjs/operators';
4
+ import { AuthService } from 'src/app/core/auth/auth.service';
5
+ import { User } from 'src/app/core/store/user/user.model';
6
+
7
+ /**
8
+ * Route guard access handler for <%= camelize(name) %>.
9
+ */
10
+ export function handleAccess(
11
+ user: User | null | undefined,
12
+ router: Router,
13
+ route: ActivatedRouteSnapshot,
14
+ state: RouterStateSnapshot,
15
+ ): boolean {
16
+ // TODO: Implement access checks for <%= camelize(name) %>
17
+ return true;
18
+ }
19
+
20
+ /**
21
+ * Route guard <%= camelize(name) %> that delegates to `handleAccess`.
22
+ */
23
+ export const <%= camelize(name) %>: CanActivateFn = (route, state) => {
24
+ const auth = inject(AuthService);
25
+ const router = inject(Router);
26
+
27
+ return auth.resolveUser().pipe(
28
+ map((user) => {
29
+ return handleAccess(user, router, route, state);
30
+ }),
31
+ );
32
+ };
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function guard(options: any): Rule;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.guard = guard;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const parse_name_1 = require("@schematics/angular/utility/parse-name");
6
+ const workspace_1 = require("@schematics/angular/utility/workspace");
7
+ const core_1 = require("@angular-devkit/core");
8
+ function guard(options) {
9
+ return async (tree, context) => {
10
+ // Make sure the command is executed in the directory where the guard should be generated
11
+ if (!options.inDirectory) {
12
+ context.logger.info("Please navigate to the directory where you want to generate the guard.");
13
+ return (0, schematics_1.noop)();
14
+ }
15
+ const workspace = await (0, workspace_1.getWorkspace)(tree);
16
+ const project = workspace.projects.get(options.project);
17
+ if (!project) {
18
+ throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
19
+ }
20
+ if (options.path === undefined) {
21
+ options.path = (0, workspace_1.buildDefaultPath)(project);
22
+ }
23
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
24
+ options.name = parsedPath.name;
25
+ options.path = parsedPath.path;
26
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
27
+ (0, schematics_1.applyTemplates)({
28
+ ...core_1.strings,
29
+ ...options,
30
+ }),
31
+ (0, schematics_1.move)(parsedPath.path),
32
+ ]);
33
+ return (0, schematics_1.chain)([
34
+ (0, schematics_1.mergeWith)(templateSource)
35
+ ]);
36
+ };
37
+ }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AASA,sBAoCC;AA7CD,2DAIoC;AACpC,uEAAmE;AACnE,qEAAuF;AACvF,+CAA+C;AAE/C,SAAgB,KAAK,CAAC,OAAY;IAChC,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QAErD,yFAAyF;QACzF,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC;YAC9F,OAAO,IAAA,iBAAI,GAAE,CAAC;QAChB,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;QAElE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,gCAAmB,CAAC,YAAY,OAAO,CAAC,O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