@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.
Files changed (245) hide show
  1. package/CHANGELOG.md +0 -36
  2. package/README.md +0 -9
  3. package/bin/cli.js +1 -46
  4. package/package.json +10 -27
  5. package/src/Command.js +6 -26
  6. package/src/commands/README.md +122 -213
  7. package/src/commands/build.js +37 -45
  8. package/src/commands/clean.js +19 -33
  9. package/src/commands/conf.js +43 -0
  10. package/src/commands/create.js +14 -42
  11. package/src/commands/epub.js +31 -67
  12. package/src/commands/index.js +2 -9
  13. package/src/commands/info.js +86 -88
  14. package/src/commands/pdf.js +82 -63
  15. package/src/commands/preview.js +31 -32
  16. package/src/commands/validate.js +20 -64
  17. package/src/commands/version.js +43 -0
  18. package/src/errors/validation/validation-error.js +11 -20
  19. package/src/helpers/clean.js +1 -1
  20. package/src/helpers/is-quire.js +31 -0
  21. package/src/helpers/test-cwd.js +6 -5
  22. package/src/helpers/which.js +4 -10
  23. package/src/lib/11ty/README.md +19 -135
  24. package/src/lib/11ty/api.js +93 -235
  25. package/src/lib/11ty/cli.js +37 -112
  26. package/src/lib/11ty/index.js +5 -64
  27. package/src/lib/11ty/paths.js +103 -0
  28. package/src/lib/README.md +0 -330
  29. package/src/lib/conf/README.md +69 -86
  30. package/src/lib/conf/config.js +3 -5
  31. package/src/lib/conf/defaults.js +0 -65
  32. package/src/lib/conf/schema.js +9 -103
  33. package/src/lib/epub/README.md +2 -133
  34. package/src/lib/epub/epub.js +11 -36
  35. package/src/lib/epub/index.js +21 -111
  36. package/src/lib/epub/pandoc.js +4 -33
  37. package/src/lib/git/README.md +2 -151
  38. package/src/lib/git/index.js +13 -217
  39. package/src/lib/i18n/README.md +3 -0
  40. package/src/lib/i18n/config.js +53 -0
  41. package/src/lib/i18n/index.js +43 -0
  42. package/src/lib/i18n/localeService.js +58 -0
  43. package/src/lib/pdf/README.md +0 -131
  44. package/src/lib/pdf/index.js +21 -124
  45. package/src/lib/pdf/paged.js +52 -100
  46. package/src/lib/pdf/prince.js +37 -115
  47. package/src/lib/pdf/split.js +33 -61
  48. package/src/lib/quire/README.md +19 -0
  49. package/src/lib/quire/index.js +353 -0
  50. package/src/lib/reporter/README.md +2 -211
  51. package/src/lib/reporter/index.js +0 -607
  52. package/src/main.js +48 -221
  53. package/src/packageConfig.js +0 -17
  54. package/src/validators/utils.js +1 -2
  55. package/man/quire.1 +0 -341
  56. package/man/quire.1.md +0 -232
  57. package/schemas/config.schema.json +0 -194
  58. package/schemas/figures.schema.json +0 -56
  59. package/schemas/layout.schema.json +0 -5
  60. package/schemas/objects.schema.json +0 -62
  61. package/schemas/publication.schema.json +0 -140
  62. package/schemas/references.schema.json +0 -29
  63. package/src/Command.spec.js +0 -99
  64. package/src/commands/build.spec.js +0 -113
  65. package/src/commands/build.test.js +0 -397
  66. package/src/commands/clean.spec.js +0 -118
  67. package/src/commands/clean.test.js +0 -382
  68. package/src/commands/config.js +0 -238
  69. package/src/commands/config.spec.js +0 -107
  70. package/src/commands/config.test.js +0 -845
  71. package/src/commands/create.spec.js +0 -112
  72. package/src/commands/create.test.js +0 -415
  73. package/src/commands/doctor.js +0 -251
  74. package/src/commands/doctor.spec.js +0 -115
  75. package/src/commands/doctor.test.js +0 -1409
  76. package/src/commands/epub.spec.js +0 -114
  77. package/src/commands/epub.test.js +0 -503
  78. package/src/commands/help.js +0 -60
  79. package/src/commands/help.test.js +0 -132
  80. package/src/commands/info.spec.js +0 -72
  81. package/src/commands/info.test.js +0 -512
  82. package/src/commands/pdf.spec.js +0 -114
  83. package/src/commands/pdf.test.js +0 -464
  84. package/src/commands/preview.spec.js +0 -97
  85. package/src/commands/preview.test.js +0 -250
  86. package/src/commands/use.js +0 -56
  87. package/src/commands/use.spec.js +0 -61
  88. package/src/commands/use.test.js +0 -280
  89. package/src/commands/validate.spec.js +0 -90
  90. package/src/commands/validate.test.js +0 -378
  91. package/src/commands/workflows.js +0 -70
  92. package/src/errors/build/build-failed-error.js +0 -19
  93. package/src/errors/build/config-field-missing-error.js +0 -20
  94. package/src/errors/build/config-file-not-found-error.js +0 -20
  95. package/src/errors/build/index.js +0 -11
  96. package/src/errors/help/help-topic-not-found-error.js +0 -30
  97. package/src/errors/help/index.js +0 -8
  98. package/src/errors/index.js +0 -58
  99. package/src/errors/input/index.js +0 -8
  100. package/src/errors/input/invalid-input-error.js +0 -21
  101. package/src/errors/install/dependency-install-error.js +0 -19
  102. package/src/errors/install/directory-not-empty-error.js +0 -25
  103. package/src/errors/install/index.js +0 -12
  104. package/src/errors/install/invalid-path-error.js +0 -31
  105. package/src/errors/install/invalid-starter-error.js +0 -27
  106. package/src/errors/install/version-not-found-error.js +0 -35
  107. package/src/errors/output/epub-generation-error.js +0 -19
  108. package/src/errors/output/index.js +0 -14
  109. package/src/errors/output/invalid-epub-library-error.js +0 -20
  110. package/src/errors/output/invalid-pdf-library-error.js +0 -20
  111. package/src/errors/output/missing-build-output-error.js +0 -21
  112. package/src/errors/output/pdf-generation-error.js +0 -24
  113. package/src/errors/output/tool-not-found-error.js +0 -37
  114. package/src/errors/project/index.js +0 -10
  115. package/src/errors/project/not-in-project-error.js +0 -20
  116. package/src/errors/project/project-create-error.js +0 -21
  117. package/src/errors/quire-error.js +0 -27
  118. package/src/errors/validation/index.js +0 -3
  119. package/src/errors/validation/unknown-config-key-error.js +0 -27
  120. package/src/errors/validation/unknown-config-operation-error.js +0 -24
  121. package/src/helpers/docs-url.js +0 -32
  122. package/src/helpers/pager.js +0 -59
  123. package/src/helpers/pager.test.js +0 -85
  124. package/src/helpers/suggest-similar.js +0 -124
  125. package/src/helpers/suggest-similar.test.js +0 -108
  126. package/src/helpers/test-cwd.test.js +0 -192
  127. package/src/lib/11ty/index.test.js +0 -655
  128. package/src/lib/commander/index.js +0 -103
  129. package/src/lib/commander/index.test.js +0 -86
  130. package/src/lib/commander/options.js +0 -237
  131. package/src/lib/commander/options.test.js +0 -205
  132. package/src/lib/conf/build-status.js +0 -103
  133. package/src/lib/conf/build-status.test.js +0 -247
  134. package/src/lib/conf/config.test.js +0 -281
  135. package/src/lib/conf/format.js +0 -60
  136. package/src/lib/conf/format.test.js +0 -106
  137. package/src/lib/conf/helpers.js +0 -91
  138. package/src/lib/conf/helpers.test.js +0 -136
  139. package/src/lib/conf/index.js +0 -22
  140. package/src/lib/constants.js +0 -28
  141. package/src/lib/doctor/README.md +0 -667
  142. package/src/lib/doctor/checks/environment/cli-version.js +0 -62
  143. package/src/lib/doctor/checks/environment/cli-version.test.js +0 -132
  144. package/src/lib/doctor/checks/environment/git-available.js +0 -77
  145. package/src/lib/doctor/checks/environment/git-available.test.js +0 -52
  146. package/src/lib/doctor/checks/environment/index.js +0 -13
  147. package/src/lib/doctor/checks/environment/node-version.js +0 -66
  148. package/src/lib/doctor/checks/environment/node-version.test.js +0 -17
  149. package/src/lib/doctor/checks/environment/npm-available.js +0 -66
  150. package/src/lib/doctor/checks/environment/npm-available.test.js +0 -52
  151. package/src/lib/doctor/checks/environment/os-info.js +0 -48
  152. package/src/lib/doctor/checks/environment/os-info.test.js +0 -81
  153. package/src/lib/doctor/checks/environment/runtime-info.js +0 -51
  154. package/src/lib/doctor/checks/environment/runtime-info.test.js +0 -132
  155. package/src/lib/doctor/checks/outputs/epub-output.js +0 -119
  156. package/src/lib/doctor/checks/outputs/epub-output.test.js +0 -277
  157. package/src/lib/doctor/checks/outputs/index.js +0 -10
  158. package/src/lib/doctor/checks/outputs/pdf-output.js +0 -144
  159. package/src/lib/doctor/checks/outputs/pdf-output.test.js +0 -377
  160. package/src/lib/doctor/checks/outputs/stale-build.js +0 -122
  161. package/src/lib/doctor/checks/outputs/stale-build.test.js +0 -282
  162. package/src/lib/doctor/checks/project/data-files.js +0 -56
  163. package/src/lib/doctor/checks/project/data-files.test.js +0 -125
  164. package/src/lib/doctor/checks/project/dependencies.js +0 -53
  165. package/src/lib/doctor/checks/project/dependencies.test.js +0 -71
  166. package/src/lib/doctor/checks/project/index.js +0 -11
  167. package/src/lib/doctor/checks/project/quire-11ty.js +0 -98
  168. package/src/lib/doctor/checks/project/quire-11ty.test.js +0 -170
  169. package/src/lib/doctor/checks/project/quire-project.js +0 -38
  170. package/src/lib/doctor/checks/project/quire-project.test.js +0 -47
  171. package/src/lib/doctor/checks/tools/index.js +0 -10
  172. package/src/lib/doctor/checks/tools/pandoc-available.js +0 -82
  173. package/src/lib/doctor/checks/tools/pandoc-available.test.js +0 -73
  174. package/src/lib/doctor/checks/tools/prince-available.js +0 -81
  175. package/src/lib/doctor/checks/tools/prince-available.test.js +0 -73
  176. package/src/lib/doctor/constants.js +0 -39
  177. package/src/lib/doctor/formatDuration.js +0 -108
  178. package/src/lib/doctor/formatDuration.test.js +0 -76
  179. package/src/lib/doctor/formatters/human.js +0 -257
  180. package/src/lib/doctor/formatters/human.test.js +0 -463
  181. package/src/lib/doctor/formatters/index.js +0 -8
  182. package/src/lib/doctor/formatters/json.js +0 -78
  183. package/src/lib/doctor/formatters/json.test.js +0 -174
  184. package/src/lib/doctor/formatters/shared.js +0 -129
  185. package/src/lib/doctor/formatters/shared.test.js +0 -194
  186. package/src/lib/doctor/index.js +0 -271
  187. package/src/lib/doctor/index.test.js +0 -797
  188. package/src/lib/epub/engines.js +0 -46
  189. package/src/lib/epub/index.test.js +0 -518
  190. package/src/lib/epub/pandoc.test.js +0 -122
  191. package/src/lib/epub/schema.js +0 -21
  192. package/src/lib/error/README.md +0 -170
  193. package/src/lib/error/handler.js +0 -107
  194. package/src/lib/git/index.spec.js +0 -80
  195. package/src/lib/git/index.test.js +0 -453
  196. package/src/lib/help/frontmatter.js +0 -77
  197. package/src/lib/help/frontmatter.test.js +0 -139
  198. package/src/lib/help/index.js +0 -146
  199. package/src/lib/help/index.test.js +0 -188
  200. package/src/lib/help/topics/configuration.md +0 -77
  201. package/src/lib/help/topics/debugging.md +0 -69
  202. package/src/lib/help/topics/epub.md +0 -74
  203. package/src/lib/help/topics/pdf.md +0 -74
  204. package/src/lib/help/topics/publishing.md +0 -80
  205. package/src/lib/help/topics/workflows.md +0 -50
  206. package/src/lib/installer/index.js +0 -309
  207. package/src/lib/installer/index.spec.js +0 -83
  208. package/src/lib/installer/index.test.js +0 -545
  209. package/src/lib/logger/README.md +0 -424
  210. package/src/lib/logger/debug.js +0 -132
  211. package/src/lib/logger/debug.spec.js +0 -130
  212. package/src/lib/logger/debug.test.js +0 -128
  213. package/src/lib/logger/index.js +0 -228
  214. package/src/lib/logger/index.spec.js +0 -131
  215. package/src/lib/logger/index.test.js +0 -578
  216. package/src/lib/npm/README.md +0 -127
  217. package/src/lib/npm/index.js +0 -198
  218. package/src/lib/npm/index.spec.js +0 -60
  219. package/src/lib/npm/index.test.js +0 -355
  220. package/src/lib/pdf/engines.js +0 -46
  221. package/src/lib/pdf/index.test.js +0 -708
  222. package/src/lib/pdf/paged.test.js +0 -366
  223. package/src/lib/pdf/prince.test.js +0 -202
  224. package/src/lib/pdf/schema.js +0 -21
  225. package/src/lib/pdf/split.test.js +0 -445
  226. package/src/lib/platform.js +0 -95
  227. package/src/lib/process/manager.js +0 -110
  228. package/src/lib/process/manager.test.js +0 -55
  229. package/src/lib/project/build.js +0 -162
  230. package/src/lib/project/build.test.js +0 -275
  231. package/src/lib/project/config.js +0 -48
  232. package/src/lib/project/config.test.js +0 -134
  233. package/src/lib/project/detect.js +0 -47
  234. package/src/lib/project/detect.test.js +0 -157
  235. package/src/lib/project/index.js +0 -56
  236. package/src/lib/project/output-paths.js +0 -87
  237. package/src/lib/project/output-paths.test.js +0 -66
  238. package/src/lib/project/paths.js +0 -272
  239. package/src/lib/project/version.js +0 -110
  240. package/src/lib/project/version.test.js +0 -350
  241. package/src/lib/reporter/index.test.js +0 -862
  242. package/src/main.spec.js +0 -61
  243. package/src/main.test.js +0 -347
  244. package/src/validators/validate-data-files.js +0 -154
  245. package/src/validators/validate-data-files.test.js +0 -217
