-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
134 lines (130 loc) · 2.55 KB
/
vue.config.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
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
csvHeaders = JSON.parse(`{
"id": {
"type": "integer",
"label": "id"
},
"challenge": {
"type": "string",
"label": "Challenge"
},
"title": {
"type": "string",
"label": "Idea Title"
},
"url": {
"type": "string",
"label": "Idea URL"
},
"assessor": {
"type": "string",
"label": "Assessor"
},
"triplet_id": {
"type": "string",
"label": "triplet_id"
},
"proposal_id": {
"type": "integer",
"label": "proposal_id"
},
"challenge_id": {
"type": "integer",
"label": "challenge_id"
},
"impact_note": {
"type": "string",
"label": "Impact / Alignment Note"
},
"impact_rating": {
"type": "integer",
"label": "Impact / Alignment Rating"
},
"feasibility_note": {
"type": "string",
"label": "Feasibility Note"
},
"feasibility_rating": {
"type": "integer",
"label": "Feasibility Rating"
},
"auditability_note": {
"type": "string",
"label": "Auditability Note"
},
"auditability_rating": {
"type": "integer",
"label": "Auditability Rating"
},
"proposer_mark": {
"type": "boolean",
"label": "Proposer Mark"
},
"proposer_rationale": {
"type": "string",
"label": "Proposer Filtered Out rationale or Feedback"
},
"excellent": {
"type": "boolean",
"label": "Excellent"
},
"good": {
"type": "boolean",
"label": "Good"
},
"filtered_out": {
"type": "boolean",
"label": "Filtered Out"
},
"vpa_feedback": {
"type": "string",
"label": "vPA Feedback"
}
}`);
const transformData = function (value, col) {
if (csvHeaders[col]) {
if (csvHeaders[col].type === 'integer') {
return parseInt(value)
}
if (csvHeaders[col].type === 'string') {
return value
}
} else {
return value
}
};
const transformHeader = function (header) {
const newHeaders = {}
Object.keys(csvHeaders).forEach((h) => {
newHeaders[csvHeaders[h].label] = h
})
if (newHeaders[header]) {
return newHeaders[header]
}
return header
};
let publicPath = ''
if (process.env.APP_ENV === 'production') {
publicPath = '/vpa-tool/'
}
if (process.env.APP_ENV === 'staging') {
publicPath = '/'
}
module.exports = {
publicPath: publicPath,
chainWebpack: config => {
config
.module
.rule("csv")
.test(/\.csv$/)
.use("csv-loader")
.loader("csv-loader")
.options({
dynamicTyping: true,
header: true,
skipEmptyLines: true,
//transform: transformData,
transformHeader: transformHeader,
})
.end();
}
}