-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateCVMD.ts
145 lines (124 loc) · 3.46 KB
/
generateCVMD.ts
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import { on } from "./docs/company/on";
import { ga } from "./docs/company/ga";
import { convertMonthsToYearsMonths, convertTechnicalSkillKey, technicalSkills } from "./docs/company/technical_skill";
import { summary } from "./docs/summary";
import * as fs from 'fs';
import { Project as OnProject } from "./docs/company/on_types";
import { Project as GaProject } from "./docs/company/ga_types";
const convertIndexToAlphabet = (index: number) => {
if (index > 25) {
throw new Error("index must be less than 26");
}
return String.fromCharCode(index + 65)
}
const today = new Date();
const date = today.getFullYear()+'年'+(today.getMonth()+1)+'月'+today.getDate()+'日現在';
const cv = `
<div class="cv-title">
職務経歴書
</div>
<div class="cv-date">
${date}
</div>
<div class="full-name">
氏名 中村一貴
</div>`
+
`
■職務要約
${summary.carrerSummary}
■活かせる経験・知識・技術
${summary.transferableSkills}
`.split("\n").join("<br/>")
+
`■職務経歴`
+
[on, ga].map((company) => (`<table class="cv-table">
<tr>
<th colspan="2">${company.enrollmentPeriod}</th>
<tr/>
<tr>
<td>事業内容:${company.companyOverview}</td>
<td>${company.employmentType}</td>
</tr>
${company.projects.map((project: GaProject | OnProject) => {
const left = `\
【プロジェクト概要】
${project.summary}
【担当フェーズ】
${project.phase.join("、")}
【業務内容】
${project.responsibilities.join("、")}
${project.developmentAndImplementationDetails.map((detail, i) => `\
【課題 ${convertIndexToAlphabet(i)}】
${detail.challenges}
【取り組み・工夫した点 ${convertIndexToAlphabet(i)}】
${detail.efforts}
【成果 ${convertIndexToAlphabet(i)}】
${detail.achievements}
`).join("\n")}
【実績詳細】
${project.trackRecord}
`.split("\n").join("<br/>")
const right = `\
【チーム人数】
${project.teamSize}
【役割】
${project.role}
【言語】
${project.languages.join("、")}
【フレームワーク・その他】
${project.frameworksAndOthers.join("、")}
【OS】
${project.os.join("、")}\
`.split("\n").join("<br/>")
return `
<tr class="cv-table-subheader">
<td>${project.dates} / ${project.title}</td>
<td>規模・開発環境</td>
</tr>
<tr>
<td>${left}</td>
<td>${right}</td>
</tr>
`}).join("\n")}
</table>
<br/>
`)).join("\n") + `
■テクニカルスキル
<table class="skill-table">
<tr>
<th style="width: 35%;" colspan="2">種類</th>
<th style="width: 15%;">使用期間</th>
<th style="width: 50%;">レベル</th>
</tr>
${(Object.keys(technicalSkills) as Array<keyof typeof technicalSkills>).map((key) => {
return Object.entries(technicalSkills[key]).map(([k, v], i) => {
const {years, months} = convertMonthsToYearsMonths(v.usageMonth)
return `<tr>`
+
(i == 0 ? `<td rowspan="${Object.keys(technicalSkills[key]).length}" >${convertTechnicalSkillKey(key)}</td>` : "")
+
`<td>${k}</td>
<td>${years}年${months}ヶ月</td>
<td>${v.level}</td>
</tr>`
}).join("")
}).join("")}
</table>
` + `
■自己PR
${summary.selfPromotion}
■成果物
${summary.selfMade}
■将来の目標
${summary.futureGoal}`.split("\n").join("<br/>")
let obj
try {
obj = JSON.parse(process.argv[2] || "{}")
} catch (e) {
console.error("Please pass the filename as the first argument")
process.exit(1)
}
const filename = obj.filename || "README.md"
fs.writeFileSync(filename, cv, "utf-8");