-
-
Notifications
You must be signed in to change notification settings - Fork 77
/
generator.js
76 lines (70 loc) · 2.34 KB
/
generator.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import BaseApplicationGenerator from 'generator-jhipster/generators/base-application';
import { clientApplicationTemplatesBlock } from 'generator-jhipster/generators/client/support';
export default class extends BaseApplicationGenerator {
ngxDiff;
async beforeQueue() {
await this.dependsOnJHipster('bootstrap-application');
}
get [BaseApplicationGenerator.PREPARING]() {
return this.asPreparingTaskGroup({
loadDependabot() {
const {
dependencies: { ['ngx-diff']: ngxDiff },
} = this.fs.readJSON(this.templatePath('../resources/package.json'));
this.ngxDiff = ngxDiff;
},
});
}
get [BaseApplicationGenerator.WRITING]() {
return this.asWritingTaskGroup({
cleanup() {
// this.removeFile(`${application.srcMainWebapp}app/admin/entity-audit/entity-audit-routing.module.ts`);
// this.removeFile(`${application.srcMainWebapp}app/admin/entity-audit/entity-audit.module.ts`);
},
async writingTemplateTask({ application }) {
await this.writeFiles({
sections: {
files: [
{
...clientApplicationTemplatesBlock('admin/entity-audit/'),
templates: [
'entity-audit-event.model.ts',
'entity-audit-modal.component.html',
'entity-audit-modal.component.ts',
'entity-audit.component.html',
'entity-audit.component.ts',
'entity-audit.service.ts',
],
},
],
},
context: application,
});
},
});
}
get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
async postWritingTemplateTask({ source }) {
this.packageJson.merge({
dependencies: {
'ngx-diff': this.ngxDiff,
},
});
if (this.options.skipMenu) return;
source.addAdminRoute?.({
route: 'entity-audit',
modulePath: './entity-audit/entity-audit.component',
title: 'entityAudit.home.title',
component: true,
});
source.addItemToAdminMenu?.({
icon: 'list-alt',
route: 'admin/entity-audit',
translationKey: 'global.menu.admin.entityAudit',
name: 'Entity Audit',
});
},
});
}
}