@@ -1,292 +1,201 @@
1
- # Quire CLI Commands
1
+ ## Quire CLI Commands
2
2
 
3
- This directory contains the Quire CLI command implementations and their corresponding tests.
3
+ ### `build`
4
4
 
5
- ## Command Class Pattern
5
+ Build Quire publication outputs.
6
6
 
7
- All Quire CLI commands extend the base `Command` class and follow a consistent pattern:
7
+ ```sh
8
+ quire build
9
+ ```
8
10
 
9
- ### Command Structure
11
+ #### `epub`
10
12
 
11
- ```javascript
12
- import Command from '#src/Command.js'
13
+ Build Quire publication EPUB format.
13
14
 
14
- export default class MyCommand extends Command {
15
- static definition = {
16
- name: 'my-command',
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
- constructor() {
31
- super(MyCommand.definition)
32
- }
19
+ #### `info`
33
20
 
34
- async action(args, options, command) {
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
- // Use this.logger for user-facing output
39
- this.logger.info('Starting operation...')
23
+ ```sh
24
+ quire build info
25
+ ```
40
26
 
41
- // Command implementation
42
- }
27
+ #### `pdf`
43
28
 
44
- preAction(command) {
45
- // Optional: runs before action()
46
- }
29
+ Build Quire publication PDF format.
47
30
 
48
- postAction(command) {
49
- // Optional: runs after action()
50
- }
51
- }
31
+ ```sh
32
+ quire build pdf
52
33
  ```
53
34
 
54
- ### Inherited Properties
35
+ #### `site`
55
36
 
56
- The base `Command` class provides these properties to all commands:
37
+ Build Quire publication HTML format.
57
38
 
58
- | Property | Type | Description |
59
- |----------|------|-------------|
60
- | `this.logger` | Logger | User-facing output with prefix `commands:{name}` |
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
- #### Using Logger vs Debug
43
+ ### `clean`
65
44
 
66
- ```javascript
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
- // User-facing output - always shown (unless silenced by log level)
72
- this.logger.info('Building PDF...')
73
- this.logger.warn('Deprecated option used')
74
- this.logger.error('Build failed: %s', error.message)
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
- ### File Organization
53
+ ### `configure` **not yet implemented**
78
54
 
