@antora/cli 3.2.0-alpha.11 → 3.2.0-alpha.12

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/cli.js CHANGED
@@ -67,7 +67,6 @@ function requireLogger (fromPath = undefined, moduleName = '@antora/logger') {
67
67
  cli
68
68
  .allowExcessArguments(false)
69
69
  .configureOutput({ getOutHelpWidth: getTTYColumns, getErrHelpWidth: getTTYColumns, outputError })
70
- .storeOptionsAsProperties()
71
70
  .name('antora')
72
71
  .version(
73
72
  {
@@ -97,14 +96,16 @@ cli
97
96
  const name = cli.name()
98
97
  return cli
99
98
  .createHelp()
100
- .wrap(
99
+ .boxWrap(
101
100
  ` \nRun '${name} <command> --help' to see options and examples for a command (e.g., ${name} generate --help).`,
102
101
  getTTYColumns(),
103
102
  0
104
103
  )
105
104
  })
106
105
  .option('-r, --require <library>', 'Require library (aka node module) or script path before executing command.')
107
- .on('option:require', (requireRequest) => (cli.requireRequests = cli.requireRequests || []).push(requireRequest))
106
+ .on('option:require', (requireRequest) => {
107
+ cli.setOptionValueWithSource('requires', (cli.getOptionValue('requires') || []).concat(requireRequest), 'cli')
108
+ })
108
109
  .option('--stacktrace', 'Print the stacktrace to the console if the application fails.')
109
110
 
110
111
  cli
@@ -113,12 +114,13 @@ cli
113
114
  .optionsFromConvict(convict(buildPlaybook.defaultSchema), { exclude: 'playbook' })
114
115
  .trackOptions()
115
116
  .action(async (playbookFile, _options, command) => {
116
- const errorOpts = { stacktrace: cli.stacktrace, silent: command.silent }
117
+ const errorOpts = { stacktrace: cli.getOptionValue('stacktrace'), silent: command.getOptionValue('silent') }
117
118
  const playbookDir = ospath.resolve(playbookFile, '..')
118
119
  const userRequireContext = { dot: playbookDir, paths: [playbookDir, __dirname] }
119
- if (cli.requireRequests) {
120
+ const requires = cli.getOptionValue('requires') || []
121
+ if (requires.length) {
120
122
  try {
121
- cli.requireRequests.forEach((requireRequest) => userRequire(requireRequest, userRequireContext))
123
+ requires.forEach((requireRequest) => userRequire(requireRequest, userRequireContext))
122
124
  } catch (err) {
123
125
  return exitWithError(err, errorOpts)
124
126
  }
@@ -5,7 +5,6 @@ const { Command } = require('commander')
5
5
  Command.prototype.trackOptions = function () {
6
6
  const optionArgs = (this.optionArgs = [])
7
7
  for (const eventName of this.eventNames().filter((name) => name.startsWith('option:'))) {
8
- // biome-ignore lint/complexity/useArrowFunction: needed to access arguments
9
8
  this.on(eventName, function () {
10
9
  optionArgs.push(`--${eventName.slice(7)}`)
11
10
  if (arguments.length) optionArgs.push(arguments[0])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/cli",
3
- "version": "3.2.0-alpha.11",
3
+ "version": "3.2.0-alpha.12",
4
4
  "description": "The command line interface for Antora.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -29,17 +29,16 @@
29
29
  "antora": "bin/antora"
30
30
  },
31
31
  "dependencies": {
32
- "@antora/logger": "3.2.0-alpha.11",
33
- "@antora/playbook-builder": "3.2.0-alpha.11",
32
+ "@antora/logger": "3.2.0-alpha.12",
33
+ "@antora/playbook-builder": "3.2.0-alpha.12",
34
34
  "@antora/user-require-helper": "~3.0",
35
- "commander": "~12.1"
35
+ "commander": "~13.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@antora/site-generator": "3.2.0-alpha.11",
39
- "@antora/site-publisher": "3.2.0-alpha.11",
38
+ "@antora/site-generator": "3.2.0-alpha.12",
39
+ "@antora/site-publisher": "3.2.0-alpha.12",
40
40
  "@asciidoctor/core": "~2.2",
41
- "convict": "~6.2",
42
- "kapok-js": "~0.10"
41
+ "convict": "~6.2"
43
42
  },
44
43
  "engines": {
45
44
  "node": ">=18.0.0"
@@ -57,7 +56,7 @@
57
56
  "web publishing"
58
57
  ],
59
58
  "scripts": {
60
- "test": "_mocha",
59
+ "test": "node --test",
61
60
  "prepublishOnly": "npx -y downdoc@latest --prepublish",
62
61
  "postpublish": "npx -y downdoc@latest --postpublish"
63
62
  }