@thegetty/quire-cli 1.0.0-rc.45 → 1.0.0-rc.47
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/CHANGELOG.md +0 -36
- package/README.md +0 -9
- package/bin/cli.js +1 -46
- package/package.json +10 -27
- package/src/Command.js +6 -26
- package/src/commands/README.md +122 -213
- package/src/commands/build.js +37 -45
- package/src/commands/clean.js +19 -33
- package/src/commands/conf.js +43 -0
- package/src/commands/create.js +14 -42
- package/src/commands/epub.js +31 -67
- package/src/commands/index.js +2 -9
- package/src/commands/info.js +86 -88
- package/src/commands/pdf.js +82 -63
- package/src/commands/preview.js +31 -32
- package/src/commands/validate.js +20 -64
- package/src/commands/version.js +43 -0
- package/src/errors/validation/validation-error.js +11 -20
- package/src/helpers/clean.js +1 -1
- package/src/helpers/is-quire.js +31 -0
- package/src/helpers/test-cwd.js +6 -5
- package/src/helpers/which.js +4 -10
- package/src/lib/11ty/README.md +19 -135
- package/src/lib/11ty/api.js +93 -235
- package/src/lib/11ty/cli.js +37 -112
- package/src/lib/11ty/index.js +5 -64
- package/src/lib/11ty/paths.js +103 -0
- package/src/lib/README.md +0 -330
- package/src/lib/conf/README.md +69 -86
- package/src/lib/conf/config.js +3 -5
- package/src/lib/conf/defaults.js +0 -65
- package/src/lib/conf/schema.js +9 -103
- package/src/lib/epub/README.md +2 -133
- package/src/lib/epub/epub.js +11 -36
- package/src/lib/epub/index.js +21 -111
- package/src/lib/epub/pandoc.js +4 -33
- package/src/lib/git/README.md +2 -151
- package/src/lib/git/index.js +13 -217
- package/src/lib/i18n/README.md +3 -0
- package/src/lib/i18n/config.js +53 -0
- package/src/lib/i18n/index.js +43 -0
- package/src/lib/i18n/localeService.js +58 -0
- package/src/lib/pdf/README.md +0 -131
- package/src/lib/pdf/index.js +21 -124
- package/src/lib/pdf/paged.js +52 -100
- package/src/lib/pdf/prince.js +37 -115
- package/src/lib/pdf/split.js +33 -61
- package/src/lib/quire/README.md +19 -0
- package/src/lib/quire/index.js +353 -0
- package/src/lib/reporter/README.md +2 -211
- package/src/lib/reporter/index.js +0 -607
- package/src/main.js +48 -221
- package/src/packageConfig.js +0 -17
- package/src/validators/utils.js +1 -2
- package/man/quire.1 +0 -341
- package/man/quire.1.md +0 -232
- package/schemas/config.schema.json +0 -194
- package/schemas/figures.schema.json +0 -56
- package/schemas/layout.schema.json +0 -5
- package/schemas/objects.schema.json +0 -62
- package/schemas/publication.schema.json +0 -140
- package/schemas/references.schema.json +0 -29
- package/src/Command.spec.js +0 -99
- package/src/commands/build.spec.js +0 -113
- package/src/commands/build.test.js +0 -397
- package/src/commands/clean.spec.js +0 -118
- package/src/commands/clean.test.js +0 -382
- package/src/commands/config.js +0 -238
- package/src/commands/config.spec.js +0 -107
- package/src/commands/config.test.js +0 -845
- package/src/commands/create.spec.js +0 -112
- package/src/commands/create.test.js +0 -415
- package/src/commands/doctor.js +0 -251
- package/src/commands/doctor.spec.js +0 -115
- package/src/commands/doctor.test.js +0 -1409
- package/src/commands/epub.spec.js +0 -114
- package/src/commands/epub.test.js +0 -503
- package/src/commands/help.js +0 -60
- package/src/commands/help.test.js +0 -132
- package/src/commands/info.spec.js +0 -72
- package/src/commands/info.test.js +0 -512
- package/src/commands/pdf.spec.js +0 -114
- package/src/commands/pdf.test.js +0 -464
- package/src/commands/preview.spec.js +0 -97
- package/src/commands/preview.test.js +0 -250
- package/src/commands/use.js +0 -56
- package/src/commands/use.spec.js +0 -61
- package/src/commands/use.test.js +0 -280
- package/src/commands/validate.spec.js +0 -90
- package/src/commands/validate.test.js +0 -378
- package/src/commands/workflows.js +0 -70
- package/src/errors/build/build-failed-error.js +0 -19
- package/src/errors/build/config-field-missing-error.js +0 -20
- package/src/errors/build/config-file-not-found-error.js +0 -20
- package/src/errors/build/index.js +0 -11
- package/src/errors/help/help-topic-not-found-error.js +0 -30
- package/src/errors/help/index.js +0 -8
- package/src/errors/index.js +0 -58
- package/src/errors/input/index.js +0 -8
- package/src/errors/input/invalid-input-error.js +0 -21
- package/src/errors/install/dependency-install-error.js +0 -19
- package/src/errors/install/directory-not-empty-error.js +0 -25
- package/src/errors/install/index.js +0 -12
- package/src/errors/install/invalid-path-error.js +0 -31
- package/src/errors/install/invalid-starter-error.js +0 -27
- package/src/errors/install/version-not-found-error.js +0 -35
- package/src/errors/output/epub-generation-error.js +0 -19
- package/src/errors/output/index.js +0 -14
- package/src/errors/output/invalid-epub-library-error.js +0 -20
- package/src/errors/output/invalid-pdf-library-error.js +0 -20
- package/src/errors/output/missing-build-output-error.js +0 -21
- package/src/errors/output/pdf-generation-error.js +0 -24
- package/src/errors/output/tool-not-found-error.js +0 -37
- package/src/errors/project/index.js +0 -10
- package/src/errors/project/not-in-project-error.js +0 -20
- package/src/errors/project/project-create-error.js +0 -21
- package/src/errors/quire-error.js +0 -27
- package/src/errors/validation/index.js +0 -3
- package/src/errors/validation/unknown-config-key-error.js +0 -27
- package/src/errors/validation/unknown-config-operation-error.js +0 -24
- package/src/helpers/docs-url.js +0 -32
- package/src/helpers/pager.js +0 -59
- package/src/helpers/pager.test.js +0 -85
- package/src/helpers/suggest-similar.js +0 -124
- package/src/helpers/suggest-similar.test.js +0 -108
- package/src/helpers/test-cwd.test.js +0 -192
- package/src/lib/11ty/index.test.js +0 -655
- package/src/lib/commander/index.js +0 -103
- package/src/lib/commander/index.test.js +0 -86
- package/src/lib/commander/options.js +0 -237
- package/src/lib/commander/options.test.js +0 -205
- package/src/lib/conf/build-status.js +0 -103
- package/src/lib/conf/build-status.test.js +0 -247
- package/src/lib/conf/config.test.js +0 -281
- package/src/lib/conf/format.js +0 -60
- package/src/lib/conf/format.test.js +0 -106
- package/src/lib/conf/helpers.js +0 -91
- package/src/lib/conf/helpers.test.js +0 -136
- package/src/lib/conf/index.js +0 -22
- package/src/lib/constants.js +0 -28
- package/src/lib/doctor/README.md +0 -667
- package/src/lib/doctor/checks/environment/cli-version.js +0 -62
- package/src/lib/doctor/checks/environment/cli-version.test.js +0 -132
- package/src/lib/doctor/checks/environment/git-available.js +0 -77
- package/src/lib/doctor/checks/environment/git-available.test.js +0 -52
- package/src/lib/doctor/checks/environment/index.js +0 -13
- package/src/lib/doctor/checks/environment/node-version.js +0 -66
- package/src/lib/doctor/checks/environment/node-version.test.js +0 -17
- package/src/lib/doctor/checks/environment/npm-available.js +0 -66
- package/src/lib/doctor/checks/environment/npm-available.test.js +0 -52
- package/src/lib/doctor/checks/environment/os-info.js +0 -48
- package/src/lib/doctor/checks/environment/os-info.test.js +0 -81
- package/src/lib/doctor/checks/environment/runtime-info.js +0 -51
- package/src/lib/doctor/checks/environment/runtime-info.test.js +0 -132
- package/src/lib/doctor/checks/outputs/epub-output.js +0 -119
- package/src/lib/doctor/checks/outputs/epub-output.test.js +0 -277
- package/src/lib/doctor/checks/outputs/index.js +0 -10
- package/src/lib/doctor/checks/outputs/pdf-output.js +0 -144
- package/src/lib/doctor/checks/outputs/pdf-output.test.js +0 -377
- package/src/lib/doctor/checks/outputs/stale-build.js +0 -122
- package/src/lib/doctor/checks/outputs/stale-build.test.js +0 -282
- package/src/lib/doctor/checks/project/data-files.js +0 -56
- package/src/lib/doctor/checks/project/data-files.test.js +0 -125
- package/src/lib/doctor/checks/project/dependencies.js +0 -53
- package/src/lib/doctor/checks/project/dependencies.test.js +0 -71
- package/src/lib/doctor/checks/project/index.js +0 -11
- package/src/lib/doctor/checks/project/quire-11ty.js +0 -98
- package/src/lib/doctor/checks/project/quire-11ty.test.js +0 -170
- package/src/lib/doctor/checks/project/quire-project.js +0 -38
- package/src/lib/doctor/checks/project/quire-project.test.js +0 -47
- package/src/lib/doctor/checks/tools/index.js +0 -10
- package/src/lib/doctor/checks/tools/pandoc-available.js +0 -82
- package/src/lib/doctor/checks/tools/pandoc-available.test.js +0 -73
- package/src/lib/doctor/checks/tools/prince-available.js +0 -81
- package/src/lib/doctor/checks/tools/prince-available.test.js +0 -73
- package/src/lib/doctor/constants.js +0 -39
- package/src/lib/doctor/formatDuration.js +0 -108
- package/src/lib/doctor/formatDuration.test.js +0 -76
- package/src/lib/doctor/formatters/human.js +0 -257
- package/src/lib/doctor/formatters/human.test.js +0 -463
- package/src/lib/doctor/formatters/index.js +0 -8
- package/src/lib/doctor/formatters/json.js +0 -78
- package/src/lib/doctor/formatters/json.test.js +0 -174
- package/src/lib/doctor/formatters/shared.js +0 -129
- package/src/lib/doctor/formatters/shared.test.js +0 -194
- package/src/lib/doctor/index.js +0 -271
- package/src/lib/doctor/index.test.js +0 -797
- package/src/lib/epub/engines.js +0 -46
- package/src/lib/epub/index.test.js +0 -518
- package/src/lib/epub/pandoc.test.js +0 -122
- package/src/lib/epub/schema.js +0 -21
- package/src/lib/error/README.md +0 -170
- package/src/lib/error/handler.js +0 -107
- package/src/lib/git/index.spec.js +0 -80
- package/src/lib/git/index.test.js +0 -453
- package/src/lib/help/frontmatter.js +0 -77
- package/src/lib/help/frontmatter.test.js +0 -139
- package/src/lib/help/index.js +0 -146
- package/src/lib/help/index.test.js +0 -188
- package/src/lib/help/topics/configuration.md +0 -77
- package/src/lib/help/topics/debugging.md +0 -69
- package/src/lib/help/topics/epub.md +0 -74
- package/src/lib/help/topics/pdf.md +0 -74
- package/src/lib/help/topics/publishing.md +0 -80
- package/src/lib/help/topics/workflows.md +0 -50
- package/src/lib/installer/index.js +0 -309
- package/src/lib/installer/index.spec.js +0 -83
- package/src/lib/installer/index.test.js +0 -545
- package/src/lib/logger/README.md +0 -424
- package/src/lib/logger/debug.js +0 -132
- package/src/lib/logger/debug.spec.js +0 -130
- package/src/lib/logger/debug.test.js +0 -128
- package/src/lib/logger/index.js +0 -228
- package/src/lib/logger/index.spec.js +0 -131
- package/src/lib/logger/index.test.js +0 -578
- package/src/lib/npm/README.md +0 -127
- package/src/lib/npm/index.js +0 -198
- package/src/lib/npm/index.spec.js +0 -60
- package/src/lib/npm/index.test.js +0 -355
- package/src/lib/pdf/engines.js +0 -46
- package/src/lib/pdf/index.test.js +0 -708
- package/src/lib/pdf/paged.test.js +0 -366
- package/src/lib/pdf/prince.test.js +0 -202
- package/src/lib/pdf/schema.js +0 -21
- package/src/lib/pdf/split.test.js +0 -445
- package/src/lib/platform.js +0 -95
- package/src/lib/process/manager.js +0 -110
- package/src/lib/process/manager.test.js +0 -55
- package/src/lib/project/build.js +0 -162
- package/src/lib/project/build.test.js +0 -275
- package/src/lib/project/config.js +0 -48
- package/src/lib/project/config.test.js +0 -134
- package/src/lib/project/detect.js +0 -47
- package/src/lib/project/detect.test.js +0 -157
- package/src/lib/project/index.js +0 -56
- package/src/lib/project/output-paths.js +0 -87
- package/src/lib/project/output-paths.test.js +0 -66
- package/src/lib/project/paths.js +0 -272
- package/src/lib/project/version.js +0 -110
- package/src/lib/project/version.test.js +0 -350
- package/src/lib/reporter/index.test.js +0 -862
- package/src/main.spec.js +0 -61
- package/src/main.test.js +0 -347
- package/src/validators/validate-data-files.js +0 -154
- package/src/validators/validate-data-files.test.js +0 -217
package/src/commands/README.md
CHANGED
|
@@ -1,292 +1,201 @@
|
|
|
1
|
-
|
|
1
|
+
## Quire CLI Commands
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### `build`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Build Quire publication outputs.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```sh
|
|
8
|
+
quire build
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
#### `epub`
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
import Command from '#src/Command.js'
|
|
13
|
+
Build Quire publication EPUB format.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
description: 'Description of what the command does',
|
|
18
|
-
summary: 'short summary for help text',
|
|
19
|
-
version: '1.0.0',
|
|
20
|
-
args: [
|
|
21
|
-
['<required-arg>', 'description of required argument'],
|
|
22
|
-
['[optional-arg]', 'description of optional argument', 'default-value']
|
|
23
|
-
],
|
|
24
|
-
options: [
|
|
25
|
-
['-f', '--flag', 'description of flag'],
|
|
26
|
-
['-o', '--option <value>', 'description of option with value', 'default']
|
|
27
|
-
]
|
|
28
|
-
}
|
|
15
|
+
```sh
|
|
16
|
+
quire build epub
|
|
17
|
+
```
|
|
29
18
|
|
|
30
|
-
|
|
31
|
-
super(MyCommand.definition)
|
|
32
|
-
}
|
|
19
|
+
#### `info`
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
// Use this.debug for developer debugging (controlled by DEBUG env var)
|
|
36
|
-
this.debug('called with options %O', options)
|
|
21
|
+
List `quire-11ty`, `quire-cli`, and starter package versions; use the `--debug` option to include node, npm, and os versions.
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
```sh
|
|
24
|
+
quire build info
|
|
25
|
+
```
|
|
40
26
|
|
|
41
|
-
|
|
42
|
-
}
|
|
27
|
+
#### `pdf`
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
// Optional: runs before action()
|
|
46
|
-
}
|
|
29
|
+
Build Quire publication PDF format.
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
31
|
+
```sh
|
|
32
|
+
quire build pdf
|
|
52
33
|
```
|
|
53
34
|
|
|
54
|
-
|
|
35
|
+
#### `site`
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
Build Quire publication HTML format.
|
|
57
38
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| `this.debug` | Function | Developer debugging via `DEBUG` env var |
|
|
62
|
-
| `this.config` | Conf | CLI configuration store |
|
|
39
|
+
```sh
|
|
40
|
+
quire build site
|
|
41
|
+
```
|
|
63
42
|
|
|
64
|
-
|
|
43
|
+
### `clean`
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
// Developer debugging - only shown when DEBUG=quire:commands:* is set
|
|
68
|
-
this.debug('processing file: %s', filename)
|
|
69
|
-
this.debug('options: %O', options)
|
|
45
|
+
Remove build outputs.
|
|
70
46
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
47
|
+
Note that this command is distinct from the [quire/11ty package](https://github.com/thegetty/quire/packages/11ty/package.json) script `clean`, to allow different behavoirs for Quire editors and developers.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
quire clean --dry-run
|
|
75
51
|
```
|
|
76
52
|
|
|
77
|
-
###
|
|
53
|
+
### `configure` **not yet implemented**
|
|
78
54
|
|
|
79
|
-
|
|
55
|
+
Edit the Quire CLI configuration.
|
|
80
56
|
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
├── my-command.js # Command implementation
|
|
84
|
-
├── my-command.spec.js # Unit tests (structure, options, definitions)
|
|
85
|
-
└── my-command.test.js # Integration tests (functionality with mocked deps)
|
|
57
|
+
```sh
|
|
58
|
+
quire configure
|
|
86
59
|
```
|
|
87
60
|
|
|
88
|
-
|
|
61
|
+
### `install` **not yet implemented**
|
|
89
62
|
|
|
90
|
-
|
|
63
|
+
Clone an existing Quire project from a git repository.
|
|
91
64
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
| **Integration** | `*.test.js` | Command functionality with mocked dependencies | `src/commands/` | Fast (seconds) |
|
|
96
|
-
| **E2E** | `*.e2e.js` | Complete workflows with real dependencies | `test/e2e/` | Slow (minutes) |
|
|
65
|
+
```sh
|
|
66
|
+
quire install <repository>
|
|
67
|
+
```
|
|
97
68
|
|
|
98
|
-
###
|
|
69
|
+
### `new`
|
|
99
70
|
|
|
100
|
-
|
|
71
|
+
Start a new Quire publication from a template project or clone an existing project from a git repository (equivalent to `install`).
|
|
101
72
|
|
|
102
|
-
|
|
103
|
-
- Command is properly defined: name, description, and version
|
|
104
|
-
- Command is properly instantiated
|
|
105
|
-
- Arguments and options are properly defined
|
|
106
|
-
- Method existence (action, preAction)
|
|
107
|
-
- No actual functionality testing
|
|
73
|
+
Running the `new` without any arguments will start an interactive prompt.
|
|
108
74
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
test('build command should have a dry-run option', (t) => {
|
|
112
|
-
const { command } = t.context
|
|
113
|
-
const dryRunOption = command.options.find((opt) => opt.flags.includes('--dry-run'))
|
|
114
|
-
t.truthy(dryRunOption)
|
|
115
|
-
})
|
|
75
|
+
```sh
|
|
76
|
+
quire new
|
|
116
77
|
```
|
|
117
78
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Integration tests verify command functionality with all external dependencies mocked.
|
|
121
|
-
|
|
122
|
-
**What they test:**
|
|
123
|
-
- Command execution flow
|
|
124
|
-
- Interaction with mocked dependencies
|
|
125
|
-
- Option handling
|
|
126
|
-
- Error scenarios
|
|
79
|
+
To start a new Quire project using the default starter run the following command:
|
|
127
80
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
- Uses `sinon` for function stubs
|
|
81
|
+
```sh
|
|
82
|
+
quire new <path>
|
|
83
|
+
```
|
|
132
84
|
|
|
133
|
-
|
|
134
|
-
```javascript
|
|
135
|
-
test('build command should call eleventy CLI with default options', async (t) => {
|
|
136
|
-
const { sandbox, fs } = t.context
|
|
85
|
+
To create a new project from a starter template
|
|
137
86
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
87
|
+
```sh
|
|
88
|
+
quire new <path> <starter>
|
|
89
|
+
```
|
|
141
90
|
|
|
142
|
-
|
|
143
|
-
'#lib/11ty/index.js': {
|
|
144
|
-
cli: mockEleventyCli,
|
|
145
|
-
paths: { output: '_site' },
|
|
146
|
-
projectRoot: '/project'
|
|
147
|
-
},
|
|
148
|
-
'fs-extra': fs
|
|
149
|
-
})
|
|
91
|
+
#### Specifying the `quire-11ty` version
|
|
150
92
|
|
|
151
|
-
|
|
152
|
-
await command.action({ '11ty': 'cli' }, command)
|
|
93
|
+
When the `--quire` flag is used the new project will be started using the specified version of `quire-11ty`
|
|
153
94
|
|
|
154
|
-
|
|
155
|
-
|
|
95
|
+
```sh
|
|
96
|
+
quire new <path> <starter> --quire <version>
|
|
156
97
|
```
|
|
157
98
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
E2E tests verify complete workflows using real dependencies.
|
|
99
|
+
##### Version identifiers
|
|
161
100
|
|
|
162
|
-
|
|
163
|
-
- Complete command workflows
|
|
164
|
-
- Cross-platform compatibility
|
|
165
|
-
- Real file system operations
|
|
166
|
-
- Real external processes
|
|
167
|
-
- Actual PDF/EPUB generation
|
|
101
|
+
The `--quire` flag must be either a semantic version identifier or a npm distribution tag. For example:
|
|
168
102
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
test('build command should create _site directory', async (t) => {
|
|
172
|
-
await exec('quire build')
|
|
173
|
-
t.true(fs.existsSync('./_site'))
|
|
174
|
-
})
|
|
103
|
+
```sh
|
|
104
|
+
quire new ./blargh --quire 1.0.0-rc.5
|
|
175
105
|
```
|
|
176
106
|
|
|
177
|
-
## Running Tests
|
|
178
|
-
|
|
179
107
|
```sh
|
|
180
|
-
|
|
181
|
-
|
|
108
|
+
quire new ./blargh --quire latest
|
|
109
|
+
```
|
|
182
110
|
|
|
183
|
-
|
|
184
|
-
npm run test:unit
|
|
111
|
+
### `preview`
|
|
185
112
|
|
|
186
|
-
|
|
187
|
-
npm run test:integration
|
|
113
|
+
Build and server the Quire site in development mode.
|
|
188
114
|
|
|
189
|
-
|
|
190
|
-
|
|
115
|
+
```sh
|
|
116
|
+
quire preview --port 8080
|
|
117
|
+
```
|
|
191
118
|
|
|
192
|
-
|
|
193
|
-
npm run test:watch
|
|
119
|
+
#### `epub` **not yet implemented**
|
|
194
120
|
|
|
195
|
-
|
|
196
|
-
|
|
121
|
+
Preview the Quire publication epub in the default application.
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
quire preview epub --open
|
|
197
125
|
```
|
|
198
126
|
|
|
199
|
-
|
|
127
|
+
#### `pdf` **not yet implemented**
|
|
200
128
|
|
|
201
|
-
|
|
129
|
+
Preview the Quire publication PDF in the default application.
|
|
202
130
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
131
|
+
```sh
|
|
132
|
+
quire preview pdf --open
|
|
133
|
+
```
|
|
206
134
|
|
|
207
|
-
|
|
135
|
+
#### `site` **default subcommand**
|
|
208
136
|
|
|
209
|
-
|
|
210
|
-
import test from 'ava'
|
|
211
|
-
import { Volume, createFsFromVolume } from 'memfs'
|
|
212
|
-
import sinon from 'sinon'
|
|
213
|
-
import esmock from 'esmock'
|
|
137
|
+
Build and serve the Quire site in development mode.
|
|
214
138
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
139
|
+
```sh
|
|
140
|
+
quire preview site
|
|
141
|
+
```
|
|
218
142
|
|
|
219
|
-
|
|
220
|
-
t.context.vol = new Volume()
|
|
221
|
-
t.context.fs = createFsFromVolume(t.context.vol)
|
|
143
|
+
### `server` **not yet implemented**
|
|
222
144
|
|
|
223
|
-
|
|
224
|
-
t.context.vol.fromJSON({
|
|
225
|
-
'/project/content/_data/config.yaml': 'title: Test Project',
|
|
226
|
-
'/project/package.json': JSON.stringify({ name: 'test-project' })
|
|
227
|
-
})
|
|
145
|
+
Start a local web server to serve a previously built Quire site.
|
|
228
146
|
|
|
229
|
-
|
|
230
|
-
|
|
147
|
+
```sh
|
|
148
|
+
quire server --port 8080
|
|
149
|
+
```
|
|
231
150
|
|
|
232
|
-
|
|
233
|
-
// Restore all mocks
|
|
234
|
-
t.context.sandbox.restore()
|
|
151
|
+
### `version` **partial implementation**
|
|
235
152
|
|
|
236
|
-
|
|
237
|
-
t.context.vol.reset()
|
|
238
|
-
})
|
|
153
|
+
Sets the Quire version to use when running commands on the project.
|
|
239
154
|
|
|
240
|
-
|
|
241
|
-
|
|
155
|
+
```sh
|
|
156
|
+
quire version 1.0.0
|
|
157
|
+
```
|
|
242
158
|
|
|
243
|
-
|
|
244
|
-
const mockDependency = sandbox.stub().resolves()
|
|
159
|
+
To set the quire version globally use the `--global` command flag.
|
|
245
160
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
'fs-extra': fs
|
|
250
|
-
})
|
|
161
|
+
```sh
|
|
162
|
+
quire version 1.0.0 --global
|
|
163
|
+
```
|
|
251
164
|
|
|
252
|
-
|
|
253
|
-
await command.action({}, command)
|
|
165
|
+
#### `install`
|
|
254
166
|
|
|
255
|
-
|
|
256
|
-
|
|
167
|
+
```sh
|
|
168
|
+
quire version install <version>
|
|
257
169
|
```
|
|
258
170
|
|
|
259
|
-
|
|
171
|
+
To reinstall a `quire-11ty` version run
|
|
260
172
|
|
|
261
|
-
|
|
173
|
+
```sh
|
|
174
|
+
quire version install <version> --force
|
|
175
|
+
```
|
|
262
176
|
|
|
263
|
-
|
|
264
|
-
- **esmock** - ES module mocking for imports
|
|
265
|
-
- **memfs** - In-memory file system for fast, isolated tests
|
|
266
|
-
- **sinon** - Stubbing and mocking for function calls
|
|
177
|
+
#### `list`
|
|
267
178
|
|
|
268
|
-
|
|
179
|
+
List installed versions of `quire-11ty`
|
|
269
180
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
- Test execution time should be < 5 minutes total (with mocking: < 30 seconds)
|
|
274
|
-
- Code coverage target: 80% for integration paths
|
|
181
|
+
```sh
|
|
182
|
+
quire version list
|
|
183
|
+
```
|
|
275
184
|
|
|
276
|
-
|
|
185
|
+
#### `prune`
|
|
277
186
|
|
|
278
|
-
|
|
279
|
-
- Extend the `Command` class
|
|
280
|
-
- Define static `definition` object
|
|
281
|
-
- Implement `action()` method
|
|
187
|
+
Remove outdated versions of `quire-11ty`
|
|
282
188
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
189
|
+
```sh
|
|
190
|
+
quire version prune
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### `remove` (alias `uninstall`)
|
|
287
194
|
|
|
288
|
-
|
|
289
|
-
|
|
195
|
+
```sh
|
|
196
|
+
quire version remove <version>
|
|
197
|
+
```
|
|
290
198
|
|
|
291
|
-
|
|
292
|
-
|
|
199
|
+
```sh
|
|
200
|
+
quire version uninstall <version>
|
|
201
|
+
```
|
package/src/commands/build.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
|
-
import {
|
|
3
|
-
import { withOutputModes } from '#lib/commander/index.js'
|
|
4
|
-
import { api, cli } from '#lib/11ty/index.js'
|
|
5
|
-
import paths from '#lib/project/index.js'
|
|
2
|
+
import { api, cli, paths, projectRoot } from '#lib/11ty/index.js'
|
|
6
3
|
import { clean } from '#helpers/clean.js'
|
|
7
|
-
import { recordStatus } from '#lib/conf/build-status.js'
|
|
8
|
-
import reporter from '#lib/reporter/index.js'
|
|
9
4
|
import testcwd from '#helpers/test-cwd.js'
|
|
10
5
|
|
|
11
6
|
/**
|
|
@@ -17,59 +12,56 @@ import testcwd from '#helpers/test-cwd.js'
|
|
|
17
12
|
* @extends {Command}
|
|
18
13
|
*/
|
|
19
14
|
export default class BuildCommand extends Command {
|
|
20
|
-
static definition =
|
|
15
|
+
static definition = {
|
|
21
16
|
name: 'build',
|
|
22
17
|
description: 'Generate publication outputs',
|
|
23
|
-
summary: '
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
version: '1.1.0',
|
|
18
|
+
summary: 'run build',
|
|
19
|
+
version: '1.0.0',
|
|
20
|
+
args: [
|
|
21
|
+
// [
|
|
22
|
+
// '[formats...]', 'output formats',
|
|
23
|
+
// {
|
|
24
|
+
// choices: ['pdf', 'epub'],
|
|
25
|
+
// }
|
|
26
|
+
// ],
|
|
27
|
+
],
|
|
34
28
|
options: [
|
|
35
29
|
[ '-d', '--dry-run', 'run build without writing files' ],
|
|
36
|
-
[ '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
[ '-q', '--quiet', 'run build with no console messages' ],
|
|
31
|
+
[ '-v', '--verbose', 'run build with verbose console messages' ],
|
|
32
|
+
[
|
|
33
|
+
'--11ty <module>', 'use the specified 11ty module', 'cli',
|
|
34
|
+
// { choices: ['api', 'cli'], default: 'cli' }
|
|
35
|
+
],
|
|
36
|
+
[ '--debug', 'run build with debug output to console' ],
|
|
40
37
|
],
|
|
41
|
-
}
|
|
38
|
+
}
|
|
42
39
|
|
|
43
40
|
constructor() {
|
|
44
41
|
super(BuildCommand.definition)
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
reporter.configure({ quiet: options.quiet, verbose: options.verbose })
|
|
44
|
+
action(options, command) {
|
|
45
|
+
if (options.debug) {
|
|
46
|
+
console.debug('[CLI] Command \'%s\' called with options %o', this.name(), options)
|
|
47
|
+
}
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await cli.build(options)
|
|
60
|
-
}
|
|
61
|
-
recordStatus(paths.getProjectRoot(), 'build', 'ok')
|
|
62
|
-
} catch (error) {
|
|
63
|
-
recordStatus(paths.getProjectRoot(), 'build', 'failed')
|
|
64
|
-
throw error
|
|
49
|
+
if (options['11ty'] === 'cli') {
|
|
50
|
+
console.debug('[CLI] running eleventy using lib/11ty cli')
|
|
51
|
+
cli.build(options)
|
|
52
|
+
} else {
|
|
53
|
+
console.debug('[CLI] running eleventy using lib/11ty api')
|
|
54
|
+
api.build(options)
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
57
|
|
|
68
|
-
preAction(
|
|
69
|
-
testcwd(
|
|
58
|
+
preAction(command) {
|
|
59
|
+
testcwd(command)
|
|
70
60
|
|
|
71
|
-
const options =
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
const options = command.opts()
|
|
62
|
+
if (options.debug) {
|
|
63
|
+
console.debug('[CLI] Calling \'build\' command pre-action with options', options)
|
|
64
|
+
}
|
|
65
|
+
clean(projectRoot, paths, options)
|
|
74
66
|
}
|
|
75
67
|
}
|
package/src/commands/clean.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
|
-
import { withOutputModes } from '#lib/commander/index.js'
|
|
3
2
|
import { clean } from '#helpers/clean.js'
|
|
4
|
-
import {
|
|
5
|
-
import paths from '#lib/project/index.js'
|
|
3
|
+
import { paths, projectRoot } from '#lib/11ty/index.js'
|
|
6
4
|
import testcwd from '#helpers/test-cwd.js'
|
|
7
5
|
|
|
8
6
|
/**
|
|
@@ -17,51 +15,39 @@ import testcwd from '#helpers/test-cwd.js'
|
|
|
17
15
|
* @extends {Command}
|
|
18
16
|
*/
|
|
19
17
|
export default class CleanCommand extends Command {
|
|
20
|
-
static definition =
|
|
18
|
+
static definition = {
|
|
21
19
|
name: 'clean',
|
|
22
20
|
description: 'Remove build outputs',
|
|
23
|
-
summary: '
|
|
24
|
-
docsLink: 'quire-commands/#output-files',
|
|
25
|
-
helpText: `
|
|
26
|
-
Examples:
|
|
27
|
-
quire clean Remove build outputs
|
|
28
|
-
quire clean --dry-run Preview files to be deleted
|
|
29
|
-
quire clean --verbose Clean with detailed progress
|
|
30
|
-
`,
|
|
21
|
+
summary: 'remove build outputs',
|
|
31
22
|
version: '1.0.0',
|
|
23
|
+
args: [],
|
|
32
24
|
options: [
|
|
33
|
-
[ '-d, --dry-run', 'show paths to be cleaned without deleting files' ],
|
|
34
|
-
[ '
|
|
35
|
-
[ '--
|
|
25
|
+
[ '-d', '--dry-run', 'show paths to be cleaned without deleting files' ],
|
|
26
|
+
[ '-p', '--progress', 'display progress of removing files' ],
|
|
27
|
+
[ '-v', '--verbose', 'run clean with verbose console messages' ],
|
|
28
|
+
[ '--debug', 'run clean with debug output to console' ],
|
|
36
29
|
],
|
|
37
|
-
}
|
|
30
|
+
}
|
|
38
31
|
|
|
39
32
|
constructor() {
|
|
40
33
|
super(CleanCommand.definition)
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
async action(options, command) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const projectRoot = paths.getProjectRoot()
|
|
47
|
-
const deletedPaths = await clean(projectRoot, paths.toObject(), options)
|
|
48
|
-
|
|
49
|
-
if (options.status && !options.dryRun) {
|
|
50
|
-
clearStatus(projectRoot)
|
|
51
|
-
this.logger.info('Cleared build status for this project')
|
|
37
|
+
if (options.debug) {
|
|
38
|
+
console.debug('[CLI] Command \'%s\' called with options %o', this.name(), options)
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
const deletedPaths = await clean(projectRoot, paths, options)
|
|
42
|
+
|
|
43
|
+
const message = deletedPaths && deletedPaths.length
|
|
44
|
+
? `the following files ${options.dryRun ? 'will be' : 'have been'} deleted:`
|
|
45
|
+
: 'no files to delete'
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
const listing = deletedPaths.map((p) => ` ${p}`).join('\n')
|
|
61
|
-
this.logger.info(`${verb} ${deletedPaths.length} file(s):\n${listing}`)
|
|
47
|
+
console.debug(`[CLI] ${message}\n${deletedPaths.join('\n')}`)
|
|
62
48
|
}
|
|
63
49
|
|
|
64
|
-
preAction(
|
|
65
|
-
testcwd(
|
|
50
|
+
preAction(command) {
|
|
51
|
+
testcwd(command)
|
|
66
52
|
}
|
|
67
53
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Command from '#src/Command.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quire CLI `conf` Command
|
|
5
|
+
*
|
|
6
|
+
* @class ConfCommand
|
|
7
|
+
* @extends {Command}
|
|
8
|
+
*/
|
|
9
|
+
export default class ConfCommand extends Command {
|
|
10
|
+
static definition = {
|
|
11
|
+
name: 'conf',
|
|
12
|
+
aliases: ['config', 'configure'],
|
|
13
|
+
description: 'Manage the Quire CLI configuration.',
|
|
14
|
+
summary: 'read/write quire-cli configuration options',
|
|
15
|
+
version: '1.0.0',
|
|
16
|
+
options: [
|
|
17
|
+
[ '--debug', 'run command in debug mode' ],
|
|
18
|
+
],
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
super(ConfCommand.definition)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {Object} options
|
|
27
|
+
* @return {Promise}
|
|
28
|
+
*/
|
|
29
|
+
async action(key, value, options = {}) {
|
|
30
|
+
if (options.debug) {
|
|
31
|
+
console.info('Command \'%s\' called with options %o', this.name(), options)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// this.outputHelp()
|
|
35
|
+
|
|
36
|
+
console.info('quire-cli configuration %s', this.config.path)
|
|
37
|
+
|
|
38
|
+
for (const [ key, value ] of Object.entries(this.config.store)) {
|
|
39
|
+
if (key.startsWith('__internal__') && !options.debug) continue
|
|
40
|
+
console.info('%s: %O', key, value)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|