@tech4good/angular-schematics 13.1.0 → 13.3.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 (33) hide show
  1. package/package.json +1 -1
  2. package/src/collection.json +11 -0
  3. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.actions.ts.template +270 -0
  4. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.effects.ts.template +131 -0
  5. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.model.ts.template +3 -0
  6. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +13 -0
  7. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +51 -0
  8. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.service.ts.template +50 -0
  9. package/src/entity-in-example/index.d.ts +2 -0
  10. package/src/entity-in-example/index.js +141 -0
  11. package/src/entity-in-example/index.js.map +1 -0
  12. package/src/entity-in-example/index_spec.d.ts +1 -0
  13. package/src/entity-in-example/index_spec.js +23 -0
  14. package/src/entity-in-example/index_spec.js.map +1 -0
  15. package/src/entity-in-example/schema.json +42 -0
  16. package/src/init/files/.eslintrc.json +120 -0
  17. package/src/init/files/.gitattributes +11 -0
  18. package/src/init/files/.github/workflows/angular-github-ci.yml.template +60 -0
  19. package/src/init/files/angular.json.template +132 -0
  20. package/src/init/files/package.json.template +60 -0
  21. package/src/init/files/src/app/app.component.html +3 -0
  22. package/src/init/files/src/app/app.component.scss +4 -0
  23. package/src/init/files/src/app/general/e404/e404.component.html +1 -0
  24. package/src/init/files/src/app/general/e404/e404.component.scss +0 -0
  25. package/src/init/files/src/app/general/login/login.component.html +11 -0
  26. package/src/init/files/src/app/general/login/login.component.scss +29 -0
  27. package/src/init/files/src/index.html.template +19 -0
  28. package/src/init/files/src/styles/_variables.scss +0 -0
  29. package/src/init/files/src/styles.scss +13 -0
  30. package/src/init/index.d.ts +2 -0
  31. package/src/init/index.js +50 -0
  32. package/src/init/index.js.map +1 -0
  33. package/src/init/schema.json +28 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.entity = void 0;
