@antora/playbook-builder 3.0.3 → 3.1.1
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/build-playbook.js +13 -2
- package/lib/config/schema.js +3 -1
- package/package.json +9 -3
package/lib/build-playbook.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const camelCaseKeys = require('camelcase-keys')
|
|
4
3
|
const convict = require('./solitary-convict')
|
|
5
4
|
const defaultSchema = require('./config/schema')
|
|
6
5
|
const fs = require('fs')
|
|
@@ -68,6 +67,18 @@ function buildPlaybook (args = [], env = process.env, schema = defaultSchema, be
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
|
|
70
|
+
function camelCaseKeys (o, stopPaths = [], p = '') {
|
|
71
|
+
if (Array.isArray(o)) return o.map((it) => camelCaseKeys(it, stopPaths, p))
|
|
72
|
+
if (o == null || o.constructor !== Object) return o
|
|
73
|
+
const pathPrefix = p && p + '.'
|
|
74
|
+
const accum = {}
|
|
75
|
+
for (const [k, v] of Object.entries(o)) {
|
|
76
|
+
const camelKey = k.toLowerCase().replace(/[_-]([a-z0-9])/g, (_, l, idx) => (idx ? l.toUpperCase() : l))
|
|
77
|
+
accum[camelKey] = ~stopPaths.indexOf(pathPrefix + camelKey) ? v : camelCaseKeys(v, stopPaths, pathPrefix + camelKey)
|
|
78
|
+
}
|
|
79
|
+
return accum
|
|
80
|
+
}
|
|
81
|
+
|
|
71
82
|
function getModel (name) {
|
|
72
83
|
let config = this
|
|
73
84
|
const data = config.get(name)
|
|
@@ -77,7 +88,7 @@ function getModel (name) {
|
|
|
77
88
|
config = Object.assign(convict(name.split('.').reduce((def, key) => def[key], config._def)), { _instance: data })
|
|
78
89
|
}
|
|
79
90
|
config.validate({ allowed: 'strict' })
|
|
80
|
-
const model = camelCaseKeys(data,
|
|
91
|
+
const model = camelCaseKeys(data, getStopPaths(schema._cvtProperties))
|
|
81
92
|
if (!name) {
|
|
82
93
|
model.dir = model.playbook ? ospath.dirname((model.file = model.playbook)) : process.cwd()
|
|
83
94
|
model.env = config.getEnv()
|
package/lib/config/schema.js
CHANGED
|
@@ -264,7 +264,9 @@ module.exports = {
|
|
|
264
264
|
{
|
|
265
265
|
get (target, property) {
|
|
266
266
|
if (property !== 'default') return target[property]
|
|
267
|
-
return process.env.CI === 'true' || process.stdout.isTTY
|
|
267
|
+
return process.env.CI === 'true' || (process.env.IS_TTY || String(process.stdout.isTTY)) === 'true'
|
|
268
|
+
? 'pretty'
|
|
269
|
+
: 'json'
|
|
268
270
|
},
|
|
269
271
|
}
|
|
270
272
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/playbook-builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
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)",
|
|
@@ -15,15 +15,21 @@
|
|
|
15
15
|
"url": "https://gitlab.com/antora/antora/issues"
|
|
16
16
|
},
|
|
17
17
|
"main": "lib/index.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./lib/index.js",
|
|
20
|
+
"./config/schema": "./lib/config/schema.js",
|
|
21
|
+
"./lib/solitary-convict": "./lib/solitary-convict.js",
|
|
22
|
+
"./solitary-convict": "./lib/solitary-convict.js",
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
18
25
|
"dependencies": {
|
|
19
26
|
"@iarna/toml": "~2.2",
|
|
20
|
-
"camelcase-keys": "~7.0",
|
|
21
27
|
"convict": "~6.2",
|
|
22
28
|
"js-yaml": "~4.1",
|
|
23
29
|
"json5": "~2.2"
|
|
24
30
|
},
|
|
25
31
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
32
|
+
"node": ">=16.0.0"
|
|
27
33
|
},
|
|
28
34
|
"files": [
|
|
29
35
|
"lib/"
|