-
-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathgenerator.js
More file actions
80 lines (70 loc) · 2.16 KB
/
generator.js
File metadata and controls
80 lines (70 loc) · 2.16 KB
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
77
78
79
80
import BaseApplicationGenerator from 'generator-jhipster/generators/base-application';
import { clientApplicationTemplatesBlock } from 'generator-jhipster/generators/client/support';
export default class extends BaseApplicationGenerator {
vueVersion;
constructor(args, opts, features) {
super(args, opts, { ...features, queueCommandTasks: true });
}
async beforeQueue() {
await this.dependsOnJHipster('bootstrap-application');
}
get [BaseApplicationGenerator.PREPARING]() {
return this.asPreparingTaskGroup({
loadDependabot() {
const {
dependencies: { vue: vueVersion },
} = this.fs.readJSON(this.templatePath('../resources/package.json'));
this.vueVersion = vueVersion;
},
});
}
get [BaseApplicationGenerator.WRITING]() {
return this.asWritingTaskGroup({
cleanup() {
// 可选清理逻辑
},
writingTemplateTask({ application }) {
return this.writeFiles({
sections: {
files: [
{
...clientApplicationTemplatesBlock('admin/entity-audit/'),
templates: [
'entity-audit-event.model.ts',
'entity-audit-modal.component.vue',
'entity-audit.component.vue',
'entity-audit.service.ts',
],
},
],
},
context: application,
});
},
});
}
get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
postWritingTemplateTask({ source }) {
this.packageJson.merge({
dependencies: {
vue: this.vueVersion,
},
});
if (this.options.skipMenu) return;
source.addAdminRoute?.({
route: 'entity-audit',
modulePath: './entity-audit/entity-audit.component.vue',
title: 'entityAudit.home.title',
component: true,
});
source.addItemToAdminMenu?.({
icon: 'list',
route: 'admin/entity-audit',
translationKey: 'global.menu.admin.entityAudit',
name: 'Entity Audit',
});
},
});
}
}