Repository navigation
Expand file tree
/
Copy pathvue.config.js
More file actions
113 lines (111 loc) · 2.23 KB
/
Copy pathvue.config.js
File metadata and controls
113 lines (111 loc) · 2.23 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
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
csvHeaders = JSON.parse(`{
"id": {
"type": "integer",
"label": "id"
},
"title": {
"type": "string",
"label": "Idea Title"
},
"challenge": {
"type": "string",
"label": "Challenge"
},
"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"
},
"blank": {
"type": "boolean",
"label": "Blank"
},
"not_valid": {
"type": "boolean",
"label": "Filtered Out"
},
"not_valid_rationale": {
"type": "string",
"label": "Filtered Out rationale or 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
};
module.exports = {
publicPath: (process.env.NODE_ENV === 'production') ? '/proposal-review-tool/' : '',
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();
}
}