@antora/playbook-builder 3.2.0-alpha.1 → 3.2.0-alpha.3

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Antora Playbook Builder
2
2
 
3
3
  The Playbook Builder is the configuration component for Antora.
4
- It's responsible for building a playbook object from user input that's then used for configuring components in an Antora generator pipeline.
4
+ Its responsible for building a playbook object from user input thats then used for configuring components in an Antora generator pipeline.
5
5
 
6
6
  [Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
7
7
  Its site generator aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
@@ -11,7 +11,7 @@ const ospath = require('path')
11
11
  *
12
12
  * Accepts an array of command line arguments (in the form of option flags and
13
13
  * switches) and a map of environment variables and translates this data into a
14
- * playbook object according the the specified schema. If no schema is
14
+ * playbook object according the specified schema. If no schema is
15
15
  * specified, the default schema provided by this package is used.
16
16
  *
17
17
  * @memberof playbook-builder
@@ -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: Array,
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: Array,
85
+ format: 'array-or-string',
86
86
  default: undefined,
87
87
  },
88
88
  },
@@ -167,7 +167,7 @@ module.exports = {
167
167
  fetch_concurrency: {
168
168
  doc: 'The maximum number of fetch or clone operations that are permitted to run at once. Use 0 for unlimited.',
169
169
  format: 'int',
170
- default: 0,
170
+ default: 1,
171
171
  },
172
172
  plugins: {
173
173
  credential_manager: {
@@ -181,6 +181,11 @@ module.exports = {
181
181
  default: undefined,
182
182
  },
183
183
  },
184
+ read_concurrency: {
185
+ doc: 'The maximum number of git indexes that are read into memory at once. Use 0 for unlimited.',
186
+ format: 'int',
187
+ default: 0,
188
+ },
184
189
  },
185
190
  network: {
186
191
  http_proxy: {
@@ -253,23 +258,13 @@ module.exports = {
253
258
  arg: 'log-failure-level',
254
259
  env: 'ANTORA_LOG_FAILURE_LEVEL',
255
260
  },
256
- format: new Proxy(
257
- {
258
- doc: 'Set the format of log messages. Defaults to pretty if CI=true or stdout is a TTY, json otherwise.',
259
- format: ['json', 'pretty'],
260
- default: undefined,
261
- arg: 'log-format',
262
- env: 'ANTORA_LOG_FORMAT',
263
- },
264
- {
265
- get (target, property) {
266
- if (property !== 'default') return target[property]
267
- return process.env.CI === 'true' || (process.env.IS_TTY || String(process.stdout.isTTY)) === 'true'
268
- ? 'pretty'
269
- : 'json'
270
- },
271
- }
272
- ),
261
+ format: {
262
+ doc: 'Set the format of log messages. Defaults to pretty if CI=true or stdout is a TTY, json otherwise.',
263
+ format: ['json', 'pretty'],
264
+ default: 'auto',
265
+ arg: 'log-format',
266
+ env: 'ANTORA_LOG_FORMAT',
267
+ },
273
268
  destination: {
274
269
  file: {
275
270
  doc: 'Write log messages to this file or stream. Defaults to stderr if format is pretty, stdout otherwise.',
@@ -344,8 +339,13 @@ module.exports = {
344
339
  default: undefined,
345
340
  },
346
341
  },
347
- [Symbol.for('convict.beforeValidate')]: ({ _schema: schema, _instance: data }) => {
342
+ [Symbol.for('convict.beforeValidate')]: ({ getEnv, _instance: data, _schema: schema }) => {
348
343
  const runtime = data.runtime
344
+ const log = runtime.log
345
+ if (log.format === 'auto') {
346
+ const env = getEnv()
347
+ log.format = env.CI === 'true' || (env.IS_TTY || String(process.stdout.isTTY)) === 'true' ? 'pretty' : 'json'
348
+ }
349
349
  if (runtime.silent) {
350
350
  if (runtime.quiet === false) runtime.quiet = true
351
351
  if (runtime.log.level !== 'silent') runtime.log.level = 'silent'
@@ -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) => {
@@ -44,8 +52,8 @@ function registerFormats (convict) {
44
52
  if (config == null) return val
45
53
  const accum = config.has(name) ? config.get(name) : {}
46
54
  let match
47
- ARGS_SCANNER_RX.lastIndex = 0
48
- while ((match = ARGS_SCANNER_RX.exec(val))) {
55
+ const scanner = new RegExp(ARGS_SCANNER_RX)
56
+ while ((match = scanner.exec(val))) {
49
57
  const [, k, v] = match
50
58
  if (k) accum[k] = v ? (v === '-' ? '-' : yaml.load(v, { schema: yaml.CORE_SCHEMA })) : ''
51
59
  }
@@ -69,8 +77,8 @@ function registerFormats (convict) {
69
77
  if (config == null) return val
70
78
  const accum = config.has(name) ? config.get(name) : {}
71
79
  let match
72
- ARGS_SCANNER_RX.lastIndex = 0
73
- while ((match = ARGS_SCANNER_RX.exec(val))) {
80
+ const scanner = new RegExp(ARGS_SCANNER_RX)
81
+ while ((match = scanner.exec(val))) {
74
82
  const [, k, v] = match
75
83
  if (k) {
76
84
  let parsed
@@ -89,7 +97,7 @@ function registerFormats (convict) {
89
97
  convict.addFormat({
90
98
  name: 'require-array',
91
99
  validate: (val) => {
92
- if (!Array.isArray(val)) throw new Error('must be of type Array')
100
+ if (!Array.isArray(val)) throw new Error('must be an array')
93
101
  },
94
102
  coerce: (val, config, name) => {
95
103
  const accum = config && config.has(name) ? config.get(name) : []
@@ -109,7 +117,7 @@ function registerFormats (convict) {
109
117
  name: 'boolean-or-string',
110
118
  validate: (val) => {
111
119
  if (!(val == null || val.constructor === String || val.constructor === Boolean)) {
112
- throw new Error('must be a boolean or string')
120
+ throw new Error('must be a boolean, string, or null')
113
121
  }
114
122
  },
115
123
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/playbook-builder",
3
- "version": "3.2.0-alpha.1",
3
+ "version": "3.2.0-alpha.3",
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)",
@@ -44,7 +44,7 @@
44
44
  ],
45
45
  "scripts": {
46
46
  "test": "_mocha",
47
- "prepublishOnly": "node $npm_config_local_prefix/npm/prepublishOnly.js",
48
- "postpublish": "node $npm_config_local_prefix/npm/postpublish.js"
47
+ "prepublishOnly": "npx -y downdoc@latest --prepublish",
48
+ "postpublish": "npx -y downdoc@latest --postpublish"
49
49
  }
50
50
  }