@antora/cli 3.2.0-alpha.1 → 3.2.0-alpha.10
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 +3 -3
- package/lib/cli.js +5 -5
- package/lib/commander/options-from-convict.js +2 -2
- package/lib/commander/track-options.js +1 -0
- package/package.json +15 -10
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Once these packages are installed, you can use the `antora` command to generate
|
|
|
12
12
|
|
|
13
13
|
## How to Install
|
|
14
14
|
|
|
15
|
-
Let
|
|
15
|
+
Let’s start by installing the CLI.
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
npm i -g @antora/cli
|
|
@@ -36,7 +36,7 @@ The `antora` command (specifically the implicit `generate` subcommand) will look
|
|
|
36
36
|
|
|
37
37
|
## How to Use
|
|
38
38
|
|
|
39
|
-
To run Antora, you
|
|
39
|
+
To run Antora, you’ll need a playbook file and at least one content (source) repository.
|
|
40
40
|
Consult the [quickstart](https://docs.antora.org/antora/latest/install-and-run-quickstart/) to find an example.
|
|
41
41
|
|
|
42
42
|
Once you have your content sources set up, point the `antora` command at your playbook file:
|
|
@@ -45,7 +45,7 @@ Once you have your content sources set up, point the `antora` command at your pl
|
|
|
45
45
|
antora antora-playbook.yml
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
The `antora` command will output the generated site to the
|
|
48
|
+
The `antora` command will output the generated site to the _build/site_ folder by default.
|
|
49
49
|
|
|
50
50
|
## Copyright and License
|
|
51
51
|
|
package/lib/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const buildPlaybook = require('@antora/playbook-builder')
|
|
4
|
-
const cli = require('./commander')
|
|
4
|
+
const { program: cli } = require('./commander')
|
|
5
5
|
const convict = require('@antora/playbook-builder/lib/solitary-convict') // drop lib segment in Antora 4
|
|
6
|
-
const ospath = require('path')
|
|
6
|
+
const ospath = require('node:path')
|
|
7
7
|
const userRequire = require('@antora/user-require-helper')
|
|
8
8
|
|
|
9
9
|
const { version: VERSION } = require('../package.json')
|
|
@@ -90,7 +90,7 @@ cli
|
|
|
90
90
|
'-v, --version',
|
|
91
91
|
'Output the version of the CLI and default site generator.'
|
|
92
92
|
)
|
|
93
|
-
.description('A modular, multi-repository documentation site generator for AsciiDoc.')
|
|
93
|
+
.description('A modular, single or multi-repository documentation site generator for AsciiDoc.')
|
|
94
94
|
.usage('[options] [[command] [args]]')
|
|
95
95
|
.helpOption('-h, --help', 'Output usage information.')
|
|
96
96
|
.addHelpText('after', () => {
|
|
@@ -112,7 +112,7 @@ cli
|
|
|
112
112
|
.description('Generate a documentation site as specified by <playbook>.')
|
|
113
113
|
.optionsFromConvict(convict(buildPlaybook.defaultSchema), { exclude: 'playbook' })
|
|
114
114
|
.trackOptions()
|
|
115
|
-
.action(async (playbookFile,
|
|
115
|
+
.action(async (playbookFile, _options, command) => {
|
|
116
116
|
const errorOpts = { stacktrace: cli.stacktrace, silent: command.silent }
|
|
117
117
|
const playbookDir = ospath.resolve(playbookFile, '..')
|
|
118
118
|
const userRequireContext = { dot: playbookDir, paths: [playbookDir, __dirname] }
|
|
@@ -152,7 +152,7 @@ cli
|
|
|
152
152
|
})
|
|
153
153
|
.options.sort((a, b) => a.long.localeCompare(b.long))
|
|
154
154
|
|
|
155
|
-
cli.command('help [command]', { hidden: true }).action((name
|
|
155
|
+
cli.command('help [command]', { hidden: true }).action((name) => {
|
|
156
156
|
if (name) {
|
|
157
157
|
const helpCommand = cli._findCommand(name)
|
|
158
158
|
if (helpCommand) {
|
|
@@ -6,7 +6,7 @@ Command.prototype.optionsFromConvict = function (convictConfig, opts = {}) {
|
|
|
6
6
|
let exclude = opts.exclude
|
|
7
7
|
if (exclude && !Array.isArray(exclude)) exclude = [exclude]
|
|
8
8
|
getOptions(convictConfig).forEach(({ name, form, description, default: default_, choices }) => {
|
|
9
|
-
if (exclude
|
|
9
|
+
if (exclude?.includes(name)) return
|
|
10
10
|
this.addOption(
|
|
11
11
|
choices
|
|
12
12
|
? this.createOption(form, description).default(default_, default_).choices(choices)
|
|
@@ -39,7 +39,7 @@ function collectOptions (props, context = undefined) {
|
|
|
39
39
|
if (default_ === null) {
|
|
40
40
|
//option.mandatory = true
|
|
41
41
|
option.description += ' (required)'
|
|
42
|
-
} else if (default_ && default_
|
|
42
|
+
} else if (default_ && typeof default_ !== 'object') {
|
|
43
43
|
option.default = default_
|
|
44
44
|
}
|
|
45
45
|
accum.push(option)
|
|
@@ -5,6 +5,7 @@ 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
|
|
8
9
|
this.on(eventName, function () {
|
|
9
10
|
optionArgs.push(`--${eventName.slice(7)}`)
|
|
10
11
|
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.
|
|
3
|
+
"version": "3.2.0-alpha.10",
|
|
4
4
|
"description": "The command line interface for Antora.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
"Sarah White <sarah@opendevise.com>"
|
|
10
10
|
],
|
|
11
11
|
"homepage": "https://antora.org",
|
|
12
|
-
"repository":
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://gitlab.com/antora/antora.git",
|
|
15
|
+
"directory": "packages/cli"
|
|
16
|
+
},
|
|
13
17
|
"bugs": {
|
|
14
18
|
"url": "https://gitlab.com/antora/antora/issues"
|
|
15
19
|
},
|
|
@@ -25,19 +29,20 @@
|
|
|
25
29
|
"antora": "bin/antora"
|
|
26
30
|
},
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"@antora/logger": "3.2.0-alpha.
|
|
29
|
-
"@antora/playbook-builder": "3.2.0-alpha.
|
|
30
|
-
"@antora/user-require-helper": "~
|
|
31
|
-
"commander": "~
|
|
32
|
+
"@antora/logger": "3.2.0-alpha.10",
|
|
33
|
+
"@antora/playbook-builder": "3.2.0-alpha.10",
|
|
34
|
+
"@antora/user-require-helper": "~3.0",
|
|
35
|
+
"commander": "~12.1"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"@antora/site-
|
|
38
|
+
"@antora/site-generator": "3.2.0-alpha.10",
|
|
39
|
+
"@antora/site-publisher": "3.2.0-alpha.10",
|
|
35
40
|
"@asciidoctor/core": "~2.2",
|
|
36
41
|
"convict": "~6.2",
|
|
37
42
|
"kapok-js": "~0.10"
|
|
38
43
|
},
|
|
39
44
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
45
|
+
"node": ">=18.0.0"
|
|
41
46
|
},
|
|
42
47
|
"files": [
|
|
43
48
|
"bin/",
|
|
@@ -53,7 +58,7 @@
|
|
|
53
58
|
],
|
|
54
59
|
"scripts": {
|
|
55
60
|
"test": "_mocha",
|
|
56
|
-
"prepublishOnly": "
|
|
57
|
-
"postpublish": "
|
|
61
|
+
"prepublishOnly": "npx -y downdoc@latest --prepublish",
|
|
62
|
+
"postpublish": "npx -y downdoc@latest --postpublish"
|
|
58
63
|
}
|
|
59
64
|
}
|