@thegetty/quire-cli 1.0.0-rc.42 → 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 +2 -2
- package/src/lib/11ty/api.js +49 -9
- package/src/lib/11ty/cli.js +21 -0
- package/src/lib/logger/index.js +1 -1
- package/src/main.js +5 -0
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.
|
|
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": "^
|
|
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",
|
package/src/lib/11ty/api.js
CHANGED
|
@@ -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 ||
|
|
134
|
+
quietMode: options.quiet || !options.verbose,
|
|
106
135
|
runMode: options.runMode || 'build',
|
|
107
136
|
})
|
|
108
137
|
|
|
@@ -172,14 +201,14 @@ class Quire11ty {
|
|
|
172
201
|
const projectRoot = this.paths.getProjectRoot()
|
|
173
202
|
process.chdir(projectRoot)
|
|
174
203
|
|
|
175
|
-
configureEleventyEnv({ mode: 'production',
|
|
176
|
-
|
|
177
|
-
reporter.start('Building site...', { showElapsed: true })
|
|
204
|
+
configureEleventyEnv({ mode: 'production', ...options })
|
|
178
205
|
|
|
179
206
|
const eleventy = await createEleventyInstance(options)
|
|
180
207
|
|
|
181
208
|
eleventy.setDryRun(options.dryRun)
|
|
182
209
|
|
|
210
|
+
reporter.start('Building site...', { showElapsed: true })
|
|
211
|
+
|
|
183
212
|
try {
|
|
184
213
|
await eleventy.write()
|
|
185
214
|
reporter.succeed('Build complete')
|
|
@@ -202,9 +231,7 @@ class Quire11ty {
|
|
|
202
231
|
const projectRoot = this.paths.getProjectRoot()
|
|
203
232
|
process.chdir(projectRoot)
|
|
204
233
|
|
|
205
|
-
configureEleventyEnv({ mode: 'development',
|
|
206
|
-
|
|
207
|
-
reporter.start('Starting development server...')
|
|
234
|
+
configureEleventyEnv({ mode: 'development', ...options })
|
|
208
235
|
|
|
209
236
|
const eleventy =
|
|
210
237
|
await createEleventyInstance({ ...options, runMode: 'serve' })
|
|
@@ -212,9 +239,21 @@ class Quire11ty {
|
|
|
212
239
|
// Store reference for lifecycle management (graceful shutdown)
|
|
213
240
|
this.activeInstance = eleventy
|
|
214
241
|
|
|
215
|
-
// Initialize Eleventy
|
|
242
|
+
// Initialize Eleventy (required before watch/serve)
|
|
216
243
|
await eleventy.init()
|
|
217
244
|
|
|
245
|
+
reporter.start('Building site...', { showElapsed: true })
|
|
246
|
+
|
|
247
|
+
// Build the site and start file watchers.
|
|
248
|
+
// watch() performs the initial build via write(), then sets up chokidar
|
|
249
|
+
// file watchers for incremental rebuilds on file changes.
|
|
250
|
+
// This matches the Eleventy CLI sequence: init() → watch() → serve()
|
|
251
|
+
// @see https://github.com/11ty/eleventy/blob/main/cmd.cjs
|
|
252
|
+
await eleventy.watch()
|
|
253
|
+
|
|
254
|
+
reporter.succeed('Build complete')
|
|
255
|
+
reporter.start('Starting development server...')
|
|
256
|
+
|
|
218
257
|
// Register a ready callback to resolve the spinner when the server is listening
|
|
219
258
|
// @see https://www.11ty.dev/docs/dev-server/#options
|
|
220
259
|
eleventy.eleventyServe.config.serverOptions = {
|
|
@@ -228,6 +267,7 @@ class Quire11ty {
|
|
|
228
267
|
},
|
|
229
268
|
}
|
|
230
269
|
|
|
270
|
+
// Start the HTTP dev server (serves the built _site/ directory)
|
|
231
271
|
await eleventy.serve(options.port)
|
|
232
272
|
}
|
|
233
273
|
}
|
package/src/lib/11ty/cli.js
CHANGED
|
@@ -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 }
|
package/src/lib/logger/index.js
CHANGED
|
@@ -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
|
/**
|