Skip to content

Commit 7537a20

Browse files
committed
2 parents 8d965d3 + 86e9de6 commit 7537a20

File tree

5 files changed

+36
-27
lines changed

5 files changed

+36
-27
lines changed

libs/mf-tools/src/lib/web-components/router-utils.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ export function endsWith(prefix: string): UrlMatcher {
2121
}
2222

2323
export function connectRouter(router: Router, useHash = false): void {
24-
let url: string;
25-
if (!useHash) {
26-
url = `${location.pathname.substr(1)}${location.search}`;
27-
router.navigateByUrl(url);
28-
window.addEventListener('popstate', () => {
29-
router.navigateByUrl(url);
30-
});
31-
} else {
32-
url = `${location.hash.substr(1)}${location.search}`;
33-
router.navigateByUrl(url);
34-
window.addEventListener('hashchange', () => {
35-
router.navigateByUrl(url);
36-
});
37-
}
24+
25+
let url: string;
26+
if (!useHash) {
27+
url = `${location.pathname.substring(1)}${location.search}`;
28+
router.navigateByUrl(url);
29+
window.addEventListener('popstate', () => {
30+
router.navigateByUrl(url);
31+
});
32+
}
33+
else {
34+
url = `${location.hash.substring(1)}${location.search}`;
35+
router.navigateByUrl(url);
36+
window.addEventListener('hashchange', () => {
37+
router.navigateByUrl(url);
38+
});
39+
}
3840
}

libs/mf-tools/src/lib/web-components/web-component-wrapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type WebComponentWrapperOptions = LoadRemoteModuleOptions & {
1717
};
1818

1919
@Component({
20+
// eslint-disable-next-line @angular-eslint/component-selector
2021
selector: 'mft-wc-wrapper',
2122
template: '<div #vc></div>',
2223
})

libs/mf/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ If you start from the scratch, `ng add` will take care of these settings.
7272

7373
### Nx
7474

75-
1. `npm install @angular-architects/module-federation`
76-
2. `ng g @angular-architects/module-federation:init`
75+
1. `npm install --save-dev @angular-architects/module-federation`
76+
2. `nx g @angular-architects/module-federation:init`
7777
3. Adjust the generated `webpack.config.js` file
7878
4. Repeat this for further projects in your workspace (if needed)
7979

libs/mf/src/server/colors.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const crypt = require('crypto');
2-
const chalk = require('chalk');
3-
const wordWrap = require('word-wrap');
1+
import crypt = require("crypto");
2+
import chalk = require("chalk");
3+
import wordWrap = require("word-wrap");
44

55
function correctColor(color: string): string {
66
let result = '';
@@ -23,13 +23,19 @@ function correctColor(color: string): string {
2323
return result;
2424
}
2525

26-
export function print(
27-
prefix: string,
28-
prefixSize: number,
29-
message: string,
30-
error = false
31-
): void {
32-
const hash = crypt.createHash('sha256').update(prefix).digest('hex');
26+
export function print(prefix: string, prefixSize: number, message: string, error = false): void {
27+
28+
const hash = crypt.createHash("sha256")
29+
.update(prefix)
30+
.digest("hex");
31+
32+
const color = '#' + correctColor(hash.substring(6,6));
33+
34+
prefix = prefix.padEnd(prefixSize);
35+
36+
if (message.endsWith('\n')) {
37+
message = message.substring(0, message.length-1);
38+
}
3339

3440
const color = '#' + correctColor(hash.substr(6, 6));
3541

libs/mf/src/server/task-queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type DoneFn = () => void;
22
export type Task = (done: DoneFn) => void;
33

4-
let queue: Task[] = [];
4+
const queue: Task[] = [];
55

66
// tslint:disable-next-line: no-shadowed-variable
77
function peek<T>(queue: Array<T>): T {

0 commit comments

Comments
 (0)