-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgenerate.js
39 lines (35 loc) · 1.03 KB
/
generate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { writeFileSync } = require('fs');
const component = `
import { Component, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'tr-level-X',
template: \`Level X <router-outlet></router-outlet>\`,
})
export class LevelXComponent {}
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: LevelXComponent,
children: [
{
path: '',
loadChildren: () => import('./level-Y.component').then((m) => m.LevelYModule),
},
],
},
]),
],
declarations: [LevelXComponent],
})
export class LevelXModule {}
`;
for (let x = 0; x < 100; x++) {
writeFileSync(
`apps/preload-chunk-demo/src/app/level-${x}.component.ts`,
component.replace(/X/g, x.toString(10)).replace(/Y/g, (x + 1).toString(10))
);
}