-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestions.js
110 lines (108 loc) · 3.77 KB
/
questions.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
function createQuestions(configFile) {
return [
{
type: 'input',
name: 'fileName',
message: 'Enter a file name for generated PDF',
default: `${configFile.fileName ? configFile.fileName : 'default.pdf'}`
},
{
type: 'fuzzypath',
name: 'destinationPath',
excludePath: nodePath => nodePath.startsWith('node_modules') || nodePath.startsWith('.git'),
rootPath: './',
message: 'Enter a destination path for generated PDF',
default: `${configFile.destinationPath ? configFile.destinationPath : 'output'}`
},
{
type: 'fuzzypath',
name: 'sourcePath',
excludePath: nodePath => nodePath.startsWith('node_modules') || nodePath.startsWith('.git'),
rootPath: './',
message: 'Enter the path of the source HTML document',
default: `${configFile.sourcePath ? configFile.sourcePath : '/'}`
},
{
type: 'confirm',
name: 'printBackground',
message: 'Print background graphics?',
default: `${configFile.printBackground ? configFile.printBackground : true}`
},
{
type: 'confirm',
name: 'paperOrientation',
message: 'Print in landscape orientation?',
default: `${configFile.paperOrientation ? configFile.paperOrientation : false}`
},
{
type: 'confirm',
name: 'useCustomMargins',
message: 'Use custom margins for the generated PDF?',
default: `${configFile.useCustomMargins ? configFile.useCustomMargins : false}`
},
{
type: 'input',
name: 'marginTop',
message: 'Enter top margin in px, in, mm, or cm',
default: `${configFile.marginTop ? configFile.marginTop : '0.4 in'}`,
when: (answers) => {
return answers.useCustomMargins
}
},
{
type: 'input',
name: 'marginLeft',
message: 'Enter left margin in px, in, mm, or cm',
default: `${configFile.marginLeft ? configFile.marginLeft : '0.4 in'}`,
when: (answers) => {
return answers.useCustomMargins
}
},
{
type: 'input',
name: 'marginRight',
message: 'Enter right margin in px, in, mm, or cm',
default: `${configFile.marginRight ? configFile.marginRight : '0.39 in'}`,
when: (answers) => {
return answers.useCustomMargins
}
},
{
type: 'input',
name: 'marginBottom',
message: 'Enter bottom margin in px, in, mm, or cm',
default: `${configFile.marginBottom ? configFile.marginBottom : '0.39 in'}`,
when: (answers) => {
return answers.useCustomMargins
}
},
{
type: 'list',
name: 'paperFormat',
message: 'Select a paper format',
choices: [
'Letter',
'Legal',
'Tabloid',
'Ledger',
'A0',
'A1',
'A2',
'A3',
'A4',
'A5',
'A6'
],
default: `${configFile.paperFormat ? configFile.paperFormat : 'Letter'}`
},
{
type: 'confirm',
name: 'saveToConfig',
message: 'Save responses to .htmltopdf.json?',
default: true
}
];
}
module.exports = {
createQuestions
};