@tech4good/angular-schematics 18.1.0 → 20.2.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 (144) hide show
  1. package/.agents/skills/publish-npm/SKILL.md +35 -0
  2. package/.agents/skills/publish-npm/eval.yaml +17 -0
  3. package/CHANGELOG.md +22 -0
  4. package/README.md +9 -14
  5. package/changelog.config.json +19 -0
  6. package/contributing-docs/branches-and-releases.md +57 -0
  7. package/contributing-docs/commit-message.md +117 -0
  8. package/package.json +19 -10
  9. package/src/collection.json +3 -3
  10. package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +25 -22
  11. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -1
  12. package/src/component/index.js +8 -15
  13. package/src/component/index.js.map +1 -1
  14. package/src/component/index_spec.js +5 -13
  15. package/src/component/index_spec.js.map +1 -1
  16. package/src/component/schema.json +1 -0
  17. package/src/entity/index.js +8 -15
  18. package/src/entity/index.js.map +1 -1
  19. package/src/entity/index_spec.js +5 -13
  20. package/src/entity/index_spec.js.map +1 -1
  21. package/src/entity/schema.json +1 -0
  22. package/src/{init → ng-add}/files/.github/workflows/angular-github-ci.yml.template +1 -1
  23. package/src/{init → ng-add}/files/angular.json.template +26 -0
  24. package/src/ng-add/files/eslint.config.js.template +97 -0
  25. package/src/ng-add/files/package.json.template +71 -0
  26. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +37 -0
  27. package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.ts.template +0 -1
  28. package/src/ng-add/files/src/app/app.component.spec.ts.template +39 -0
  29. package/src/{init → ng-add}/files/src/app/app.component.ts.template +0 -1
  30. package/src/{init → ng-add}/files/src/app/core/firebase/cached-listeners.service.ts.template +2 -17
  31. package/src/{init → ng-add}/files/src/app/core/firebase/firebase.mock.service.ts.template +4 -2
  32. package/src/{init → ng-add}/files/src/app/core/firebase/firebase.service.ts.template +3 -1
  33. package/src/{init → ng-add}/files/src/app/core/store/auth/auth.mock.ts.template +9 -3
  34. package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +37 -0
  35. package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.ts.template +0 -1
  36. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +40 -0
  37. package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.ts.template +1 -3
  38. package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +37 -0
  39. package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.ts.template +0 -1
  40. package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +37 -0
  41. package/src/{init → ng-add}/files/src/app/first-time/login/login.component.ts.template +0 -1
  42. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +37 -0
  43. package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.ts.template +0 -1
  44. package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +37 -0
  45. package/src/{init → ng-add}/files/src/app/main/home/home.component.ts.template +0 -1
  46. package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +37 -0
  47. package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.ts.template +0 -1
  48. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +30 -0
  49. package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +0 -1
  50. package/src/ng-add/files/src/main.ts.template +6 -0
  51. package/src/{init → ng-add}/index.d.ts +1 -1
  52. package/src/{init → ng-add}/index.js +9 -16
  53. package/src/ng-add/index.js.map +1 -0
  54. package/src/{init → ng-add}/schema.json +3 -2
  55. package/src/shared/camelcase-formatter.js +1 -2
  56. package/src/shared/camelcase-formatter.js.map +1 -1
  57. package/src/shared/statements-adder.js +3 -4
  58. package/src/shared/statements-adder.js.map +1 -1
  59. package/tsconfig.json +10 -25
  60. package/src/init/files/.eslintrc.json.template +0 -120
  61. package/src/init/files/package.json.template +0 -68
  62. package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +0 -32
  63. package/src/init/files/src/app/app.component.spec.ts.template +0 -27
  64. package/src/init/files/src/app/first-time/consent/consent.component.spec.ts.template +0 -32
  65. package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +0 -35
  66. package/src/init/files/src/app/first-time/landing/landing.component.spec.ts.template +0 -32
  67. package/src/init/files/src/app/first-time/login/login.component.spec.ts.template +0 -32
  68. package/src/init/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +0 -33
  69. package/src/init/files/src/app/main/home/home.component.spec.ts.template +0 -32
  70. package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +0 -32
  71. package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +0 -24
  72. package/src/init/index.js.map +0 -1
  73. /package/src/{init → ng-add}/files/.firebaserc.template +0 -0
  74. /package/src/{init → ng-add}/files/.gitattributes.template +0 -0
  75. /package/src/{init → ng-add}/files/.gitignore.template +0 -0
  76. /package/src/{init → ng-add}/files/CODE_OF_CONDUCT.md.template +0 -0
  77. /package/src/{init → ng-add}/files/CONTRIBUTING.md.template +0 -0
  78. /package/src/{init → ng-add}/files/README.md.template +0 -0
  79. /package/src/{init → ng-add}/files/contributing-docs/coding-standards.md.template +0 -0
  80. /package/src/{init → ng-add}/files/contributing-docs/using-fixup-commits.md.template +0 -0
  81. /package/src/{init → ng-add}/files/jest.config.ts.template +0 -0
  82. /package/src/{init → ng-add}/files/public/images/close-x.svg +0 -0
  83. /package/src/{init → ng-add}/files/setup-jest.ts.template +0 -0
  84. /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.animations.ts.template +0 -0
  85. /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.html.template +0 -0
  86. /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.scss.template +0 -0
  87. /package/src/{init → ng-add}/files/src/app/app.component.html.template +0 -0
  88. /package/src/{init → ng-add}/files/src/app/app.component.scss.template +0 -0
  89. /package/src/{init → ng-add}/files/src/app/app.config.ts.template +0 -0
  90. /package/src/{init → ng-add}/files/src/app/app.routes.ts.template +0 -0
  91. /package/src/{init → ng-add}/files/src/app/core/analytics/log.service.ts.template +0 -0
  92. /package/src/{init → ng-add}/files/src/app/core/analytics/time-analytics.service.ts.template +0 -0
  93. /package/src/{init → ng-add}/files/src/app/core/auth/auth.guard.ts.template +0 -0
  94. /package/src/{init → ng-add}/files/src/app/core/firebase/database.service.ts.template +0 -0
  95. /package/src/{init → ng-add}/files/src/app/core/local-storage/local-storage.service.ts.template +0 -0
  96. /package/src/{init → ng-add}/files/src/app/core/local-storage/session-local-storage.service.ts.template +0 -0
  97. /package/src/{init → ng-add}/files/src/app/core/local-storage/session.service.ts.template +0 -0
  98. /package/src/{init → ng-add}/files/src/app/core/router/routing-state.service.ts.template +0 -0
  99. /package/src/{init → ng-add}/files/src/app/core/store/app.model.ts.template +0 -0
  100. /package/src/{init → ng-add}/files/src/app/core/store/app.store.ts.template +0 -0
  101. /package/src/{init → ng-add}/files/src/app/core/store/auth/auth.store.ts.template +0 -0
  102. /package/src/{init → ng-add}/files/src/app/core/store/batch-write.firebase.service.ts.template +0 -0
  103. /package/src/{init → ng-add}/files/src/app/core/store/batch-write.mock.service.ts.template +0 -0
  104. /package/src/{init → ng-add}/files/src/app/core/store/batch-write.service.ts.template +0 -0
  105. /package/src/{init → ng-add}/files/src/app/core/store/user/user.mock.ts.template +0 -0
  106. /package/src/{init → ng-add}/files/src/app/core/store/user/user.model.ts.template +0 -0
  107. /package/src/{init → ng-add}/files/src/app/core/store/user/user.store.ts.template +0 -0
  108. /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.mock.ts.template +0 -0
  109. /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.model.ts.template +0 -0
  110. /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.store.ts.template +0 -0
  111. /package/src/{init → ng-add}/files/src/app/core/utils/rand.utils.ts.template +0 -0
  112. /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.animations.ts.template +0 -0
  113. /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.html.template +0 -0
  114. /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.scss.template +0 -0
  115. /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.animations.ts.template +0 -0
  116. /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.html.template +0 -0
  117. /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.scss.template +0 -0
  118. /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.model.ts.template +0 -0
  119. /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.animations.ts.template +0 -0
  120. /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.html.template +0 -0
  121. /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.scss.template +0 -0
  122. /package/src/{init → ng-add}/files/src/app/first-time/login/login.component.html.template +0 -0
  123. /package/src/{init → ng-add}/files/src/app/first-time/login/login.component.scss.template +0 -0
  124. /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.animations.ts.template +0 -0
  125. /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.html.template +0 -0
  126. /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.scss.template +0 -0
  127. /package/src/{init → ng-add}/files/src/app/main/home/home.animations.ts.template +0 -0
  128. /package/src/{init → ng-add}/files/src/app/main/home/home.component.html.template +0 -0
  129. /package/src/{init → ng-add}/files/src/app/main/home/home.component.scss.template +0 -0
  130. /package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.html.template +0 -0
  131. /package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.scss.template +0 -0
  132. /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +0 -0
  133. /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.scss.template +0 -0
  134. /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +0 -0
  135. /package/src/{init → ng-add}/files/src/env.d.ts.template +0 -0
  136. /package/src/{init → ng-add}/files/src/environments/environment.prod.ts.template +0 -0
  137. /package/src/{init → ng-add}/files/src/environments/environment.test.ts.template +0 -0
  138. /package/src/{init → ng-add}/files/src/environments/environment.ts.template +0 -0
  139. /package/src/{init → ng-add}/files/src/index.html.template +0 -0
  140. /package/src/{init → ng-add}/files/src/styles/_variables.scss.template +0 -0
  141. /package/src/{init → ng-add}/files/src/styles.scss.template +0 -0
  142. /package/src/{init → ng-add}/files/tsconfig.app.json.template +0 -0
  143. /package/src/{init → ng-add}/files/tsconfig.json.template +0 -0
  144. /package/src/{init → ng-add}/files/tsconfig.spec.json.template +0 -0