79
- For each command, you'll find up to three types of files:
55
+ Edit the Quire CLI configuration.
80
56
 
81
- ```
82
- src/commands/
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
- ## Testing Strategy
61
+ ### `install` **not yet implemented**
89
62
 
90
- The Quire CLI uses a comprehensive three-tier testing strategy to ensure reliable command functionality:
63
+ Clone an existing Quire project from a git repository.
91
64
 
92
- | Test Type | Pattern | Purpose | Location | Speed |
93
- |-----------|---------|---------|----------|-------|
94
- | **Unit** | `*.spec.js` | Command structure, options, definitions | `src/commands/` | Very Fast (seconds) |
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
- ### Unit Tests (`*.spec.js`)
69
+ ### `new`
99
70
 
100
- Unit tests verify the command structure and configuration without executing any logic.
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
- **What they test:**
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
- **Example:**
110
- ```javascript
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
- ### Integration Tests (`*.test.js`)
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
- Test command functionality with mocked dependencies:
129
- - Uses `esmock` for ES module mocking
130
- - Uses `memfs` for in-memory file system
131
- - Uses `sinon` for function stubs
81
+ ```sh
82
+ quire new <path>
83
+ ```
132
84
 
133
- **Example:**
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
- const mockEleventyCli = {
139
- build: sandbox.stub().resolves({ exitCode: 0 })
140
- }
87
+ ```sh
88
+ quire new <path> <starter>
89
+ ```
141
90
 