13
+ const schematics_1 = require("@angular-devkit/schematics");
14
+ const change_1 = require("@schematics/angular/utility/change");
15
+ const find_module_1 = require("@schematics/angular/utility/find-module");
16
+ const parse_name_1 = require("@schematics/angular/utility/parse-name");
17
+ const workspace_1 = require("@schematics/angular/utility/workspace");
18
+ const core_1 = require("@angular-devkit/core");
19
+ const statements_adder_1 = require("../shared/statements-adder");
20
+ function addInserts(options) {
21
+ return (host, context) => {
22
+ const classifiedName = core_1.strings.classify(options.name);
23
+ const camelizedName = core_1.strings.camelize(options.name);
24
+ context.logger.info(`names: ${classifiedName}, ${camelizedName}`);
25
+ // Add core module changes
26
+ const coreModulePath = options.module;
27
+ const coreModuleText = (0, statements_adder_1.getSourceText)(host, coreModulePath);
28
+ context.logger.info(`modulePath: ${coreModulePath}`);
29
+ const entityEffectsPath = `/${options.path}/` +
30
+ core_1.strings.dasherize(options.name) + '/' +
31
+ core_1.strings.dasherize(options.name) + '.effects';
32
+ context.logger.info(`entityEffectsPath: ${entityEffectsPath}`);
33
+ const coreToEffectsPath = (0, find_module_1.buildRelativePath)(coreModulePath, entityEffectsPath);
34
+ context.logger.info(`coreToEffectsPath: ${coreToEffectsPath}`);
35
+ let insertChangesInCore = (0, statements_adder_1.simpleInsert)(coreModuleText, coreModulePath, [
36
+ '// Entity Effects',
37
+ '// Entity Effects'
38
+ ], [
39
+ `import { ${classifiedName}Effects } from '${coreToEffectsPath}';`,
40
+ ` ${classifiedName}Effects,`
41
+ ]);
42
+ // Add app reducer changes
43
+ const appReducerPath = '//src/app/core/store/app.reducer.ts';
44
+ const appReducerText = (0, statements_adder_1.getSourceText)(host, appReducerPath);
45
+ context.logger.info(`appReducerPath: ${appReducerPath}`);
46
+ const entityReducerPath = `/${options.path}/` +
47
+ core_1.strings.dasherize(options.name) + '/' +
48
+ core_1.strings.dasherize(options.name) + '.reducer';
49
+ context.logger.info(`entityReducerPath: ${entityReducerPath}`);
50
+ const appToEntityReducerPath = (0, find_module_1.buildRelativePath)(appReducerPath, entityReducerPath);
51
+ let insertChangesInAppReducer = (0, statements_adder_1.simpleInsert)(appReducerText, appReducerPath, [
52
+ '// Entity Reducers',
53
+ '// Entity State',
54
+ '// Entity Reducers'
55
+ ], [
56
+ `import * as from${classifiedName} from '${appToEntityReducerPath}';`,
57
+ ` ${camelizedName}: from${classifiedName}.State;`,
58
+ ` ${camelizedName}: from${classifiedName}.reducer,`
59
+ ]);
60
+ // Add app selector changes
61
+ const appSelectorPath = '//src/app/core/store/app.selectors.ts';
62
+ const appSelectorText = (0, statements_adder_1.getSourceText)(host, appSelectorPath);
63
+ const entityServicePath = `/${options.path}/` +
64
+ core_1.strings.dasherize(options.name) + '/' +
65
+ core_1.strings.dasherize(options.name) + '.service';
66
+ const appToEntityServicePath = (0, find_module_1.buildRelativePath)(appSelectorPath, entityServicePath);
67
+ let insertChangesInAppSelector = (0, statements_adder_1.simpleInsert)(appSelectorText, appSelectorPath, [
68
+ '// Entity Selectors',
69
+ '// Entity Selectors',
70
+ '// Entity Selectors'
71
+ ], [
72
+ `import { ${classifiedName}Service } from '${appToEntityServicePath}';`,
73
+ ` private ${camelizedName}: ${classifiedName}Service,`,
74
+ ` public get${classifiedName} = this.${camelizedName}.get${classifiedName};\n public get${classifiedName}s = this.${camelizedName}.get${classifiedName}s;\n public select${classifiedName} = this.${camelizedName}.select${classifiedName};\n public select${classifiedName}s = this.${camelizedName}.select${classifiedName}s;`
75
+ ]);
76
+ // Add firebase service changes
77
+ const appFirebaseServicePath = '//src/app/core/firebase/firebase.service.ts';
78
+ const appFirebaseServiceText = (0, statements_adder_1.getSourceText)(host, appFirebaseServicePath);
79
+ const entityModelPath = `/${options.path}/` +
80
+ core_1.strings.dasherize(options.name) + '/' +
81
+ core_1.strings.dasherize(options.name) + '.model';
82
+ const appToEntityModelPath = (0, find_module_1.buildRelativePath)(appFirebaseServicePath, entityModelPath);
83
+ let insertChangesInFirebaseService = (0, statements_adder_1.simpleInsert)(appFirebaseServiceText, appFirebaseServicePath, [
84
+ '// Entity Models',
85
+ '// Entity Models'
86
+ ], [
87
+ `import { ${classifiedName} } from '${appToEntityModelPath}';`,
88
+ ` ${camelizedName}s: new BehaviorSubject<Array<{ type: string; result: ${classifiedName} }>>(
89
+ this.mockDBService.getInitialDBStateChanges('${camelizedName}s')
90
+ ),`
91
+ ]);
92
+ context.logger.info(`about to start committing`);
93
+ // For each of the files and corresponding set of changes, commit to the tree
94
+ [
95
+ [coreModulePath, insertChangesInCore],
96
+ [appReducerPath, insertChangesInAppReducer],
97
+ [appSelectorPath, insertChangesInAppSelector],
98
+ [appFirebaseServicePath, insertChangesInFirebaseService],
99
+ ].map(([filePath, insertChanges]) => {
100
+ const declarationRecorder = host.beginUpdate(filePath);
101
+ for (const change of insertChanges) {
102
+ if (change instanceof change_1.InsertChange) {
103
+ declarationRecorder.insertLeft(change.pos, change.toAdd);
104
+ }
105
+ }
106
+ host.commitUpdate(declarationRecorder);
107
+ });
108
+ return host;
109
+ };
110
+ }
111
+ function entity(options) {
112
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
113
+ // Make sure the command is executed in the directory where the component should be generated
114
+ if (!options.inDirectory) {
115
+ context.logger.info("Please navigate to the directory where you want to generate the entity.");
116
+ return (0, schematics_1.noop)();
117
+ }
118
+ const workspace = yield (0, workspace_1.getWorkspace)(tree);
119
+ const project = workspace.projects.get(options.project);
120
+ if (!project) {
121
+ throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
122
+ }
123
+ if (options.path === undefined) {
124
+ options.path = (0, workspace_1.buildDefaultPath)(project);
125
+ }
126
+ options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
127
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
128
+ options.name = parsedPath.name;
129
+ options.path = parsedPath.path;
130
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
131
+ (0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
132
+ (0, schematics_1.move)(parsedPath.path),
133
+ ]);
134
+ return (0, schematics_1.chain)([
135
+ addInserts(options),
136
+ (0, schematics_1.mergeWith)(templateSource)
137
+ ]);
138
+ });
139
+ }
140
+ exports.entity = entity;
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAIoC;AAEpC,+DAA0E;AAC1E,yEAAmG;AACnG,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,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,cAAc,KAAK,aAAa,EAAE,CAAC,CAAC;QAElE,0BAA0B;QAC1B,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;QACtC,MAAM,cAAc,GAAG,IAAA,gCAA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;AAvCD,wBAuCC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const schematics_1 = require("@angular-devkit/schematics");
13
+ const testing_1 = require("@angular-devkit/schematics/testing");
14
+ const path = require("path");
15
+ const collectionPath = path.join(__dirname, '../collection.json');
16
+ describe('entity', () => {
17
+ it('works', () => __awaiter(void 0, void 0, void 0, function* () {
18
+ const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
19
+ const tree = yield runner.runSchematicAsync('entity', {}, schematics_1.Tree.empty()).toPromise();
20
+ expect(tree.files).toEqual([]);
21
+ }));
22
+ });
23
+ //# sourceMappingURL=index_spec.js.map
@@ -0,0 +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,iBAAiB,CAAC,QAAQ,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAEpF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "EntitySchema",
4
+ "title": "Entity Schema",
5
+ "type": "object",
6
+ "description": "Creates a new entity in the default project.",
7
+ "properties": {
8
+ "index": {
9
+ "type": "number",
10
+ "default": 1
11
+ },
12
+ "path": {
13
+ "type": "string",
14
+ "format": "path",
15
+ "description": "The path at which to create the entity file, relative to the current workspace. Should typically be within /src/app/core/store.",
16
+ "visible": false
17
+ },
18
+ "project": {
19
+ "type": "string",
20
+ "description": "The name of the project.",
21
+ "$default": {
22
+ "$source": "projectName"
23
+ }
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "description": "The name of the entity.",
28
+ "$default": {
29
+ "$source": "argv",
30
+ "index": 0
31
+ },
32
+ "x-prompt": "What name would you like to use for the entity?"
33
+ },
34
+ "inDirectory": {
35
+ "type": "boolean",
36
+ "x-prompt": "Are you currently in the directory where you want to generate the entity? (typically directly in src/app/core/store)"
37
+ }
38
+ },
39
+ "required": [
40
+ "name"
41
+ ]
42
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "root": true,
3
+ "ignorePatterns": [
4
+ "projects/**/*"
5
+ ],
6
+ "overrides": [
7
+ {
8
+ "files": [
9
+ "*.ts"
10
+ ],
11
+ "parserOptions": {
12
+ "project": [
13
+ "tsconfig.json"
14
+ ],
15
+ "createDefaultProgram": true
16
+ },
17
+ "extends": [
18
+ "plugin:@angular-eslint/recommended",
19
+ "plugin:@angular-eslint/template/process-inline-templates",
20
+ "eslint:recommended",
21
+ "plugin:@typescript-eslint/recommended",
22
+ "google"
23
+ ],
24
+ "rules": {
25
+ "@angular-eslint/component-selector": [
26
+ "error",
27
+ {
28
+ "prefix": "app",
29
+ "style": "kebab-case",
30
+ "type": "element"
31
+ }
32
+ ],
33
+ "@angular-eslint/directive-selector": [
34
+ "error",
35
+ {
36
+ "prefix": "app",
37
+ "style": "camelCase",
38
+ "type": "attribute"
39
+ }
40
+ ],
41
+ "@angular-eslint/no-empty-lifecycle-method": "off",
42
+ "@typescript-eslint/no-empty-function": "off",
43
+ "@typescript-eslint/no-unused-vars": "off",
44
+ "@typescript-eslint/no-inferrable-types": "off",
45
+ "@typescript-eslint/no-empty-interface": "off",
46
+ "max-len": "off",
47
+ "require-jsdoc": "off",
48
+ "valid-jsdoc": "off",
49
+ "no-unused-vars": "off",
50
+ "new-cap": "off",
51
+ "object-curly-spacing": ["error", "always"],
52
+ "quotes": ["error", "single", {
53
+ "allowTemplateLiterals": true,
54
+ "avoidEscape": true
55
+ }],
56
+ "spaced-comment": ["error", "always", {
57
+ "line": {
58
+ "markers": ["/"],
59
+ "exceptions": ["-", "+"]
60
+ },
61
+ "block": {
62
+ "markers": ["!"],
63
+ "exceptions": ["*"],
64
+ "balanced": true
65
+ }
66
+ }],
67
+ "indent": "off",
68
+ "@typescript-eslint/indent": [
69
+ "error", 2, {
70
+ "CallExpression": {
71
+ "arguments": 1
72
+ },
73
+ "MemberExpression": "off",
74
+ "ObjectExpression": 1,
75
+ "ArrayExpression": 1,
76
+ "SwitchCase": 1,
77
+ "FunctionDeclaration": {
78
+ "body": 1,
79
+ "parameters": 1
80
+ },
81
+ "FunctionExpression": {
82
+ "body": 1,
83
+ "parameters": 1
84
+ },
85
+ "ignoredNodes": [
86
+ "ConditionalExpression",
87
+ "FunctionExpression > .params[decorators.length > 0]",
88
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
89
+ "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
90
+ ]
91
+ }
92
+ ]
93
+ }
94
+ },
95
+ {
96
+ "files": [
97
+ "*.actions.ts",
98
+ "*.selectors.ts",
99
+ "*.spec.ts",
100
+ "*.effects.ts",
101
+ "src/app/core/store/**/*.service.ts",
102
+ "src/app/core/firebase/firebase.service.ts",
103
+ "src/app/core/analytics/time-analytics.service.ts",
104
+ "src/app/core/setup/module-import-guard.ts"
105
+ ],
106
+ "rules": {
107
+ "@typescript-eslint/no-explicit-any": "off"
108
+ }
109
+ },
110
+ {
111
+ "files": [
112
+ "*.html"
113
+ ],
114
+ "extends": [
115
+ "plugin:@angular-eslint/template/recommended"
116
+ ],
117
+ "rules": {}
118
+ }
119
+ ]
120
+ }
@@ -0,0 +1,11 @@
1
+ # Make it so that all files have LF line endings on checkout.
2
+ * text eol=lf
3
+
4
+ # Denote all files that are truly binary and should not be modified.
5
+ *.png binary
6
+ *.jpg binary
7
+ *.jpeg binary
8
+ *.svg binary
9
+ *.woff binary
10
+ *.ico binary
11
+ *.pdf binary
@@ -0,0 +1,60 @@
1
+ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run the linter on the relevant version of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: Angular Github CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ master ]
9
+ pull_request:
10
+ branches: [ master ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [16.x]
20
+
21
+ steps:
22
+ - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
23
+ - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
24
+ - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
25
+ - name: Check out repository code
26
+ uses: actions/checkout@v2
27
+ - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
28
+ - run: echo "🖥️ The workflow is now ready to test your code on the runner."
29
+ - name: Use Node.js ${{ matrix.node-version }}
30
+ uses: actions/setup-node@v2
31
+ with:
32
+ node-version: ${{ matrix.node-version }}
33
+ cache: 'npm'
34
+ - run: npm ci
35
+ - run: npm run build
36
+ - name: List files in distribution directory
37
+ run: |
38
+ ls -R ./dist
39
+ - run: npm run lint
40
+ - run: echo "🍏 This job's status is ${{ job.status }}."
41
+ - name: Send Slack notification on success
42
+ if: ${{ success() }}
43
+ uses: rtCamp/action-slack-notify@v2
44
+ env:
45
+ SLACK_CHANNEL: bots-<%= dasherize(project) %>
46
+ SLACK_USERNAME: Github Actions
47
+ SLACK_COLOR: ${{ job.status }}
48
+ SLACK_MESSAGE: ":white_check_mark: ${{ github.event_name }} ${{ job.status }} on ${{ github.ref_name }}"
49
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
50
+ MSG_MINIMAL: commit,actions url
51
+ - name: Send Slack notification on failure
52
+ if: ${{ failure() }}
53
+ uses: rtCamp/action-slack-notify@v2
54
+ env:
55
+ SLACK_CHANNEL: bots-<%= dasherize(project) %>
56
+ SLACK_USERNAME: Github Actions
57
+ SLACK_COLOR: ${{ job.status }}
58
+ SLACK_MESSAGE: ":x: ${{ github.event_name }} ${{ job.status }} on ${{ github.ref_name }}"
59
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
60
+ MSG_MINIMAL: commit,actions url
@@ -0,0 +1,132 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "cli": {
5
+ "cache": {
6
+ "enabled": true,
7
+ "path": ".cache",
8
+ "environment": "all"
9
+ },
10
+ "defaultCollection": "@tech4good/angular-schematics"
11
+ },
12
+ "newProjectRoot": "projects",
13
+ "projects": {
14
+ "<%= dasherize(project) %>": {
15
+ "projectType": "application",
16
+ "schematics": {
17
+ "@schematics/angular:component": {
18
+ "style": "scss"
19
+ },
20
+ },
21
+ "root": "",
22
+ "sourceRoot": "src",
23
+ "prefix": "app",
24
+ "architect": {
25
+ "build": {
26
+ "builder": "@angular-devkit/build-angular:browser",
27
+ "options": {
28
+ "outputPath": "dist/<%= dasherize(project) %>",
29
+ "index": "src/index.html",
30
+ "main": "src/main.ts",
31
+ "polyfills": "src/polyfills.ts",
32
+ "tsConfig": "tsconfig.app.json",
33
+ "inlineStyleLanguage": "scss",
34
+ "assets": [
35
+ "src/favicon.ico",
36
+ "src/assets"
37
+ ],
38
+ "styles": [
39
+ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
40
+ "src/styles.scss"
41
+ ],
42
+ "stylePreprocessorOptions": {
43
+ "includePaths": [
44
+ "src/styles"
45
+ ]
46
+ },
47
+ "scripts": []
48
+ },
49
+ "configurations": {
50
+ "production": {
51
+ "budgets": [
52
+ {
53
+ "type": "initial",
54
+ "maximumWarning": "2mb",
55
+ "maximumError": "5mb"
56
+ },
57
+ {
58
+ "type": "anyComponentStyle",
59
+ "maximumWarning": "2kb",
60
+ "maximumError": "4kb"
61
+ }
62
+ ],
63
+ "fileReplacements": [
64
+ {
65
+ "replace": "src/environments/environment.ts",
66
+ "with": "src/environments/environment.prod.ts"
67
+ }
68
+ ],
69
+ "outputHashing": "all"
70
+ },
71
+ "development": {
72
+ "buildOptimizer": false,
73
+ "optimization": false,
74
+ "vendorChunk": true,
75
+ "extractLicenses": false,
76
+ "sourceMap": true,
77
+ "namedChunks": true
78
+ }
79
+ },
80
+ "defaultConfiguration": "production"
81
+ },
82
+ "serve": {
83
+ "builder": "@angular-devkit/build-angular:dev-server",
84
+ "configurations": {
85
+ "production": {
86
+ "browserTarget": "<%= dasherize(project) %>:build:production"
87
+ },
88
+ "development": {
89
+ "browserTarget": "<%= dasherize(project) %>:build:development"
90
+ }
91
+ },
92
+ "defaultConfiguration": "development"
93
+ },
94
+ "extract-i18n": {
95
+ "builder": "@angular-devkit/build-angular:extract-i18n",
96
+ "options": {
97
+ "browserTarget": "<%= dasherize(project) %>:build"
98
+ }
99
+ },
100
+ "test": {
101
+ "builder": "@angular-devkit/build-angular:karma",
102
+ "options": {
103
+ "main": "src/test.ts",
104
+ "polyfills": "src/polyfills.ts",
105
+ "tsConfig": "tsconfig.spec.json",
106
+ "karmaConfig": "karma.conf.js",
107
+ "inlineStyleLanguage": "scss",
108
+ "assets": [
109
+ "src/favicon.ico",
110
+ "src/assets"
111
+ ],
112
+ "styles": [
113
+ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
114
+ "src/styles.scss"
115
+ ],
116
+ "scripts": []
117
+ }
118
+ },
119
+ "lint": {
120
+ "builder": "@angular-eslint/builder:lint",
121
+ "options": {
122
+ "lintFilePatterns": [
123
+ "src/**/*.ts",
124
+ "src/**/*.html"
125
+ ]
126
+ }
127
+ }
128
+ }
129
+ }
130
+ },
131
+ "defaultProject": "<%= dasherize(project) %>"
132
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "<%= dasherize(project) %>",
3
+ "version": "0.0.0",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build",
8
+ "watch": "ng build --watch --configuration development",
9
+ "test": "ng test",
10
+ "lint": "ng lint",
11
+ "lintfix": "ng lint --fix"
12
+ },
13
+ "private": true,
14
+ "dependencies": {
15
+ "@angular/animations": "~13.3.0",
16
+ "@angular/cdk": "^13.3.5",
17
+ "@angular/common": "~13.3.0",
18
+ "@angular/compiler": "~13.3.0",
19
+ "@angular/core": "~13.3.0",
20
+ "@angular/fire": "^7.3.0",
21
+ "@angular/forms": "~13.3.0",
22
+ "@angular/material": "^13.3.5",
23
+ "@angular/platform-browser": "~13.3.0",
24
+ "@angular/platform-browser-dynamic": "~13.3.0",
25
+ "@angular/router": "~13.3.0",
26
+ "@ngrx/effects": "^13.1.0",
27
+ "@ngrx/entity": "^13.1.0",
28
+ "@ngrx/router-store": "^13.1.0",
29
+ "@ngrx/store": "^13.1.0",
30
+ "@ngrx/store-devtools": "^13.1.0",
31
+ "@tech4good/angular-schematics": "^13.1.0",
32
+ "rxjs": "~7.5.0",
33
+ "tslib": "^2.3.0",
34
+ "zone.js": "~0.11.4"
35
+ },
36
+ "devDependencies": {
37
+ "@angular-devkit/build-angular": "~13.3.4",
38
+ "@angular-eslint/builder": "13.2.1",
39
+ "@angular-eslint/eslint-plugin": "13.2.1",
40
+ "@angular-eslint/eslint-plugin-template": "13.2.1",
41
+ "@angular-eslint/schematics": "13.2.1",
42
+ "@angular-eslint/template-parser": "13.2.1",
43
+ "@angular/cli": "~13.3.4",
44
+ "@angular/compiler-cli": "~13.3.0",
45
+ "@ngrx/schematics": "^13.1.0",
46
+ "@types/jasmine": "~3.10.0",
47
+ "@types/node": "^12.11.1",
48
+ "@typescript-eslint/eslint-plugin": "5.17.0",
49
+ "@typescript-eslint/parser": "5.17.0",
50
+ "eslint": "^8.12.0",
51
+ "eslint-config-google": "^0.14.0",
52
+ "jasmine-core": "~4.0.0",
53
+ "karma": "~6.3.0",
54
+ "karma-chrome-launcher": "~3.1.0",
55
+ "karma-coverage": "~2.1.0",
56
+ "karma-jasmine": "~4.0.0",
57
+ "karma-jasmine-html-reporter": "~1.7.0",
58
+ "typescript": "~4.6.2"
59
+ }
60
+ }
@@ -0,0 +1,3 @@
1
+ <div class="content-container">
2
+ <router-outlet></router-outlet>
3
+ </div>
@@ -0,0 +1,4 @@
1
+ .content-container {
2
+ height: 100%;
3
+ width: 100%;
4
+ }
@@ -0,0 +1 @@
1
+ Could not find the route you requested.
@@ -0,0 +1,11 @@
1
+ <div class="login-container">
2
+ <ng-container *ngIf="currentUser$ | async as user">
3
+ <img class="profile" [src]="user.photoURL" />
4
+ <h2>Hello {{user.name}}!</h2>
5
+ <input type="submit" value="Logout" (click)="logout$.next()">
6
+ </ng-container>
7
+ <ng-container *ngIf="(currentUser$ | async) === null">
8
+ <h2>Hello!</h2>
9
+ <input type="submit" value="Login" (click)="login$.next()">
10
+ </ng-container>
11
+ </div>