@@ -1,23 +1,15 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
12
4
  const schematics_1 = require("@angular-devkit/schematics");
13
5
  const testing_1 = require("@angular-devkit/schematics/testing");
14
- const path = require("path");
6
+ const path = tslib_1.__importStar(require("path"));
15
7
  const collectionPath = path.join(__dirname, '../collection.json');
16
8
  describe('entity', () => {
17
- it('works', () => __awaiter(void 0, void 0, void 0, function* () {
9
+ it('works', async () => {
18
10
  const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
19
- const tree = yield runner.runSchematic('entity', {}, schematics_1.Tree.empty());
11
+ const tree = await runner.runSchematic('entity', {}, schematics_1.Tree.empty());
20
12
  expect(tree.files).toEqual([]);
21
- }));
13
+ });
22
14
  });
23
15
  //# 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,6BAA6B;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,GAAS,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,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
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"}
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "inDirectory": {
38
38
  "type": "boolean",
39
+ "default": true,
39
40
  "x-prompt": "Are you currently in the directory where you want to generate the entity? (typically directly in src/app/core/store)"
40
41
  }
41
42
  },
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  strategy:
17
17
  matrix:
18
- node-version: [18.x]
18
+ node-version: [22.x]
19
19
 
20
20
  steps:
21
21
  - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
