@liascript/exporter 2.5.1--0.10.22 → 2.5.2--0.10.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/export/project.ts +13 -26
- package/src/index.ts +6 -1
package/package.json
CHANGED
package/src/export/project.ts
CHANGED
|
@@ -71,27 +71,7 @@ export async function exporter(
|
|
|
71
71
|
'project-no-categories'?: boolean
|
|
72
72
|
'project-category-blur'?: boolean
|
|
73
73
|
'project-generate-pdf'?: boolean
|
|
74
|
-
|
|
75
|
-
// allow to pass pdf settings
|
|
76
|
-
'pdf-scale'?: number
|
|
77
|
-
'pdf-displayHeaderFooter'?: string
|
|
78
|
-
'pdf-headerTemplate'?: string
|
|
79
|
-
'pdf-footerTemplate'?: string
|
|
80
|
-
'pdf-printBackground'?: boolean
|
|
81
|
-
'pdf-landscape'?: boolean
|
|
82
|
-
'pdf-format'?: string
|
|
83
|
-
'pdf-width'?: string | number
|
|
84
|
-
'pdf-height'?: string | number
|
|
85
|
-
'pdf-margin-top'?: string | number
|
|
86
|
-
'pdf-margin-bottom'?: string | number
|
|
87
|
-
'pdf-margin-right'?: string | number
|
|
88
|
-
'pdf-margin-left'?: string | number
|
|
89
|
-
'pdf-preferCSSPageSize'?: boolean
|
|
90
|
-
'pdf-omitBackground'?: boolean
|
|
91
|
-
'pdf-timeout'?: number
|
|
92
|
-
|
|
93
|
-
'pdf-stylesheet'?: string
|
|
94
|
-
'pdf-theme'?: string
|
|
74
|
+
'project-generate-cache'?: boolean
|
|
95
75
|
},
|
|
96
76
|
json
|
|
97
77
|
) {
|
|
@@ -318,13 +298,20 @@ async function toCard(argument: any, course: any, small: boolean = false) {
|
|
|
318
298
|
argument.output = hash(course.data.readme)
|
|
319
299
|
const file = argument.output + '.pdf'
|
|
320
300
|
|
|
321
|
-
|
|
301
|
+
if (
|
|
302
|
+
argument['project-generate-cache'] &&
|
|
303
|
+
fs.existsSync('assets/pdf/' + file)
|
|
304
|
+
) {
|
|
305
|
+
downloads['pdf'] = 'assets/pdf/' + file
|
|
306
|
+
} else {
|
|
307
|
+
console.log('generate pdf of', argument.input, ' -> ', file)
|
|
322
308
|
|
|
323
|
-
|
|
309
|
+
await PDF.exporter(argument, {})
|
|
324
310
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
311
|
+
if (fs.existsSync(file)) {
|
|
312
|
+
moveFile(file, 'assets/pdf/' + file)
|
|
313
|
+
downloads['pdf'] = 'assets/pdf/' + file
|
|
314
|
+
}
|
|
328
315
|
}
|
|
329
316
|
}
|
|
330
317
|
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ const argv = require('minimist')(process.argv.slice(2))
|
|
|
20
20
|
|
|
21
21
|
// -------------------------------Main Execution-------------------------------
|
|
22
22
|
if (argv.v || argv.version) {
|
|
23
|
-
console.log('version: 2.5.
|
|
23
|
+
console.log('version: 2.5.2--0.10.22')
|
|
24
24
|
} else if (argv.h || argv.help) {
|
|
25
25
|
help()
|
|
26
26
|
} else if (argv.i || argv.input) {
|
|
@@ -310,6 +310,10 @@ function help() {
|
|
|
310
310
|
console.log(
|
|
311
311
|
'--project-generate-pdf PDFs are automatically generated and added to every card.'
|
|
312
312
|
)
|
|
313
|
+
|
|
314
|
+
console.log(
|
|
315
|
+
'--project-generate-cache Only generate new files, if they do not exist.'
|
|
316
|
+
)
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
function escapeBackslash(path?: string) {
|
|
@@ -379,6 +383,7 @@ function parseArguments() {
|
|
|
379
383
|
'project-no-categories': argv['project-no-categories'],
|
|
380
384
|
'project-category-blur': argv['project-category-blur'],
|
|
381
385
|
'project-generate-pdf': argv['project-generate-pdf'],
|
|
386
|
+
'project-generate-cache': argv['project-generate-cache'],
|
|
382
387
|
}
|
|
383
388
|
|
|
384
389
|
argument.format = argument.format.toLowerCase()
|