@tech4good/angular-schematics 18.0.5 → 20.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.
- package/README.md +9 -14
- package/package.json +10 -9
- package/src/collection.json +3 -3
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +29 -17
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -1
- package/src/component/index.js +8 -15
- package/src/component/index.js.map +1 -1
- package/src/component/index_spec.js +5 -13
- package/src/component/index_spec.js.map +1 -1
- package/src/entity/index.js +8 -15
- package/src/entity/index.js.map +1 -1
- package/src/entity/index_spec.js +5 -13
- package/src/entity/index_spec.js.map +1 -1
- package/src/{init → ng-add}/files/.github/workflows/angular-github-ci.yml.template +1 -1
- package/src/{init → ng-add}/files/README.md.template +4 -0
- package/src/{init → ng-add}/files/angular.json.template +27 -1
- package/src/ng-add/files/eslint.config.js.template +97 -0
- package/src/ng-add/files/jest.config.ts.template +76 -0
- package/src/ng-add/files/package.json.template +71 -0
- package/src/ng-add/files/setup-jest.ts.template +10 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.ts.template +0 -1
- package/src/ng-add/files/src/app/app.component.spec.ts.template +39 -0
- package/src/{init → ng-add}/files/src/app/app.component.ts.template +0 -1
- package/src/{init → ng-add}/files/src/app/core/firebase/firebase.mock.service.ts.template +4 -2
- package/src/{init → ng-add}/files/src/app/core/firebase/firebase.service.ts.template +3 -1
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +49 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.ts.template +0 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +40 -0
- package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.ts.template +1 -3
- package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.ts.template +0 -1
- package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/first-time/login/login.component.ts.template +0 -1
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.ts.template +0 -1
- package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/main/home/home.component.ts.template +0 -1
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +37 -0
- package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.ts.template +0 -1
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +30 -0
- package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +0 -1
- package/src/ng-add/files/src/environments/environment.test.ts.template +12 -0
- package/src/ng-add/files/src/main.ts.template +6 -0
- package/src/{init → ng-add}/files/tsconfig.app.json.template +1 -1
- package/src/ng-add/files/tsconfig.spec.json.template +19 -0
- package/src/{init → ng-add}/index.d.ts +1 -1
- package/src/{init → ng-add}/index.js +9 -16
- package/src/ng-add/index.js.map +1 -0
- package/src/{init → ng-add}/schema.json +2 -2
- package/src/shared/camelcase-formatter.js +1 -2
- package/src/shared/camelcase-formatter.js.map +1 -1
- package/src/shared/statements-adder.js +3 -4
- package/src/shared/statements-adder.js.map +1 -1
- package/tsconfig.json +10 -25
- package/src/init/files/.eslintrc.json.template +0 -120
- package/src/init/files/package.json.template +0 -64
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +0 -25
- package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +0 -20
- package/src/init/files/src/app/first-time/consent/consent.component.spec.ts.template +0 -25
- package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +0 -25
- package/src/init/files/src/app/first-time/landing/landing.component.spec.ts.template +0 -25
- package/src/init/files/src/app/first-time/login/login.component.spec.ts.template +0 -25
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +0 -25
- package/src/init/files/src/app/main/home/home.component.spec.ts.template +0 -25
- package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +0 -25
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +0 -24
- package/src/init/index.js.map +0 -1
- /package/src/{init → ng-add}/files/.firebaserc.template +0 -0
- /package/src/{init → ng-add}/files/.gitattributes.template +0 -0
- /package/src/{init → ng-add}/files/.gitignore.template +0 -0
- /package/src/{init → ng-add}/files/CODE_OF_CONDUCT.md.template +0 -0
- /package/src/{init → ng-add}/files/CONTRIBUTING.md.template +0 -0
- /package/src/{init → ng-add}/files/contributing-docs/coding-standards.md.template +0 -0
- /package/src/{init → ng-add}/files/contributing-docs/using-fixup-commits.md.template +0 -0
- /package/src/{init → ng-add}/files/public/images/close-x.svg +0 -0
- /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/admin/admin-panel/admin-panel.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/app.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/app.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/app.config.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/app.routes.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/analytics/log.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/analytics/time-analytics.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/auth/auth.guard.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/firebase/cached-listeners.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/firebase/database.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/local-storage/local-storage.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/local-storage/session-local-storage.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/local-storage/session.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/router/routing-state.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/app.model.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/app.store.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/auth/auth.store.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/batch-write.firebase.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/batch-write.mock.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/batch-write.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user/user.mock.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user/user.model.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user/user.store.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.mock.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.model.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/store/user-context/user-context.store.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/core/utils/rand.utils.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/consent/consent.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/early-access/early-access.model.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/landing/landing.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/login/login.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/login/login.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/first-time/onboarding/onboarding.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/main/home/home.animations.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/app/main/home/home.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/main/home/home.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/shared/navbar/navbar.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +0 -0
- /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.component.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/env.d.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/environments/environment.prod.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/environments/environment.ts.template +0 -0
- /package/src/{init → ng-add}/files/src/index.html.template +0 -0
- /package/src/{init → ng-add}/files/src/styles/_variables.scss.template +0 -0
- /package/src/{init → ng-add}/files/src/styles.scss.template +0 -0
- /package/src/{init → ng-add}/files/tsconfig.json.template +0 -0
package/README.md
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
# Angular Schematics
|
|
2
2
|
|
|
3
|
-
This repository is used to generate
|
|
3
|
+
This repository is used to generate components and entities for Angular projects.
|
|
4
4
|
|
|
5
5
|
### Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
1. Create a new Angular repo using the CLI,
|
|
14
|
-
2. Use `ng generate init` to add our base files to the new repo,
|
|
15
|
-
3. Then add database configuration parameters:
|
|
16
|
-
* Update the environments files with your firebase configs
|
|
17
|
-
* Update .firebaserc with the firebase projects you're deploying to
|
|
7
|
+
First set up a new repository:
|
|
8
|
+
1. Create a new Angular repo using the CLI
|
|
9
|
+
2. Add @techgood/angular-schematics using `ng add @tech4good/angular-schematics`
|
|
10
|
+
3. Add the newly generated base files and `git commit -am "build: install @tech4good/angular-schematics"`
|
|
11
|
+
4. Finally, add database configuration parameters, updating the environments files with your firebase configs and .firebaserc with the firebase projects you're deploying to
|
|
12
|
+
5. Change directories to the directory you want to generate the files and run `ng generate <schematic> <name>`, where `schematic` = component or entity (you could also use `ng generate @tech4good/angular-schematics:<schematic> <name>`)
|
|
18
13
|
|
|
19
14
|
### Developing
|
|
20
15
|
|
|
@@ -22,7 +17,7 @@ This repository is used to generate modules, containers, components, and entitie
|
|
|
22
17
|
2. Run `npm install -g @angular-devkit/schematics-cli` to install globally
|
|
23
18
|
3. Run `npm install`, `npm run build` & `npm link`
|
|
24
19
|
4. Run `npm link @tech4good/angular-schematics` in the Angular project directory
|
|
25
|
-
5. Run `ng generate @tech4good/angular-schematics:<schematic>` to generate files
|
|
20
|
+
5. Run `ng generate @tech4good/angular-schematics:<schematic>` to generate files
|
|
26
21
|
6. To test/debug new changes, run `npm run build` again before `ng generate ...`
|
|
27
22
|
|
|
28
23
|
### Testing
|
|
@@ -51,4 +46,4 @@ npm publish # will ask for a OTP (see Google Authenticator: npm)
|
|
|
51
46
|
That's it!
|
|
52
47
|
|
|
53
48
|
You can also use `npm version <version>` to update the version before publishing.
|
|
54
|
-
* Don't forget to also update `src/
|
|
49
|
+
* Don't forget to also update `src/ng-add/files/package.json.template` so that the latest version of `@tech4good/anguar-schematics` is being used in the dependencies.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tech4good/angular-schematics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.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",
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"schematics": "./src/collection.json",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@angular-devkit/core": "^
|
|
17
|
-
"@angular-devkit/schematics": "^
|
|
18
|
-
"@angular-devkit/schematics-cli": "^
|
|
19
|
-
"@schematics/angular": "^
|
|
20
|
-
"
|
|
16
|
+
"@angular-devkit/core": "^20.3.2",
|
|
17
|
+
"@angular-devkit/schematics": "^20.3.2",
|
|
18
|
+
"@angular-devkit/schematics-cli": "^20.3.2",
|
|
19
|
+
"@schematics/angular": "^20.3.0",
|
|
20
|
+
"inquirer": "^13.2.5",
|
|
21
|
+
"typescript": "~5.8.3"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@types/
|
|
24
|
-
"@types/
|
|
25
|
-
"jasmine": "^
|
|
24
|
+
"@types/jasmine": "~5.1.0",
|
|
25
|
+
"@types/node": "^18.19.47",
|
|
26
|
+
"jasmine": "^5.1.0"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/src/collection.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
3
|
"schematics": {
|
|
4
|
-
"
|
|
4
|
+
"ng-add": {
|
|
5
5
|
"description": "Setup initial lab infrastructure files.",
|
|
6
|
-
"factory": "./
|
|
7
|
-
"schema": "./
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
8
|
},
|
|
9
9
|
"component": {
|
|
10
10
|
"description": "Generate a new component.",
|
package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render } from '@testing-library/angular';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
|
|
3
4
|
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.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';
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
beforeEach(waitForAsync(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [<%= classify(name) %>Component],
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
}));
|
|
10
|
+
/** Sets up the testing environment for <%= classify(name) %>Component using render.*/
|
|
11
|
+
async function setup() {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const checkedSpy = jest.fn();
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const view = await render(<%= classify(name) %>Component, {
|
|
16
|
+
imports: [],
|
|
17
|
+
providers: [
|
|
18
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
19
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
20
|
+
],
|
|
21
|
+
componentInputs: {},
|
|
22
|
+
on: {},
|
|
20
23
|
});
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
return {
|
|
26
|
+
user,
|
|
27
|
+
fixture: view.fixture,
|
|
28
|
+
rerender: () => view.rerender(), // add component inputs if needed
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('<%= classify(name) %>Component', () => {
|
|
33
|
+
it('should create', async () => {
|
|
34
|
+
const { fixture } = await setup();
|
|
35
|
+
expect(fixture.componentInstance).toBeTruthy();
|
|
24
36
|
});
|
|
25
37
|
});
|
|
@@ -10,7 +10,6 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
10
10
|
styleUrls: ['./<%= dasherize(name) %>.component.scss'],
|
|
11
11
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
12
|
animations: <%= classify(name) %>Animations,
|
|
13
|
-
standalone: true,
|
|
14
13
|
imports: [
|
|
15
14
|
],
|
|
16
15
|
})
|
package/src/component/index.js
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
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 });
|
|
12
|
-
exports.component =
|
|
3
|
+
exports.component = component;
|
|
13
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
5
|
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
15
6
|
const validation_1 = require("@schematics/angular/utility/validation");
|
|
16
7
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
17
8
|
const core_1 = require("@angular-devkit/core");
|
|
18
9
|
function component(options) {
|
|
19
|
-
return (tree, context) =>
|
|
10
|
+
return async (tree, context) => {
|
|
20
11
|
// Make sure the command is executed in the directory where the component should be generated
|
|
21
12
|
if (!options.inDirectory) {
|
|
22
13
|
context.logger.info("Please navigate to the directory where you want to generate the component.");
|
|
23
14
|
return (0, schematics_1.noop)();
|
|
24
15
|
}
|
|
25
|
-
const workspace =
|
|
16
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
26
17
|
const project = workspace.projects.get(options.project);
|
|
27
18
|
if (!project) {
|
|
28
19
|
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
@@ -39,13 +30,15 @@ function component(options) {
|
|
|
39
30
|
context.logger.info(`options.selector: ${options.selector}`);
|
|
40
31
|
(0, validation_1.validateHtmlSelector)(options.selector);
|
|
41
32
|
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
42
|
-
(0, schematics_1.applyTemplates)(
|
|
33
|
+
(0, schematics_1.applyTemplates)({
|
|
34
|
+
...core_1.strings,
|
|
35
|
+
...options,
|
|
36
|
+
}),
|
|
43
37
|
(0, schematics_1.move)(parsedPath.path),
|
|
44
38
|
]);
|
|
45
39
|
return (0, schematics_1.chain)([
|
|
46
40
|
(0, schematics_1.mergeWith)(templateSource)
|
|
47
41
|
]);
|
|
48
|
-
}
|
|
42
|
+
};
|
|
49
43
|
}
|
|
50
|
-
exports.component = component;
|
|
51
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAWA,8BA0CC;AAr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AAI,CAAC;QAE/B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,IAAA,iCAAoB,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEvC,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,GAAG,cAAO;gBACV,GAAG,OAAO;aACX,CAAC;YACF,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,sBAAS,EAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -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('component', () => {
|
|
17
|
-
it('works', () =>
|
|
9
|
+
it('works', async () => {
|
|
18
10
|
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
-
const tree =
|
|
11
|
+
const tree = await runner.runSchematic('component', {}, 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":"
|
|
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"}
|
package/src/entity/index.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
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 });
|
|
12
|
-
exports.entity =
|
|
3
|
+
exports.entity = entity;
|
|
13
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
5
|
const change_1 = require("@schematics/angular/utility/change");
|
|
15
6
|
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
@@ -76,13 +67,13 @@ function addInserts(options) {
|
|
|
76
67
|
};
|
|
77
68
|
}
|
|
78
69
|
function entity(options) {
|
|
79
|
-
return (tree, context) =>
|
|
70
|
+
return async (tree, context) => {
|
|
80
71
|
// Make sure the command is executed in the directory where the component should be generated
|
|
81
72
|
if (!options.inDirectory) {
|
|
82
73
|
context.logger.info("Please navigate to the directory where you want to generate the entity.");
|
|
83
74
|
return (0, schematics_1.noop)();
|
|
84
75
|
}
|
|
85
|
-
const workspace =
|
|
76
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
86
77
|
const project = workspace.projects.get(options.project);
|
|
87
78
|
if (!project) {
|
|
88
79
|
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
@@ -94,14 +85,16 @@ function entity(options) {
|
|
|
94
85
|
options.name = parsedPath.name;
|
|
95
86
|
options.path = parsedPath.path;
|
|
96
87
|
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
97
|
-
(0, schematics_1.applyTemplates)(
|
|
88
|
+
(0, schematics_1.applyTemplates)({
|
|
89
|
+
...core_1.strings,
|
|
90
|
+
...options,
|
|
91
|
+
}),
|
|
98
92
|
(0, schematics_1.move)(parsedPath.path),
|
|
99
93
|
]);
|
|
100
94
|
return (0, schematics_1.chain)([
|
|
101
95
|
addInserts(options),
|
|
102
96
|
(0, schematics_1.mergeWith)(templateSource)
|
|
103
97
|
]);
|
|
104
|
-
}
|
|
98
|
+
};
|
|
105
99
|
}
|
|
106
|
-
exports.entity = entity;
|
|
107
100
|
//# sourceMappingURL=index.js.map
|
package/src/entity/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
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,GAAG,IAAA,gCAAa,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACvD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;QAErD,MAAM,eAAe,GACnB,IAAI,OAAO,CAAC,IAAI,GA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AAU,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,GAAG,cAAO;gBACV,GAAG,OAAO;aACX,CAAC;YACF,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,UAAU,CAAC,OAAO,CAAC;YACnB,IAAA,sBAAS,EAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/src/entity/index_spec.js
CHANGED
|
@@ -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', () =>
|
|
9
|
+
it('works', async () => {
|
|
18
10
|
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
-
const tree =
|
|
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":"
|
|
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"}
|
|
@@ -70,4 +70,8 @@ You can connect with us Lab through the following channels:
|
|
|
70
70
|
|
|
71
71
|
As can be clearly seen, our documents and the processes we aim to work towards are modeled after or directly taken from those of the [Angular team](https://github.com/angular/angular).
|
|
72
72
|
|
|
73
|
+
## Testing
|
|
74
|
+
|
|
75
|
+
If you want to run a testing file in the repo please run the command: npm test -- --silent=false {/$path_of_file_to_test}
|
|
76
|
+
|
|
73
77
|
**Love <%= classify(project) %>? Give our repo a star :star: :arrow_up:.**
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"builder": "@ngx-env/builder:extract-i18n"
|
|
103
103
|
},
|
|
104
104
|
"test": {
|
|
105
|
-
"builder": "@ngx-env/builder:
|
|
105
|
+
"builder": "@ngx-env/builder-angular:jest",
|
|
106
106
|
"options": {
|
|
107
107
|
"polyfills": [
|
|
108
108
|
"zone.js",
|
|
@@ -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,76 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
import { createDefaultEsmPreset } from 'ts-jest'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Jest configuration for Angular + TypeScript using ESM mode.
|
|
6
|
+
*
|
|
7
|
+
* Key decisions:
|
|
8
|
+
* - Uses `jest.config.ts` (standard since Jest v29) with ESM support via `ts-jest`.
|
|
9
|
+
* - `jest-preset-angular` handles Angular-specific transforms.
|
|
10
|
+
* - Enables ESM mode with `extensionsToTreatAsEsm` and `transform.useESM`.
|
|
11
|
+
* - Supports `import.meta.env` via `ts-jest-mock-import-meta`.
|
|
12
|
+
* - Transforms `.html` files and avoids ESM parsing issues in node_modules.
|
|
13
|
+
*
|
|
14
|
+
* References:
|
|
15
|
+
* - ts-jest ESM guide: https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
|
|
16
|
+
* - jest-preset-angular (Angular 13+): https://thymikee.github.io/jest-preset-angular/docs/guides/angular-13+
|
|
17
|
+
*/
|
|
18
|
+
const config: Config = {
|
|
19
|
+
...createDefaultEsmPreset(),
|
|
20
|
+
// Required to handle ESM properly
|
|
21
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
22
|
+
transform: {
|
|
23
|
+
'^.+\\.(ts|js|html|mjs)$': [
|
|
24
|
+
'jest-preset-angular',
|
|
25
|
+
{
|
|
26
|
+
useESM: true,
|
|
27
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
28
|
+
stringifyContentPathRegex: '\\.html$',
|
|
29
|
+
astTransformers: {
|
|
30
|
+
before: [
|
|
31
|
+
{
|
|
32
|
+
path: 'ts-jest-mock-import-meta',
|
|
33
|
+
options: {
|
|
34
|
+
metaObjectReplacement: {
|
|
35
|
+
env: {
|
|
36
|
+
NG_APP_FIREBASE_API_KEY: 'mock-api-key',
|
|
37
|
+
NG_APP_FIREBASE_LOGS_API_KEY: 'mock-logs-api-key',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
transformIgnorePatterns: [
|
|
48
|
+
'node_modules/(?!.*\\.mjs$|@angular|@ngrx|rxjs|crypto-es)',
|
|
49
|
+
],
|
|
50
|
+
moduleNameMapper: {
|
|
51
|
+
'^src/(.*)$': '<rootDir>/src/$1',
|
|
52
|
+
'^app/(.*)$': '<rootDir>/src/app/$1',
|
|
53
|
+
'^.*environment$': '<rootDir>/src/environments/environment.test.ts',
|
|
54
|
+
'^.*environment.prod$': '<rootDir>/src/environments/environment.test.ts',
|
|
55
|
+
},
|
|
56
|
+
testEnvironment: 'jsdom',
|
|
57
|
+
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
|
|
58
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
59
|
+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '<rootDir>/src/environments/environment.test.ts',],
|
|
60
|
+
collectCoverageFrom: [
|
|
61
|
+
'src/app/**/*.ts',
|
|
62
|
+
'!src/app/**/*.module.ts',
|
|
63
|
+
'!src/app/**/*.spec.ts',
|
|
64
|
+
],
|
|
65
|
+
coverageProvider: 'v8',
|
|
66
|
+
coverageThreshold: {
|
|
67
|
+
global: {
|
|
68
|
+
statements: 80,
|
|
69
|
+
branches: 80,
|
|
70
|
+
functions: 80,
|
|
71
|
+
lines: 80,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default config;
|