@@ -134,5 +134,31 @@
134
134
  }
135
135
  }
136
136
  }
137
+ },
138
+ "schematics": {
139
+ "@schematics/angular:component": {
140
+ "type": "component"
141
+ },
142
+ "@schematics/angular:directive": {
143
+ "type": "directive"
144
+ },
145
+ "@schematics/angular:service": {
146
+ "type": "service"
147
+ },
148
+ "@schematics/angular:guard": {
149
+ "typeSeparator": "."
150
+ },
151
+ "@schematics/angular:interceptor": {
152
+ "typeSeparator": "."
153
+ },
154
+ "@schematics/angular:module": {
155
+ "typeSeparator": "."
156
+ },
157
+ "@schematics/angular:pipe": {
158
+ "typeSeparator": "."
159
+ },
160
+ "@schematics/angular:resolver": {
161
+ "typeSeparator": "."
162
+ }
137
163
  }
138
164
  }
@@ -0,0 +1,97 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all,
13
+ });
14
+
15
+ export default defineConfig([
16
+ // Global ignore
17
+ globalIgnores(["projects/**/*"]),
18
+
19
+ // TypeScript files
20
+ {
21
+ files: ["**/*.ts"],
22
+ extends: compat.extends(
23
+ "plugin:@angular-eslint/recommended",
24
+ "plugin:@angular-eslint/template/process-inline-templates",
25
+ "eslint:recommended",
26
+ "plugin:@typescript-eslint/recommended",
27
+ "google"
28
+ ),
29
+ languageOptions: {
30
+ ecmaVersion: 2020,
31
+ sourceType: "module",
32
+ parserOptions: {
33
+ project: ["tsconfig.json"],
34
+ createDefaultProgram: true,
35
+ },
36
+ },
37
+ rules: {
38
+ "@angular-eslint/component-selector": [
39
+ "error",
40
+ { prefix: "app", style: "kebab-case", type: "element" }
41
+ ],
42
+ "@angular-eslint/directive-selector": [
43
+ "error",
44
+ { prefix: "app", style: "camelCase", type: "attribute" }
45
+ ],
46
+ "@angular-eslint/no-empty-lifecycle-method": "off",
47
+ "@typescript-eslint/no-empty-function": "off",
48
+ "@typescript-eslint/no-unused-vars": "off",
49
+ "@typescript-eslint/no-inferrable-types": "off",
50
+ "@typescript-eslint/no-empty-interface": "off",
51
+ "@angular-eslint/prefer-inject": "off",
52
+ "@typescript-eslint/no-empty-object-type": "off",
53
+ "max-len": "off",
54
+ "require-jsdoc": "off",
55
+ "valid-jsdoc": "off",
56
+ "no-unused-vars": "off",
57
+ "new-cap": "off",
58
+ "object-curly-spacing": ["error", "always"],
59
+ "quotes": ["error", "single", { allowTemplateLiterals: true, avoidEscape: true }],
60
+ "spaced-comment": ["error", "always", {
61
+ line: { markers: ["/"], exceptions: ["-", "+"] },
62
+ block: { markers: ["!"], exceptions: ["*"], balanced: true },
63
+ }],
64
+ "indent": "off",
65
+ "@/indent": [
66
+ "error", 2, {
67
+ CallExpression: { arguments: 1 },
68
+ MemberExpression: "off",
69
+ ObjectExpression: 1,
70
+ ArrayExpression: 1,
71
+ SwitchCase: 1,
72
+ FunctionDeclaration: { body: 1, parameters: 1 },
73
+ FunctionExpression: { body: 1, parameters: 1 },
74
+ ignoredNodes: [
75
+ "ConditionalExpression",
76
+ "FunctionExpression > .params[decorators.length > 0]",
77
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
78
+ "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
79
+ ]
80
+ }
81
+ ]
82
+ }
83
+ },
84
+
85
+ // Special TS overrides
86
+ {
87
+ files: [
88
+ "**/*.spec.ts",
89
+ "src/app/core/store/**/*.service.ts",
90
+ "src/app/core/firebase/*.service.ts",
91
+ "src/app/core/analytics/time-analytics.service.ts",
92
+ ],
93
+ rules: {
94
+ "@typescript-eslint/no-explicit-any": "off"
95
+ }
96
+ },
97
+ ]);
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "<%= dasherize(project) %>",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "build": "ng build",
9
+ "watch": "ng build --watch --configuration development",
10
+ "test": "jest",
11
+ "test:watch": "jest --watch",
12
+ "test:coverage": "jest --coverage",
13
+ "lint": "ng lint",
14
+ "lintfix": "ng lint --fix"
15
+ },
16
+ "private": true,
17
+ "dependencies": {
18
+ "@angular/animations": "^20.3.0",
19
+ "@angular/cdk": "^20.2.3",
20
+ "@angular/common": "^20.3.0",
21
+ "@angular/compiler": "^20.3.0",
22
+ "@angular/core": "^20.3.0",
23
+ "@angular/fire": "^20.0.1",
24
+ "@angular/forms": "^20.3.0",
25
+ "@angular/material": "^20.2.3",
26
+ "@angular/platform-browser": "^20.3.0",
27
+ "@angular/platform-browser-dynamic": "^20.3.0",
28
+ "@angular/router": "^20.3.0",
29
+ "@ngrx/signals": "^20.0.1",
30
+ "core-js": "^3.37.1",
31
+ "cross-fetch": "^4.0.0",
32
+ "crypto-es": "^2.1.0",
33
+ "dotenv": "^17.2.2",
34
+ "eslint": "^9.35.0",
35
+ "globalthis": "^1.0.4",
36
+ "proxy-polyfill": "^0.3.2",
37
+ "rxjs": "~7.8.0",
38
+ "tslib": "^2.3.0",
39
+ "zone.js": "~0.15.1"
40
+ },
41
+ "devDependencies": {
42
+ "@angular-devkit/build-angular": "^20.3.2",
43
+ "@angular-eslint/builder": "^20.3.0",
44
+ "@angular-eslint/eslint-plugin": "^20.3.0",
45
+ "@angular-eslint/eslint-plugin-template": "^20.3.0",
46
+ "@angular-eslint/schematics": "^20.3.0",
47
+ "@angular-eslint/template-parser": "^20.3.0",
48
+ "@angular/cli": "^20.3.2",
49
+ "@angular/compiler-cli": "^20.3.0",
50
+ "@ngx-env/builder": "^20.1.1",
51
+ "@tech4good/angular-schematics": "^20.2.0",
52
+ "@types/estree": "^1.0.0",
53
+ "@types/jest": "^29.5.14",
54
+ "@types/node": "^18.19.47",
55
+ "@typescript-eslint/eslint-plugin": "^8.44.0",
56
+ "@typescript-eslint/parser": "^8.44.0",
57
+ "@typescript-eslint/types": "^8.44.0",
58
+ "@typescript-eslint/utils": "^8.44.0",
59
+ "@testing-library/angular": "^17.3.6",
60
+ "@testing-library/jest-dom": "^6.6.3",
61
+ "@testing-library/user-event": "^14.6.1",
62
+ "eslint-config-google": "^0.14.0",
63
+ "jest": "^29.7.0",
64
+ "jest-environment-jsdom": "^29.7.0",
65
+ "jest-preset-angular": "^14.5.1",
66
+ "typescript": "~5.8.3",
67
+ "ts-jest": "^29.3.4",
68
+ "ts-jest-mock-import-meta": "^1.3.0",
69
+ "ts-node": "^10.9.2"
70
+ }
71
+ }
@@ -0,0 +1,37 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { AdminPanelComponent } from './admin-panel.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+
10
+ /** Sets up the testing environment for AdminPanelComponent using render.*/
11
+ async function setup() {
12
+ const user = userEvent.setup();
13
+ const checkedSpy = jest.fn();
14
+
15
+ const view = await render(AdminPanelComponent, {
16
+ imports: [],
17
+ providers: [
18
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
19
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
20
+ ],
21
+ componentInputs: {},
22
+ on: {},
23
+ });
24
+
25
+ return {
26
+ user,
27
+ fixture: view.fixture,
28
+ rerender: () => view.rerender(), // add component inputs if needed
29
+ };
30
+ }
31
+
32
+ describe('AdminPanelComponent', () => {
33
+ it('should create', async () => {
34
+ const { fixture } = await setup();
35
+ expect(fixture.componentInstance).toBeTruthy();
36
+ });
37
+ });
@@ -19,7 +19,6 @@ type UpdateValueTypes = AccessState;
19
19
  styleUrls: ['./admin-panel.component.scss'],