142
- const BuildCommand = await esmock('./build.js', {
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
- const command = new BuildCommand()
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
- t.true(mockEleventyCli.build.called)
155
- })
95
+ ```sh
96
+ quire new <path> <starter> --quire <version>
156
97
  ```
157
98
 
158
- ### E2E Tests (`*.e2e.js`)
159
-
160
- E2E tests verify complete workflows using real dependencies.
99
+ ##### Version identifiers
161
100
 
162
- **What they test:**
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
- **Example:**
170
- ```javascript
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
- # Run all tests (unit + integration + e2e)
181
- npm test
108
+ quire new ./blargh --quire latest
109
+ ```
182
110
 
183
- # Run only unit tests (fast)
184
- npm run test:unit
111
+ ### `preview`
185
112
 
186
- # Run only integration tests (fast, mocked)
187
- npm run test:integration
113
+ Build and server the Quire site in development mode.
188
114
 
189
- # Run only E2E tests (slow, real dependencies)
190
- npm run test:e2e
115
+ ```sh
116
+ quire preview --port 8080
117
+ ```
191
118
 
192
- # Watch mode for development
193
- npm run test:watch
119
+ #### `epub` **not yet implemented**
194
120
 
195
- # Generate coverage report
196
- npm run test:coverage
121
+ Preview the Quire publication epub in the default application.
122
+
123
+ ```sh
124
+ quire preview epub --open
197
125
  ```
