@thegetty/quire-cli 1.0.0-rc.13 → 1.0.0-rc.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thegetty/quire-cli",
3
3
  "description": "Quire command-line interface",
4
- "version": "1.0.0-rc.13",
4
+ "version": "1.0.0-rc.15",
5
5
  "author": "Getty Digital",
6
6
  "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
7
7
  "bugs": {
@@ -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 may be project specific so the CLI must loads from project root rather than package root
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 validatorPlugin = path.join(projectRoot, '_plugins', 'globalData', 'validator.js')
28
+ const validatorPath = path.join(projectRoot, '_plugins', 'globalData', 'validator.js')
30
29
 
31
- const validateUserConfig = await import(validatorPlugin)
30
+ if (fs.existsSync(schemaPath) && fs.existsSync(validatorPath)) {
32
31
 
33
- // TODO: Check the project version string for whether we should check the schema
34
- if (fs.existsSync(schemaPath)) {
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)
@@ -61,7 +61,7 @@ export default async (publicationInput, coversInput, output, options = {}) => {
61
61
 
62
62
  let coversData
63
63
 
64
- if (pdfConfig?.pagePDF?.coverPage === true) {
64
+ if (pdfConfig?.pagePDF?.coverPage === true && fs.existsSync(coversInput)) {
65
65
 
66
66
  const coversPageMapOutput = await execa('prince', [...pageMapOptions, coversInput])
67
67
  const coversMap = JSON.parse(coversPageMapOutput.stdout)