20
20
  changeDetection: ChangeDetectionStrategy.OnPush,
21
21
  animations: AdminPanelAnimations,
22
- standalone: true,
23
22
  imports: [
24
23
  MatTable,
25
24
  MatColumnDef,
@@ -0,0 +1,39 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { AppComponent } from './app.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+ import { LOG_SERVICE, LogInDevService } from './core/analytics/log.service';
10
+
11
+ /** Sets up the testing environment for AppComponent using render.*/
12
+ async function setup() {
13
+ const user = userEvent.setup();
14
+ const checkedSpy = jest.fn();
15
+
16
+ const view = await render(AppComponent, {
17
+ imports: [],
18
+ providers: [
19
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
20
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
21
+ { provide: LOG_SERVICE, useClass: LogInDevService },
22
+ ],
23
+ componentInputs: {},
24
+ on: {},
25
+ });
26
+
27
+ return {
28
+ user,
29
+ fixture: view.fixture,
30
+ rerender: () => view.rerender(), // add component inputs if needed
31
+ };
32
+ }
33
+
34
+ describe('AppComponent', () => {
35
+ it('should create the app', async () => {
36
+ const { fixture } = await setup();
37
+ expect(fixture.componentInstance).toBeTruthy();
38
+ });
39
+ });
@@ -10,7 +10,6 @@ import { RedeploymentWarningComponent } from './shared/redeployment-warning/rede
10
10
  selector: 'app-root',
11
11
  templateUrl: './app.component.html',
12
12
  styleUrls: ['./app.component.scss'],
13
- standalone: true,
14
13
  imports: [
15
14
  RedeploymentWarningComponent,
16
15
  RouterOutlet,
@@ -257,26 +257,11 @@ export class CachedListenersService {
257
257
  .filter((dc) => dc.type === 'modified' && dc.docData['_deleted'])
258
258
  .map((dc) => dc.docData['__id']);
259
259
 
260
- // Handle changes of the 'removed' type. In general, firebase 'removed'
261
- // could be due to no longer matching the stream query rather than being
262
- // deleted from the DB. this is why we use soft deletes (set _deleted to true)
263
- // so technically we shouldn't be getting any 'removed' entries. however,
264
- // if there were manual deletions in the database, there could still be changes
265
- // of this type which the below code seeks to handle
266
- const entitiesToModify2 = fbPayload
267
- .filter((dc) => dc.type === 'removed' && !entityInQueryResults(dc.docData, queryParams, queryOptions))
268
- .map((dc) => dc.docData);
269
-
270
-
271
- const entitiesToRemove2 = fbPayload
272
- .filter((dc) => dc.type === 'removed' && entityInQueryResults(dc.docData, queryParams, queryOptions))
273
- .map((dc) => dc.docData['__id']);
274
-
275
260
  // Patch all the changes to the store
276
261
  store.handleStreamChanges(
277
262
  entitiesToAdd,
278
- [...entitiesToModify, ...entitiesToModify2],
279
- [...entitiesToRemove, ...entitiesToRemove2],
263
+ entitiesToModify,
264
+ entitiesToRemove,
280
265
  );
281
266
  });
282
267
 
@@ -1,6 +1,6 @@
1
1
  import { Injectable, inject, Injector, computed } from '@angular/core';
2
2
  import { toObservable } from '@angular/core/rxjs-interop';
3
- import { Observable, combineLatest, merge, of, from, pipe } from 'rxjs';
3
+ import { Observable, combineLatest, merge, of, from, pipe, BehaviorSubject } from 'rxjs';
4
4
  import { tap, pluck, mergeMap, pairwise, delay, startWith, filter, takeUntil, skip, switchMap, map, take } from 'rxjs/operators';
5
5
  import { environment } from '../../../environments/environment';
6
6
  import { DocumentSnapshot, serverTimestamp, Timestamp, getDoc, getDocs, doc, setDoc, updateDoc, deleteDoc, docData, collection, collectionData, collectionChanges, query, where, orderBy, OrderByDirection, limit, startAt, startAfter, endAt, endBefore, DocumentChange, increment, AggregateQuerySnapshot, AggregateField, AggregateSpec, getAggregateFromServer, getCountFromServer } from '@angular/fire/firestore';
@@ -24,7 +24,7 @@ export class FirebaseMockService implements DatabaseService {
24
24
  'users': inject(UserMockDB),
25
25
  'userContexts': inject(UserContextMockDB),
26
26
  };
27
- private user$ = toObservable(this.authDB.user);
27
+ private user$ = new BehaviorSubject(this.authDB.user());
28
28
 
29
29
  // Constant for simulating delay (e.g. to see loading icon in action)
30
30
  GET_LATENCY_SIMULATION_DELAY = 100;
@@ -58,6 +58,7 @@ export class FirebaseMockService implements DatabaseService {
58
58
 
59
59
  async login(providerId, scope?: string): Promise<any> {
60
60
  this.authDB.login();
61
+ this.user$.next(this.authDB.user());
61
62
  return {
62
63
  user: {
63
64
  uid: USER_DB[0].__id,
@@ -72,6 +73,7 @@ export class FirebaseMockService implements DatabaseService {
72
73
 
73
74
  logout() {
74
75
  this.authDB.logout();
76
+ this.user$.next(this.authDB.user());
75
77
  }
76
78
 
77
79
  streamEntity<T>(collectionName: string, id: string) {
@@ -33,7 +33,9 @@ export class FirebaseService implements DatabaseService {
33
33
  }
34
34
 
35
35
  afUser(): Observable<User> {
36
- return this.user$;
36
+ return from(this.afAuth.authStateReady()).pipe(
37
+ switchMap(() => this.user$)
38
+ );
37
39
  }
38
40
 
39
41
  login(providerId, scope?: string): any {
@@ -1,19 +1,25 @@
1
1
  import { signalStore, patchState, withState, withMethods, signalStoreFeature } from '@ngrx/signals';
2
2
  import { USER_DB } from '../user/user.mock';
3
3
 
4
+ const savedUser = localStorage.getItem('mockUser');
5
+ const initialUser = savedUser ? JSON.parse(savedUser) : null;
6
+
4
7
  export const AuthMockDB = signalStore(
5
8
  { providedIn: 'root' },
6
- withState({ user: null }),
9
+ withState({ user: initialUser }),
7
10
  withMethods((store) => ({
8
11
  login() {
9
- patchState(store, { user: {
12
+ const userToLogin = {
10
13
  uid: USER_DB[0].__id,
11
14
  email: USER_DB[0].email,
12
15
  displayName: USER_DB[0].name,
13
16
  photoURL: USER_DB[0].photoURL,
14
- } });
17
+ };
18
+ localStorage.setItem('mockUser', JSON.stringify(userToLogin));
19
+ patchState(store, { user: userToLogin });
15
20
  },
16
21
  logout() {
22
+ localStorage.removeItem('mockUser');
17
23
  patchState(store, { user: null });
18
24
  },
19
25
  })),
@@ -0,0 +1,37 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { ConsentComponent } from './consent.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+
10
+ /** Sets up the testing environment for ConsentComponent using render.*/
11
+ async function setup() {
12
+ const user = userEvent.setup();
13
+ const checkedSpy = jest.fn();
14
+
15
+ const view = await render(ConsentComponent, {
16
+ imports: [],
17
+ providers: [
18
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
19
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
20
+ ],
21
+ componentInputs: {},
22
+ on: {},
23
+ });
24
+
25
+ return {
26
+ user,
27
+ fixture: view.fixture,
28
+ rerender: () => view.rerender(), // add component inputs if needed
29
+ };
30
+ }
31
+
32
+ describe('ConsentComponent', () => {
33
+ it('should create', async () => {
34
+ const { fixture } = await setup();
35
+ expect(fixture.componentInstance).toBeTruthy();
36
+ });
37
+ });
@@ -17,7 +17,6 @@ import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
17
17
  styleUrls: ['./consent.component.scss'],
18
18
  changeDetection: ChangeDetectionStrategy.OnPush,
19
19
  animations: ConsentAnimations,
20
- standalone: true,
21
20
  imports: [
22
21
  ReactiveFormsModule,
23
22
  NavbarComponent,
@@ -0,0 +1,40 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { EarlyAccessComponent } from './early-access.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+ import { AuthStore } from 'src/app/core/store/auth/auth.store';
10
+ import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
11
+
12
+ /** Sets up the testing environment for EarlyAccessComponent using render.*/
13
+ async function setup() {
14
+ const user = userEvent.setup();
15
+ const checkedSpy = jest.fn();
16
+
17
+ const view = await render(EarlyAccessComponent, {
18
+ imports: [],
19
+ providers: [
20
+ { provide: AuthStore, useClass: AuthLoggedInMockDB }, // Needed to use `currentUser()`
21
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
22
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
23
+ ],
24
+ componentInputs: {},
25
+ on: {},
26
+ });
27
+
28
+ return {
29
+ user,
30
+ fixture: view.fixture,
31
+ rerender: () => view.rerender(), // add component inputs if needed
32
+ };
33
+ }
34
+
35
+ describe('EarlyAccessComponent', () => {
36
+ it('should create', async () => {
37
+ const { fixture } = await setup();
38
+ expect(fixture.componentInstance).toBeTruthy();
39
+ });
40
+ });
@@ -15,7 +15,7 @@ import { UserContextStore } from 'src/app/core/store/user-context/user-context.s
15
15
  import { MatProgressSpinner } from '@angular/material/progress-spinner';
16
16
  import { MatInput } from '@angular/material/input';
17
17
  import { MatCheckbox } from '@angular/material/checkbox';
18
- import { NgFor, AsyncPipe } from '@angular/common';
18
+ import { AsyncPipe } from '@angular/common';
19
19
  import { MatLabel, MatFormField, MatError, MatHint } from '@angular/material/form-field';
20
20
  import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
21
21
  import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
@@ -26,13 +26,11 @@ import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
26
26
  styleUrls: ['./early-access.component.scss'],
27
27
  changeDetection: ChangeDetectionStrategy.OnPush,
28
28
  animations: EarlyAccessAnimations,
29
- standalone: true,
30
29
  imports: [
31
30
  NavbarComponent,
32
31
  FormsModule,
33
32
  MatLabel,
34
33
  ReactiveFormsModule,
35
- NgFor,
36
34
  MatCheckbox,
37
35
  MatFormField,
38
36
  MatInput,
@@ -0,0 +1,37 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { LandingComponent } from './landing.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+
10
+ /** Sets up the testing environment for LandingComponent using render.*/
11
+ async function setup() {
12
+ const user = userEvent.setup();
13
+ const checkedSpy = jest.fn();
14
+
15
+ const view = await render(LandingComponent, {
16
+ imports: [],
17
+ providers: [
18
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
19
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
20
+ ],
21
+ componentInputs: {},
22
+ on: {},
23
+ });
24
+
25
+ return {
26
+ user,
27
+ fixture: view.fixture,
28
+ rerender: () => view.rerender(), // add component inputs if needed
29
+ };
30
+ }
31
+
32
+ describe('LandingComponent', () => {
33
+ it('should create', async () => {
34
+ const { fixture } = await setup();
35
+ expect(fixture.componentInstance).toBeTruthy();
36
+ });
37
+ });
@@ -9,7 +9,6 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
9
9
  styleUrls: ['./landing.component.scss'],
10
10
  changeDetection: ChangeDetectionStrategy.OnPush,
11
11
  animations: LandingAnimations,
12
- standalone: true,
13
12
  })
14
13
  export class LandingComponent implements OnInit {
15
14
  readonly authStore = inject(AuthStore);
@@ -0,0 +1,37 @@
1
+ import { render } from '@testing-library/angular';
2
+ import userEvent from '@testing-library/user-event';
3
+
4
+ import { LoginComponent } from './login.component';
5
+ import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
+ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
9
+
10
+ /** Sets up the testing environment for LoginComponent using render.*/
11
+ async function setup() {
12
+ const user = userEvent.setup();
13
+ const checkedSpy = jest.fn();
14
+
15
+ const view = await render(LoginComponent, {
16
+ imports: [],
17
+ providers: [
18
+ { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
19
+ { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
20
+ ],
21
+ componentInputs: {},
22
+ on: {},
23
+ });
24
+
25
+ return {
26
+ user,
27
+ fixture: view.fixture,
28
+ rerender: () => view.rerender(), // add component inputs if needed
29
+ };
30
+ }
31
+
32
+ describe('LoginComponent', () => {
33
+ it('should create', async () => {
34
+ const { fixture } = await setup();
35
+ expect(fixture.componentInstance).toBeTruthy();
36
+ });
37
+ });