@antora/playbook-builder 3.1.0 → 3.1.2
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/lib/config/schema.js +15 -18
- package/lib/solitary-convict.js +8 -0
- package/package.json +1 -1
package/lib/config/schema.js
CHANGED
|
@@ -66,7 +66,7 @@ module.exports = {
|
|
|
66
66
|
content: {
|
|
67
67
|
branches: {
|
|
68
68
|
doc: 'The default branch pattern to use when no specific pattern is provided.',
|
|
69
|
-
format:
|
|
69
|
+
format: 'array-or-string',
|
|
70
70
|
default: ['HEAD', 'v{0..9}*'],
|
|
71
71
|
},
|
|
72
72
|
edit_url: {
|
|
@@ -82,7 +82,7 @@ module.exports = {
|
|
|
82
82
|
},
|
|
83
83
|
tags: {
|
|
84
84
|
doc: 'The default tag pattern to use when no specific pattern is provided.',
|
|
85
|
-
format:
|
|
85
|
+
format: 'array-or-string',
|
|
86
86
|
default: undefined,
|
|
87
87
|
},
|
|
88
88
|
},
|
|
@@ -253,21 +253,13 @@ module.exports = {
|
|
|
253
253
|
arg: 'log-failure-level',
|
|
254
254
|
env: 'ANTORA_LOG_FAILURE_LEVEL',
|
|
255
255
|
},
|
|
256
|
-
format:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
get (target, property) {
|
|
266
|
-
if (property !== 'default') return target[property]
|
|
267
|
-
return process.env.CI === 'true' || process.stdout.isTTY ? 'pretty' : 'json'
|
|
268
|
-
},
|
|
269
|
-
}
|
|
270
|
-
),
|
|
256
|
+
format: {
|
|
257
|
+
doc: 'Set the format of log messages. Defaults to pretty if CI=true or stdout is a TTY, json otherwise.',
|
|
258
|
+
format: ['json', 'pretty'],
|
|
259
|
+
default: 'auto',
|
|
260
|
+
arg: 'log-format',
|
|
261
|
+
env: 'ANTORA_LOG_FORMAT',
|
|
262
|
+
},
|
|
271
263
|
destination: {
|
|
272
264
|
file: {
|
|
273
265
|
doc: 'Write log messages to this file or stream. Defaults to stderr if format is pretty, stdout otherwise.',
|
|
@@ -342,8 +334,13 @@ module.exports = {
|
|
|
342
334
|
default: undefined,
|
|
343
335
|
},
|
|
344
336
|
},
|
|
345
|
-
[Symbol.for('convict.beforeValidate')]: ({
|
|
337
|
+
[Symbol.for('convict.beforeValidate')]: ({ getEnv, _instance: data, _schema: schema }) => {
|
|
346
338
|
const runtime = data.runtime
|
|
339
|
+
const log = runtime.log
|
|
340
|
+
if (log.format === 'auto') {
|
|
341
|
+
const env = getEnv()
|
|
342
|
+
log.format = env.CI === 'true' || (env.IS_TTY || String(process.stdout.isTTY)) === 'true' ? 'pretty' : 'json'
|
|
343
|
+
}
|
|
347
344
|
if (runtime.silent) {
|
|
348
345
|
if (runtime.quiet === false) runtime.quiet = true
|
|
349
346
|
if (runtime.log.level !== 'silent') runtime.log.level = 'silent'
|
package/lib/solitary-convict.js
CHANGED
|
@@ -35,6 +35,14 @@ function registerParsers (convict) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function registerFormats (convict) {
|
|
38
|
+
convict.addFormat({
|
|
39
|
+
name: 'array-or-string',
|
|
40
|
+
validate: (val) => {
|
|
41
|
+
if (!(val == null || val.constructor === String || Array.isArray(val))) {
|
|
42
|
+
throw new Error('must be an array, string, or null')
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
})
|
|
38
46
|
convict.addFormat({
|
|
39
47
|
name: 'map',
|
|
40
48
|
validate: (val) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/playbook-builder",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|