@thegetty/quire-cli 1.0.0-rc.43 → 1.0.0-rc.44

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thegetty/quire-cli",
3
3
  "description": "Quire command-line interface",
4
- "version": "1.0.0-rc.43",
4
+ "version": "1.0.0-rc.44",
5
5
  "author": "Getty Digital",
6
6
  "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
7
7
  "bugs": {
@@ -74,7 +74,7 @@
74
74
  "marked-terminal": "^7.3.0",
75
75
  "node-fetch": "^3.3.2",
76
76
  "open": "^8.4.0",
77
- "ora": "^6.1.2",
77
+ "ora": "^9.1.0",
78
78
  "pagedjs-cli": "^0.4.3",
79
79
  "pdf-lib": "^1.17.1",
80
80
  "read-package-up": "^11.0.0",
@@ -44,13 +44,27 @@ const debug = createDebug('lib:11ty:api')
44
44
  * These must be set before the Eleventy instance is created and the
45
45
  * `.eleventy.js` configuration file is parsed.
46
46
  *
47
+ * Sets QUIRE_LOG_LEVEL to control output from multiple systems:
48
+ * - quire-11ty chalk logger (_lib/chalk) — reads env var as level ceiling
49
+ * - Vite bundler (_plugins/vite) — maps env var to Vite's logLevel option
50
+ * - Directory output plugin (.eleventy.js) — conditionally registered
51
+ *
52
+ * CLI flag mapping:
53
+ * (default) → 'warn' — spinner + warn/error only
54
+ * --verbose → 'info' — adds chalk info output, directory listing, Vite info
55
+ * --debug → 'debug' — adds chalk debug output, Eleventy DEBUG traces
56
+ * --quiet → 'silent' — suppresses all chalk/Vite/directory output
57
+ *
47
58
  * @see https://github.com/11ty/eleventy/issues/2655
59
+ * @see packages/cli/docs/cli-output-modes.md
48
60
  *
49
61
  * @param {Object} options
50
62
  * @param {'production'|'development'} options.mode - Build mode
51
63
  * @param {boolean} options.debug - Enable Eleventy debug output
64
+ * @param {boolean} options.verbose - Enable verbose output
65
+ * @param {boolean} options.quiet - Suppress output
52
66
  */
53
- const configureEleventyEnv = ({ mode = 'production', debug = false } = {}) => {
67
+ const configureEleventyEnv = ({ mode = 'production', debug = false, verbose = false, quiet = false } = {}) => {
54
68
  // Path configuration for decoupling quire-11ty from project input directory
55
69
  process.env.ELEVENTY_DATA = paths.getDataDir()
56
70
  process.env.ELEVENTY_INCLUDES = paths.getIncludesDir()
@@ -59,6 +73,21 @@ const configureEleventyEnv = ({ mode = 'production', debug = false } = {}) => {
59
73
  // Build mode
60
74
  process.env.ELEVENTY_ENV = mode
61
75
 
76
+ // Log level for quire-11ty's chalk logger
77
+ if (quiet) {
78
+ process.env.QUIRE_LOG_LEVEL = 'silent'
79
+ } else if (debug) {
80
+ process.env.QUIRE_LOG_LEVEL = 'debug'
81
+ } else if (verbose) {
82
+ process.env.QUIRE_LOG_LEVEL = 'info'
83
+ } else {
84
+ process.env.QUIRE_LOG_LEVEL = 'warn'
85
+ }
86
+
87
+ // QUIRE_LOG_PREFIX and QUIRE_LOG_SHOW_LEVEL are set by the preAction hook
88
+ // in main.js from config values. No action needed here — they are already
89
+ // in process.env and will be read by the chalk logger at instantiation time.
90
+
62
91
  // Debug output
63
92
  if (debug) {
64
93
  process.env.DEBUG = 'Eleventy*'
@@ -102,7 +131,7 @@ const createEleventyInstance = async (options = {}) => {
102
131
  return eleventyConfig
103
132
  },
104
133
  configPath: options.config || config,
105
- quietMode: options.quiet || false,
134
+ quietMode: options.quiet || !options.verbose,
106
135
  runMode: options.runMode || 'build',
107
136
  })
108
137
 
@@ -172,16 +201,13 @@ class Quire11ty {
172
201
  const projectRoot = this.paths.getProjectRoot()
173
202
  process.chdir(projectRoot)
174
203
 
175
- configureEleventyEnv({ mode: 'production', debug: options.debug })
204
+ configureEleventyEnv({ mode: 'production', ...options })
176
205
 
177
206
  const eleventy = await createEleventyInstance(options)
178
207
 
179
208
  eleventy.setDryRun(options.dryRun)
180
209
 
181
- // Print a static info line before Eleventy's build output begins.
182
- // A spinner is not used here because write() writes directly to stdout
183
- // and would overwrite the spinner line.
184
- reporter.info('Building site...')
210
+ reporter.start('Building site...', { showElapsed: true })
185
211
 
186
212
  try {
187
213
  await eleventy.write()
@@ -205,7 +231,7 @@ class Quire11ty {
205
231
  const projectRoot = this.paths.getProjectRoot()
206
232
  process.chdir(projectRoot)
207
233
 
208
- configureEleventyEnv({ mode: 'development', debug: options.debug })
234
+ configureEleventyEnv({ mode: 'development', ...options })
209
235
 
210
236
  const eleventy =
211
237
  await createEleventyInstance({ ...options, runMode: 'serve' })
@@ -216,10 +242,7 @@ class Quire11ty {
216
242
  // Initialize Eleventy (required before watch/serve)
217
243
  await eleventy.init()
218
244
 
219
- // Print a static info line before Eleventy's build output begins.
220
- // A spinner is not used here because watch() writes directly to stdout
221
- // and would overwrite the spinner line.
222
- reporter.info('Building site...')
245
+ reporter.start('Building site...', { showElapsed: true })
223
246
 
224
247
  // Build the site and start file watchers.
225
248
  // watch() performs the initial build via write(), then sets up chokidar
@@ -228,6 +251,7 @@ class Quire11ty {
228
251
  // @see https://github.com/11ty/eleventy/blob/main/cmd.cjs
229
252
  await eleventy.watch()
230
253
 
254
+ reporter.succeed('Build complete')
231
255
  reporter.start('Starting development server...')
232
256
 
233
257
  // Register a ready callback to resolve the spinner when the server is listening
@@ -93,6 +93,27 @@ const factory = (options = {}) => {
93
93
  ELEVENTY_LAYOUTS: paths.getLayoutsDir(),
94
94
  }
95
95
 
96
+ // QUIRE_LOG_LEVEL controls output from the quire-11ty chalk logger,
97
+ // the Vite plugin logLevel, and the directory output plugin registration.
98
+ // @see packages/cli/docs/cli-output-modes.md
99
+ if (options.quiet) {
100
+ env.QUIRE_LOG_LEVEL = 'silent'
101
+ } else if (options.debug) {
102
+ env.QUIRE_LOG_LEVEL = 'debug'
103
+ } else if (options.verbose) {
104
+ env.QUIRE_LOG_LEVEL = 'info'
105
+ } else {
106
+ env.QUIRE_LOG_LEVEL = 'warn'
107
+ }
108
+
109
+ // Forward CLI log prefix and show-level settings (set by configureLogEnv)
110
+ if (process.env.QUIRE_LOG_PREFIX !== undefined) {
111
+ env.QUIRE_LOG_PREFIX = process.env.QUIRE_LOG_PREFIX
112
+ }
113
+ if (process.env.QUIRE_LOG_SHOW_LEVEL !== undefined) {
114
+ env.QUIRE_LOG_SHOW_LEVEL = process.env.QUIRE_LOG_SHOW_LEVEL
115
+ }
116
+
96
117
  if (options.debug) env.DEBUG = 'Eleventy*'
97
118
 
98
119
  return { command, env, projectRoot }
@@ -88,7 +88,7 @@ export const LOG_LEVEL_ENV_VAR = 'QUIRE_LOG_LEVEL'
88
88
  * @param {string} text - Prefix text
89
89
  * @returns {string} Formatted prefix
90
90
  */
91
- function formatPrefix(style, text) {
91
+ export function formatPrefix(style, text) {
92
92
  switch (style) {
93
93
  case 'bracket':
94
94
  return `[${text}]`
package/src/main.js CHANGED
@@ -16,6 +16,7 @@ import reporter from '#lib/reporter/index.js'
16
16
  import { docsUrl, DOCS_BASE } from '#helpers/docs-url.js'
17
17
  import packageConfig from '#src/packageConfig.js'
18
18
  import { enableDebug } from '#lib/logger/debug.js'
19
+ import { formatPrefix } from '#lib/logger/index.js'
19
20
 
20
21
  const { version } = packageConfig
21
22
 
@@ -151,6 +152,10 @@ program.hook('preAction', (thisCommand) => {
151
152
  if (opts.pager === false) {
152
153
  process.env.NO_PAGER = '1'
153
154
  }
155
+
156
+ // Log prefix and level label visibility for quire-11ty's chalk logger
157
+ process.env.QUIRE_LOG_PREFIX = formatPrefix(config.get('logPrefixStyle'), config.get('logPrefix'))
158
+ process.env.QUIRE_LOG_SHOW_LEVEL = String(config.get('logShowLevel'))
154
159
  })
155
160
 
156
161
  /**