@antora/playbook-builder
Advanced tools
Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
'use strict' | ||
const camelCaseKeys = require('camelcase-keys') | ||
const { configureLogger } = require('@antora/logger') | ||
const convict = require('./solitary-convict') | ||
@@ -90,2 +91,4 @@ const fs = require('fs') | ||
delete playbook.playbook | ||
const log = (playbook.runtime || {}).log | ||
if (log) configureLogger(playbook.runtime.silent ? (log.level = 'silent') && log : log) | ||
return freeze(playbook) | ||
@@ -92,0 +95,0 @@ } |
@@ -145,2 +145,25 @@ 'use strict' | ||
}, | ||
network: { | ||
http_proxy: { | ||
doc: 'The URL of the proxy to use for HTTP URLs.', | ||
format: 'url', | ||
default: undefined, | ||
arg: 'http-proxy', | ||
env: 'http_proxy', | ||
}, | ||
https_proxy: { | ||
doc: 'The URL of the proxy to use for HTTPS URLs.', | ||
format: 'url', | ||
default: undefined, | ||
arg: 'https-proxy', | ||
env: 'https_proxy', | ||
}, | ||
no_proxy: { | ||
doc: 'A comma-separated list of domains and IPs that should not be proxied.', | ||
format: String, | ||
default: undefined, | ||
arg: 'noproxy', | ||
env: 'no_proxy', | ||
}, | ||
}, | ||
runtime: { | ||
@@ -172,2 +195,36 @@ cache_dir: { | ||
}, | ||
log: { | ||
level: { | ||
doc: 'Set the minimum log level of messages that get logged.', | ||
format: ['all', 'debug', 'info', 'warn', 'error', 'fatal', 'silent'], | ||
default: 'warn', | ||
arg: 'log-level', | ||
env: 'ANTORA_LOG_LEVEL', | ||
}, | ||
failure_level: { | ||
doc: 'Set the log level tolerance that, when exceeded, will cause the application to fail on exit.', | ||
format: ['all', 'debug', 'info', 'warn', 'error', 'fatal', 'silent'], | ||
default: undefined, | ||
arg: 'failure-level', | ||
env: 'ANTORA_LOG_FAILURE_LEVEL', | ||
}, | ||
format: new Proxy( | ||
{ | ||
doc: 'Set the format of log messages. (default: structured if CI=true, pretty otherwise)', | ||
format: ['pretty', 'structured', 'json'], | ||
default: undefined, | ||
arg: 'log-format', | ||
env: 'ANTORA_LOG_FORMAT', | ||
}, | ||
{ | ||
get (target, property) { | ||
return property === 'default' | ||
? process.env.CI === 'true' || process.env.NODE_ENV === 'test' | ||
? 'structured' | ||
: 'pretty' | ||
: target[property] | ||
}, | ||
} | ||
), | ||
}, | ||
}, | ||
@@ -174,0 +231,0 @@ urls: { |
@@ -105,22 +105,30 @@ 'use strict' | ||
convict.addFormat({ | ||
name: 'url', | ||
validate: (val) => { | ||
if (val == null) return | ||
if (val.constructor !== String) throw new Error('must be a string') | ||
let protocol | ||
try { | ||
protocol = new URL(val).protocol | ||
} catch { | ||
throw new Error('must be a valid URL') | ||
} | ||
if (!(protocol === 'https:' || protocol === 'http:')) throw new Error('must be an HTTP or HTTPS URL') | ||
}, | ||
}) | ||
convict.addFormat({ | ||
name: 'url-or-pathname', | ||
validate: (val) => { | ||
if (val == null) return | ||
if (val.constructor === String) { | ||
if (val.charAt() === '/') val = 'https://example.org' + val | ||
let protocol | ||
let pathname | ||
try { | ||
;({ protocol, pathname } = new URL(val)) | ||
} catch { | ||
throw new Error('must be an absolute URL or a pathname (i.e., root-relative path)') | ||
} | ||
if (protocol !== 'https:' && protocol !== 'http:') { | ||
throw new Error('must be an absolute URL or a pathname (i.e., root-relative path)') | ||
} else if (~pathname.indexOf('%20')) { | ||
throw new Error('must not contain spaces') | ||
} | ||
} else { | ||
throw new Error('must be an absolute URL or a pathname (i.e., root-relative path)') | ||
if (val.constructor !== String) throw new Error('must be a string') | ||
let parsedUrl | ||
try { | ||
parsedUrl = new URL((val.charAt() === '/' ? 'https://example.org' : '') + val) | ||
} catch { | ||
throw new Error('must be a valid URL or a pathname (i.e., root-relative path)') | ||
} | ||
if (parsedUrl.protocol !== 'https:' && parsedUrl.protocol !== 'http:') { | ||
throw new Error('must be an HTTP or HTTPS URL or a pathname (i.e., root-relative path)') | ||
} | ||
if (~parsedUrl.pathname.indexOf('%20')) throw new Error('pathname segment must not contain spaces') | ||
}, | ||
@@ -127,0 +135,0 @@ }) |
{ | ||
"name": "@antora/playbook-builder", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.", | ||
@@ -19,2 +19,3 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/logger": "3.0.0-alpha.6", | ||
"@iarna/toml": "~2.2", | ||
@@ -40,3 +41,3 @@ "camelcase-keys": "~6.2", | ||
], | ||
"gitHead": "433242dd89b2859355cf6a5ea045337f527a3415" | ||
"gitHead": "38ec002e88eede3ce5c401a6e226d1a0356945c5" | ||
} |
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
35307
504
6
+ Added@antora/logger@3.0.0-alpha.6
+ Added@antora/logger@3.0.0-alpha.6(transitive)
+ Added@hapi/bourne@2.1.0(transitive)
+ Addedansi-styles@3.2.14.3.0(transitive)
+ Addedargs@5.0.3(transitive)
+ Addedatomic-sleep@1.0.0(transitive)
+ Addedcamelcase@5.0.0(transitive)
+ Addedchalk@2.4.24.1.2(transitive)
+ Addedcolor-convert@1.9.32.0.1(transitive)
+ Addedcolor-name@1.1.31.1.4(transitive)
+ Addeddateformat@4.6.3(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfast-redact@3.5.0(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedflatstr@1.0.12(transitive)
+ Addedhas-flag@3.0.04.0.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjmespath@0.15.0(transitive)
+ Addedjoycon@2.2.5(transitive)
+ Addedleven@2.1.0(transitive)
+ Addedmri@1.1.4(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpino@6.11.3(transitive)
+ Addedpino-pretty@4.8.0(transitive)
+ Addedpino-std-serializers@3.2.0(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedquick-format-unescaped@4.0.4(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrfdc@1.4.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsonic-boom@1.4.1(transitive)
+ Addedsplit2@3.2.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@5.5.07.2.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)