@thegetty/quire-cli 1.0.0-rc.13 → 1.0.0-rc.14
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/package.json +1 -1
- package/src/commands/pdf.js +8 -9
package/package.json
CHANGED
package/src/commands/pdf.js
CHANGED
|
@@ -11,10 +11,9 @@ import yaml from 'js-yaml'
|
|
|
11
11
|
*
|
|
12
12
|
* @param {path} string - file path to config file
|
|
13
13
|
*
|
|
14
|
-
* @todo refactor loading configs to a separate module,
|
|
15
|
-
* which uses the same validator(s) as the build proceess
|
|
16
|
-
*
|
|
17
14
|
* @return {Object|undefined} User configuration object or undefined
|
|
15
|
+
*
|
|
16
|
+
* @todo consider hardcoding a version check against .quire / project's package.json ver
|
|
18
17
|
*/
|
|
19
18
|
async function loadConfig(configPath) {
|
|
20
19
|
if (!fs.existsSync(configPath)) {
|
|
@@ -24,14 +23,14 @@ async function loadConfig(configPath) {
|
|
|
24
23
|
const data = fs.readFileSync(configPath)
|
|
25
24
|
let config = yaml.load(data)
|
|
26
25
|
|
|
27
|
-
// NB: Schemas
|
|
26
|
+
// NB: Schemas and validators are specific to the 11ty version of the project being built
|
|
28
27
|
const schemaPath = path.join(projectRoot,'_plugins','schemas','config.json')
|
|
29
|
-
const
|
|
28
|
+
const validatorPath = path.join(projectRoot, '_plugins', 'globalData', 'validator.js')
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
if (fs.existsSync(schemaPath) && fs.existsSync(validatorPath)) {
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const { validateUserConfig } = await import(validatorPath)
|
|
33
|
+
|
|
35
34
|
const schemaJSON = fs.readFileSync(schemaPath)
|
|
36
35
|
const schema = JSON.parse(schemaJSON)
|
|
37
36
|
|
|
@@ -98,7 +97,7 @@ export default class PDFCommand extends Command {
|
|
|
98
97
|
|
|
99
98
|
const output = quireConfig.pdf !== undefined
|
|
100
99
|
? path.join(paths.output, quireConfig.pdf.outputDir, `${quireConfig.pdf.filename}.pdf`)
|
|
101
|
-
: path.join(projectRoot, `${options.lib}.pdf`)
|
|
100
|
+
: path.join(projectRoot, `${options.lib}.pdf`)
|
|
102
101
|
|
|
103
102
|
const pdfLib = await libPdf(options.lib, { ...options, pdfConfig: quireConfig.pdf })
|
|
104
103
|
await pdfLib(publicationInput, coversInput, output)
|