198
126
 
199
- ## Writing Tests
127
+ #### `pdf` **not yet implemented**
200
128
 
201
- ### When to Write Each Type
129
+ Preview the Quire publication PDF in the default application.
202
130
 
203
- ✅ **Always write `*.spec.js`** - Unit tests for every command
204
- **Always write `*.test.js`** - Integration tests for command logic
205
- ⚠️ **Optionally write `*.e2e.js`** - E2E tests for critical workflows
131
+ ```sh
132
+ quire preview pdf --open
133
+ ```
206
134
 
207
- ### Integration Test Pattern
135
+ #### `site` **default subcommand**
208
136
 
209
- ```javascript
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
- test.beforeEach((t) => {
216
- // Create sinon sandbox for mocking
217
- t.context.sandbox = sinon.createSandbox()
139
+ ```sh
140
+ quire preview site
141
+ ```
218
142
 
219
- // Create in-memory file system
220
- t.context.vol = new Volume()
221
- t.context.fs = createFsFromVolume(t.context.vol)
143
+ ### `server` **not yet implemented**
222
144
 
223
- // Setup mock directory structure
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
- t.context.projectRoot = '/project'
230
- })
147
+ ```sh
148
+ quire server --port 8080
149
+ ```
231
150
 
232
- test.afterEach.always((t) => {
233
- // Restore all mocks
234
- t.context.sandbox.restore()
151
+ ### `version` **partial implementation**
235
152
 
236
- // Clear in-memory file system
237
- t.context.vol.reset()
238
- })
153
+ Sets the Quire version to use when running commands on the project.
239
154
 
240
- test('command should perform expected operation', async (t) => {
241
- const { sandbox, fs } = t.context
155
+ ```sh
156
+ quire version 1.0.0
157
+ ```
242
158
 
243
- // Mock dependencies
244
- const mockDependency = sandbox.stub().resolves()
159
+ To set the quire version globally use the `--global` command flag.
245
160
 
246
- // Use esmock to load command with mocked dependencies
247
- const MyCommand = await esmock('./mycommand.js', {
248
- '#lib/dependency/index.js': mockDependency,
249
- 'fs-extra': fs
250
- })
161
+ ```sh
162
+ quire version 1.0.0 --global
163
+ ```
251
164
 
252
- const command = new MyCommand()
253
- await command.action({}, command)
165
+ #### `install`
254
166
 
255
- t.true(mockDependency.called)
256
- })
167
+ ```sh
168
+ quire version install <version>
257
169
  ```
258
170
 
259
- ## Testing Dependencies
171
+ To reinstall a `quire-11ty` version run
260
172
 
261
- All testing dependencies are managed in [package.json](../../package.json):
173
+ ```sh
174
+ quire version install <version> --force
175
+ ```
262
176
 
263
- - **ava** - Test runner with ES module support
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
- ## Test Quality Standards
179
+ List installed versions of `quire-11ty`
269
180
 
270
- - Each command must have integration test scenarios
271
- - Critical workflows must have end-to-end tests
272
- - All error paths must be tested
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
- ## Creating a New Command
185
+ #### `prune`
277
186
 
278
- 1. **Create the command file** (`src/commands/my-command.js`)
279
- - Extend the `Command` class
280
- - Define static `definition` object
281
- - Implement `action()` method
187
+ Remove outdated versions of `quire-11ty`
282
188
 
283
- 2. **Create integration tests** (`src/commands/my-command.test.js`)
284
- - Test main functionality with mocked dependencies
285
- - Test error handling
286
- - Test option passing
189
+ ```sh
190
+ quire version prune
191
+ ```
192
+
193
+ #### `remove` (alias `uninstall`)
287
194
 
288
- 3. **Create unit tests** (optional, `src/commands/my-command.spec.js`)
289
- - Validate command structure and configuration
195
+ ```sh
196
+ quire version remove <version>
197
+ ```
290
198
 
291
- 4. **Create e2e tests** (optional, `test/e2e/my-command.e2e.js`)
292
- - Test critical workflows with real dependencies
199
+ ```sh
200
+ quire version uninstall <version>
201
+ ```
@@ -1,11 +1,6 @@
1
1
  import Command from '#src/Command.js'
2
- import { Option } from 'commander'
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 = withOutputModes({
15
+ static definition = {
21
16
  name: 'build',
22
17
  description: 'Generate publication outputs',
23
- summary: 'generate HTML site files',
24
- docsLink: 'quire-commands/#output-files',
25
- helpText: `
26
- Examples:
27
- quire build Build the site
28
- quire build --verbose Build with detailed progress
29
- quire build --debug Build with debug output
30
-
31
- Note: Run before "quire pdf" or "quire epub" commands.
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
- [ '--dryrun', 'alias for --dry-run', { hidden: true, implies: { dryRun: true } } ],
37
- // Use Option object syntax to configure this as a hidden option
38
- new Option('--11ty <module>', 'use the specified 11ty module')
39
- .choices(['api', 'cli']).default('api').hideHelp(),
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
- async action(options, command) {
48
- this.debug('called with options %O', options)
49
-
50
- // Configure reporter for this command
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
- try {
54
- if (options['11ty'] === 'api') {
55
- this.debug('running eleventy using lib/11ty api')
56
- await api.build(options)
57
- } else {
58
- this.debug('running eleventy using lib/11ty cli')
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(thisCommand, actionCommand) {
69
- testcwd(thisCommand)
58
+ preAction(command) {
59
+ testcwd(command)
70
60
 
71
- const options = thisCommand.opts()
72
- this.debug('pre-action with options %O', options)
73
- clean(paths.getProjectRoot(), paths.toObject(), options)
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
  }
@@ -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 { clearStatus } from '#lib/conf/build-status.js'
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 = withOutputModes({
18
+ static definition = {
21
19
  name: 'clean',
22
20
  description: 'Remove build outputs',
23
- summary: 'delete generated files',
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
- [ '--dryrun', 'alias for --dry-run', { hidden: true, implies: { dryRun: true } } ],
35
- [ '--status', 'also clear stored build status for this project' ],
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
- this.debug('called with options %O', options)
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
- if (!deletedPaths || !deletedPaths.length) {
55
- if (!options.status) this.logger.info('No files to delete')
56
- return
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
- const verb = options.dryRun ? 'Will delete' : 'Deleted'
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(thisCommand, actionCommand) {
65
- testcwd(thisCommand)
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
+ }