@antora/playbook-builder
Advanced tools
Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7
@@ -77,3 +77,8 @@ 'use strict' | ||
function exportModel (config) { | ||
const playbook = camelCaseKeys(config.getProperties(), { deep: true }) | ||
const properties = config.getProperties() | ||
// FIXME would be nice if camelCaseKeys could exclude a subtree (e.g., asciidoc) | ||
const asciidocProperty = properties.asciidoc | ||
delete properties.asciidoc | ||
const playbook = camelCaseKeys(properties, { deep: true }) | ||
if (asciidocProperty) playbook.asciidoc = asciidocProperty | ||
playbook.dir = playbook.playbook ? ospath.dirname((playbook.file = playbook.playbook)) : process.cwd() | ||
@@ -80,0 +85,0 @@ delete playbook.playbook |
@@ -97,10 +97,21 @@ 'use strict' | ||
doc: 'Supplemental file list or a directory of files to append to the UI bundle.', | ||
format: (val) => { | ||
if (!(typeof val === 'string' || Array.isArray(val))) { | ||
throw new Error('expected directory string or file list') | ||
} | ||
}, | ||
format: 'dir-or-virtual-files', | ||
default: undefined, | ||
}, | ||
}, | ||
asciidoc: { | ||
attributes: { | ||
doc: 'Global document attributes to set (or unset) on each AsciiDoc document.', | ||
// NOTE format must be 'object' rather than Object to be validated | ||
format: 'object', | ||
default: {}, | ||
arg: 'attribute', | ||
}, | ||
extensions: { | ||
doc: 'A list of require paths for registering extensions per instance of the AsciiDoc processor.', | ||
format: Array, | ||
default: [], | ||
//arg: 'extension', | ||
}, | ||
}, | ||
runtime: { | ||
@@ -107,0 +118,0 @@ quiet: { |
'use strict' | ||
const convict = require('convict') | ||
const yaml = require('js-yaml') | ||
const ARGS_SCANNER_RX = /(?:([^=,]+)|(?==))(?:,|$|=(|("|').*?\3|[^,]+)(?:,|$))/g | ||
/** | ||
@@ -10,2 +13,4 @@ * A convict function wrapper that decouples it from the process environment. | ||
function solitaryConvict (schema, opts = {}) { | ||
registerCustomFormats(convict) | ||
let processArgv | ||
@@ -41,2 +46,29 @@ let args = opts.args || [] | ||
function registerCustomFormats (convict) { | ||
convict.addFormat({ | ||
name: 'object', | ||
validate: (val) => { | ||
if (typeof val !== 'object') throw new Error('must be an object (key/value pairs)') | ||
}, | ||
coerce: (val) => { | ||
const accum = {} | ||
let match | ||
ARGS_SCANNER_RX.lastIndex = 0 | ||
while ((match = ARGS_SCANNER_RX.exec(val))) { | ||
const [, k, v] = match | ||
if (k) accum[k] = v ? yaml.safeLoad(v) : '' | ||
} | ||
return accum | ||
}, | ||
}) | ||
convict.addFormat({ | ||
name: 'dir-or-virtual-files', | ||
validate: (val) => { | ||
if (!(typeof val === 'string' || val instanceof String || Array.isArray(val))) { | ||
throw new Error('must be a directory path or list of virtual files') | ||
} | ||
}, | ||
}) | ||
} | ||
module.exports = solitaryConvict |
{ | ||
"name": "@antora/playbook-builder", | ||
"version": "1.0.0-alpha.6", | ||
"version": "1.0.0-alpha.7", | ||
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.", | ||
@@ -21,3 +21,3 @@ "license": "MPL-2.0", | ||
"convict": "^4.0.2", | ||
"cson-parser": "^2.0.1", | ||
"cson-parser": "^3.0.0", | ||
"deep-freeze": "^0.0.1", | ||
@@ -24,0 +24,0 @@ "js-yaml": "^3.10.0", |
# Antora Playbook Builder | ||
The playbook builder is the configuration component for Antora. | ||
It's responsible for building a playbook object from user input that's used for configuring successive documentation components in an Antora pipeline. | ||
It's responsible for building a playbook object from user input that's then used for configuring components in an Antora generator pipeline. | ||
@@ -6,0 +6,0 @@ [Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11772
317
+ Addedcoffeescript@1.12.7(transitive)
+ Addedcson-parser@3.0.0(transitive)
- Removedcoffee-script@1.12.7(transitive)
- Removedcson-parser@2.0.1(transitive)
Updatedcson-parser@^3.0.0