Skip to content

Commit 20ae737

Browse files
committed
updated ngx-material-tracking and ngx-material-navigation
1 parent a963152 commit 20ae737

File tree

6 files changed

+70
-20
lines changed

6 files changed

+70
-20
lines changed

eslint.config.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2+
import storybook from "eslint-plugin-storybook";
3+
14
import { configs } from 'eslint-config-service-soft';
25

36
// eslint-disable-next-line jsdoc/require-description
47
/** @type {import('eslint').Linter.Config} */
5-
export default [
6-
...configs,
7-
{
8-
ignores: ['src/__testing__/tmp/*', 'src/__testing__/coverage/*', 'sandbox']
9-
}
10-
];
8+
export default [...configs, {
9+
ignores: ['src/__testing__/tmp/*', 'src/__testing__/coverage/*', 'sandbox']
10+
}, ...storybook.configs["flat/recommended"], ...storybook.configs["flat/recommended"]];

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monux-cli",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"license": "MIT",
55
"main": "index.js",
66
"engines": {

src/angular/angular.utilities.ts

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { NpmPackage, NpmUtilities } from '../npm';
77
import { ArrayStartIdentifier, TsImportDefinition, TsUtilities } from '../ts';
88
import { AngularJson, AngularJsonAssetPattern } from './angular-json.model';
99
import { NgPackageJson } from './ng-package-json.model';
10-
import { ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_JSON_FILE_NAME, ANGULAR_ROUTES_FILE_NAME, APP_CONFIG_FILE_NAME, ENVIRONMENT_MODEL_TS_FILE_NAME, ROBOTS_FILE_NAME, SITEMAP_FILE_NAME } from '../constants';
10+
import { ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_JSON_FILE_NAME, ANGULAR_ROUTES_FILE_NAME, ANGULAR_SERVER_ROUTES_FILE_NAME, APP_CONFIG_FILE_NAME, APP_CONFIG_SERVER_FILE_NAME, ENVIRONMENT_MODEL_TS_FILE_NAME, ROBOTS_FILE_NAME, SITEMAP_FILE_NAME } from '../constants';
1111
import { DefaultEnvKeys, EnvUtilities } from '../env';
1212
import { DeepPartial } from '../types';
1313
import { AddNavElementConfig } from './add-nav-element-config.model';
@@ -462,6 +462,19 @@ export abstract class AngularUtilities {
462462
* @param root - The root of the angular project to setup material for.
463463
*/
464464
static async setupMaterial(root: string): Promise<void> {
465+
await AngularUtilities.setupBaseStyles(root);
466+
await FsUtilities.updateFile(
467+
getPath(root, 'src', 'styles.css'),
468+
'@import "@angular/material/prebuilt-themes/indigo-pink.css";',
469+
'prepend'
470+
);
471+
}
472+
473+
/**
474+
* Sets up the base styles.
475+
* @param root - The root of the project.
476+
*/
477+
static async setupBaseStyles(root: string): Promise<void> {
465478
await FsUtilities.updateFile(
466479
getPath(root, 'src', 'styles.css'),
467480
[
@@ -479,11 +492,6 @@ export abstract class AngularUtilities {
479492
],
480493
'append'
481494
);
482-
await FsUtilities.updateFile(
483-
getPath(root, 'src', 'styles.css'),
484-
'@import "@angular/material/prebuilt-themes/indigo-pink.css";',
485-
'prepend'
486-
);
487495
}
488496

489497
/**
@@ -623,12 +631,29 @@ export abstract class AngularUtilities {
623631
/**
624632
* Adds tracking to the angular project with the given name.
625633
* @param projectName - The name of the angular project to add tracking to.
634+
* @param root - The root dir of the project.
626635
*/
627-
static async setupTracking(projectName: string): Promise<void> {
636+
static async setupTracking(projectName: string, root: Path): Promise<void> {
628637
// eslint-disable-next-line no-console
629638
console.log('Adds tracking');
630639
await NpmUtilities.install(projectName, [NpmPackage.NGX_MATERIAL_TRACKING]);
631640
// TODO: Angular Tracking
641+
await this.addProvider(
642+
root,
643+
{
644+
provide: 'NGX_TRACKING_SNACKBAR_COMPONENT',
645+
useValue: 'SnackbarComponent'
646+
},
647+
[{ defaultImport: false, element: 'SnackbarComponent', path: NpmPackage.NGX_MATERIAL_TRACKING }]
648+
);
649+
await this.addProvider(
650+
root,
651+
{
652+
provide: 'NGX_GDPR_TRACKINGS',
653+
useValue: []
654+
},
655+
[{ defaultImport: false, element: 'NGX_GDPR_TRACKINGS', path: NpmPackage.NGX_MATERIAL_TRACKING }]
656+
);
632657
}
633658

634659
/**
@@ -683,11 +708,12 @@ export abstract class AngularUtilities {
683708
getPath(root, 'src', 'app', 'app.html'),
684709
[
685710
// eslint-disable-next-line stylistic/max-len
686-
'<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'30%\'" [minHeightOtherElements]="70" [navbarRows]="navbarRows">',
711+
'<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'40%\'" [minHeightOtherElements]="150" [navbarRows]="navbarRows">',
712+
'\t<ngx-mat-navigation-breadcrumbs></ngx-mat-navigation-breadcrumbs>',
687713
'\t<router-outlet></router-outlet>',
688714
'</ngx-mat-navigation-navbar>',
689715
'',
690-
'<ngx-mat-navigation-footer [minHeight]="70" [footerRows]="footerRows"></ngx-mat-navigation-footer>'
716+
'<ngx-mat-navigation-footer [minHeight]="150" [footerRows]="footerRows"></ngx-mat-navigation-footer>'
691717
],
692718
'append'
693719
);
@@ -704,6 +730,11 @@ export abstract class AngularUtilities {
704730
element: 'NgxMatNavigationFooterComponent',
705731
path: NpmPackage.NGX_MATERIAL_NAVIGATION,
706732
defaultImport: false
733+
},
734+
{
735+
element: 'NgxMatNavigationBreadcrumbsComponent',
736+
path: NpmPackage.NGX_MATERIAL_NAVIGATION,
737+
defaultImport: false
707738
}
708739
]
709740
);
@@ -742,6 +773,15 @@ export abstract class AngularUtilities {
742773
await FsUtilities.updateFile(appComponentTs, tsLines, 'replace');
743774

744775
const routesTs: Path = getPath(root, 'src', 'app', ANGULAR_ROUTES_FILE_NAME);
776+
await FsUtilities.rename(
777+
getPath(root, 'src', 'app', 'app.routes.server.ts'),
778+
getPath(root, 'src', 'app', ANGULAR_SERVER_ROUTES_FILE_NAME)
779+
);
780+
await FsUtilities.replaceAllInFile(
781+
getPath(root, 'src', 'app', APP_CONFIG_SERVER_FILE_NAME),
782+
'import { serverRoutes } from \'./app.routes.server\';',
783+
'import { serverRoutes } from \'./server.routes\';'
784+
);
745785
await FsUtilities.rename(
746786
getPath(root, 'src', 'app', 'app.routes.ts'),
747787
routesTs

src/commands/add/add-angular-website/add-angular-website.command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
109109
getPath(root, ANGULAR_JSON_FILE_NAME),
110110
{ $schema: '../../node_modules/@angular/cli/lib/config/schema.json' }
111111
);
112-
await AngularUtilities.setupMaterial(root);
112+
await AngularUtilities.setupBaseStyles(root);
113113
await EnvUtilities.setupProjectEnvironment(root, false);
114114
await this.createDefaultPages(root, config.titleSuffix, domain);
115115
if (config.addTracking) {
116-
await AngularUtilities.setupTracking(config.name);
116+
await AngularUtilities.setupTracking(config.name, root);
117117
}
118118
await NpmUtilities.updatePackageJson(config.name, { scripts: { start: `ng serve --port ${config.port}` }, prettier: undefined });
119119
const app: WorkspaceProject = await WorkspaceUtilities.findProjectOrFail(config.name, getPath('.'));

src/constants.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ export const ANGULAR_JSON_FILE_NAME: string = 'angular.json';
111111
*/
112112
export const ANGULAR_ROUTES_FILE_NAME: string = 'routes.ts';
113113

114+
/**
115+
* The name of the angular server routes file.
116+
*/
117+
export const ANGULAR_SERVER_ROUTES_FILE_NAME: string = 'server.routes.ts';
118+
114119
/**
115120
* The name of the angular app component file.
116121
*/
@@ -136,6 +141,11 @@ export const SITEMAP_FILE_NAME: string = 'sitemap.xml';
136141
*/
137142
export const APP_CONFIG_FILE_NAME: string = 'app.config.ts';
138143

144+
/**
145+
* The name of the angular app server config file.
146+
*/
147+
export const APP_CONFIG_SERVER_FILE_NAME: string = 'app.config.server.ts';
148+
139149
/**
140150
* The name of the angular ng package file.
141151
*/

0 commit comments

Comments
 (0)