@thegetty/quire-cli 1.0.0-rc.38 → 1.0.0-rc.40
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/bin/cli.js +14 -1
- package/package.json +3 -1
- package/src/commands/config.js +1 -1
- package/src/commands/help.js +60 -0
- package/src/commands/help.test.js +132 -0
- package/src/errors/help/help-topic-not-found-error.js +22 -0
- package/src/errors/help/index.js +8 -0
- package/src/errors/index.js +6 -0
- package/src/errors/input/index.js +8 -0
- package/src/errors/input/invalid-input-error.js +21 -0
- package/src/helpers/pager.js +59 -0
- package/src/helpers/pager.test.js +85 -0
- package/src/lib/commander/index.js +2 -0
- package/src/lib/commander/options.js +24 -0
- package/src/lib/commander/options.test.js +46 -1
- package/src/lib/help/frontmatter.js +77 -0
- package/src/lib/help/frontmatter.test.js +139 -0
- package/src/lib/help/index.js +135 -0
- package/src/lib/help/index.test.js +160 -0
- package/src/lib/help/topics/configuration.md +77 -0
- package/src/lib/help/topics/debugging.md +69 -0
- package/src/lib/help/topics/epub.md +74 -0
- package/src/lib/help/topics/pdf.md +74 -0
- package/src/lib/help/topics/publishing.md +80 -0
- package/src/lib/help/topics/workflows.md +50 -0
- package/src/lib/logger/index.js +1 -1
- package/src/lib/logger/index.test.js +101 -0
- package/src/main.js +40 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import test from 'ava'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
extractFrontmatter,
|
|
5
|
+
stripFrontmatter,
|
|
6
|
+
parseFrontmatter
|
|
7
|
+
} from './frontmatter.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Frontmatter Parsing Tests
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// extractFrontmatter tests
|
|
14
|
+
|
|
15
|
+
test('extractFrontmatter() returns parsed YAML data', (t) => {
|
|
16
|
+
const content = `---
|
|
17
|
+
title: Test Topic
|
|
18
|
+
description: A test description
|
|
19
|
+
---
|
|
20
|
+
# Content`
|
|
21
|
+
|
|
22
|
+
const result = extractFrontmatter(content)
|
|
23
|
+
|
|
24
|
+
t.deepEqual(result, {
|
|
25
|
+
title: 'Test Topic',
|
|
26
|
+
description: 'A test description'
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('extractFrontmatter() returns empty object when no frontmatter', (t) => {
|
|
31
|
+
const content = '# Just Content\n\nNo frontmatter here.'
|
|
32
|
+
|
|
33
|
+
const result = extractFrontmatter(content)
|
|
34
|
+
|
|
35
|
+
t.deepEqual(result, {})
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('extractFrontmatter() returns empty object for invalid YAML', (t) => {
|
|
39
|
+
const content = `---
|
|
40
|
+
title: [invalid yaml
|
|
41
|
+
---
|
|
42
|
+
# Content`
|
|
43
|
+
|
|
44
|
+
const result = extractFrontmatter(content)
|
|
45
|
+
|
|
46
|
+
t.deepEqual(result, {})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('extractFrontmatter() handles values containing colons', (t) => {
|
|
50
|
+
const content = `---
|
|
51
|
+
url: https://example.com/path
|
|
52
|
+
title: "Part 1: Introduction"
|
|
53
|
+
---
|
|
54
|
+
# Content`
|
|
55
|
+
|
|
56
|
+
const result = extractFrontmatter(content)
|
|
57
|
+
|
|
58
|
+
t.is(result.url, 'https://example.com/path')
|
|
59
|
+
t.is(result.title, 'Part 1: Introduction')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('extractFrontmatter() handles arrays and nested objects', (t) => {
|
|
63
|
+
const content = `---
|
|
64
|
+
tags:
|
|
65
|
+
- one
|
|
66
|
+
- two
|
|
67
|
+
author:
|
|
68
|
+
name: Test
|
|
69
|
+
email: test@example.com
|
|
70
|
+
---
|
|
71
|
+
# Content`
|
|
72
|
+
|
|
73
|
+
const result = extractFrontmatter(content)
|
|
74
|
+
|
|
75
|
+
t.deepEqual(result.tags, ['one', 'two'])
|
|
76
|
+
t.deepEqual(result.author, { name: 'Test', email: 'test@example.com' })
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// stripFrontmatter tests
|
|
80
|
+
|
|
81
|
+
test('stripFrontmatter() removes frontmatter block', (t) => {
|
|
82
|
+
const content = `---
|
|
83
|
+
title: Test
|
|
84
|
+
---
|
|
85
|
+
# Content
|
|
86
|
+
|
|
87
|
+
Body text.`
|
|
88
|
+
|
|
89
|
+
const result = stripFrontmatter(content)
|
|
90
|
+
|
|
91
|
+
t.is(result, '# Content\n\nBody text.')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('stripFrontmatter() returns content unchanged when no frontmatter', (t) => {
|
|
95
|
+
const content = '# Just Content\n\nNo frontmatter.'
|
|
96
|
+
|
|
97
|
+
const result = stripFrontmatter(content)
|
|
98
|
+
|
|
99
|
+
t.is(result, content)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('stripFrontmatter() handles frontmatter without trailing newline', (t) => {
|
|
103
|
+
const content = `---
|
|
104
|
+
title: Test
|
|
105
|
+
---# Content`
|
|
106
|
+
|
|
107
|
+
const result = stripFrontmatter(content)
|
|
108
|
+
|
|
109
|
+
t.is(result, '# Content')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// parseFrontmatter tests
|
|
113
|
+
|
|
114
|
+
test('parseFrontmatter() returns both data and content', (t) => {
|
|
115
|
+
const content = `---
|
|
116
|
+
title: Test Topic
|
|
117
|
+
description: A description
|
|
118
|
+
---
|
|
119
|
+
# Heading
|
|
120
|
+
|
|
121
|
+
Body content.`
|
|
122
|
+
|
|
123
|
+
const result = parseFrontmatter(content)
|
|
124
|
+
|
|
125
|
+
t.deepEqual(result.data, {
|
|
126
|
+
title: 'Test Topic',
|
|
127
|
+
description: 'A description'
|
|
128
|
+
})
|
|
129
|
+
t.is(result.content, '# Heading\n\nBody content.')
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
test('parseFrontmatter() returns empty data when no frontmatter', (t) => {
|
|
133
|
+
const content = '# Just Content'
|
|
134
|
+
|
|
135
|
+
const result = parseFrontmatter(content)
|
|
136
|
+
|
|
137
|
+
t.deepEqual(result.data, {})
|
|
138
|
+
t.is(result.content, '# Just Content')
|
|
139
|
+
})
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help topics module
|
|
3
|
+
*
|
|
4
|
+
* Provides loading and rendering of help topics from markdown files.
|
|
5
|
+
* Topics are stored in the topics/ directory as markdown files with
|
|
6
|
+
* YAML frontmatter for metadata.
|
|
7
|
+
*
|
|
8
|
+
* @module lib/help
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'fs-extra'
|
|
11
|
+
import { marked } from 'marked'
|
|
12
|
+
import { markedTerminal } from 'marked-terminal'
|
|
13
|
+
import path from 'node:path'
|
|
14
|
+
import { fileURLToPath } from 'node:url'
|
|
15
|
+
import { HelpTopicNotFoundError } from '#src/errors/index.js'
|
|
16
|
+
import { extractFrontmatter, stripFrontmatter } from './frontmatter.js'
|
|
17
|
+
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
19
|
+
const __dirname = path.dirname(__filename)
|
|
20
|
+
|
|
21
|
+
// Nota bene: env var override for development/testing only, not user-configurable
|
|
22
|
+
const TOPICS_DIR =
|
|
23
|
+
process.env.QUIRE_HELP_TOPICS_DIR || path.join(__dirname, 'topics');
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Topic metadata extracted from markdown frontmatter
|
|
27
|
+
* @typedef {Object} TopicMeta
|
|
28
|
+
* @property {string} name - Topic identifier (filename without .md)
|
|
29
|
+
* @property {string} title - Display title
|
|
30
|
+
* @property {string} description - Brief description for listing
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* List all available help topics
|
|
35
|
+
* @returns {Promise<TopicMeta[]>} Array of topic metadata sorted by name
|
|
36
|
+
*/
|
|
37
|
+
async function listTopics() {
|
|
38
|
+
if (!await fs.pathExists(TOPICS_DIR)) {
|
|
39
|
+
return []
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const files = await fs.readdir(TOPICS_DIR)
|
|
43
|
+
const topics = []
|
|
44
|
+
|
|
45
|
+
for (const file of files) {
|
|
46
|
+
if (!file.endsWith('.md')) continue
|
|
47
|
+
|
|
48
|
+
const name = path.basename(file, '.md')
|
|
49
|
+
const content = await fs.readFile(path.join(TOPICS_DIR, file), 'utf-8')
|
|
50
|
+
const meta = extractFrontmatter(content)
|
|
51
|
+
|
|
52
|
+
topics.push({
|
|
53
|
+
name,
|
|
54
|
+
title: meta.title || name,
|
|
55
|
+
description: meta.description || ''
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return topics.sort((a, b) => a.name.localeCompare(b.name))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Load a help topic by name
|
|
64
|
+
* @param {string} name - Topic name (without .md extension)
|
|
65
|
+
* @returns {Promise<string>} Topic content
|
|
66
|
+
* @throws {HelpTopicNotFoundError} If topic does not exist
|
|
67
|
+
*/
|
|
68
|
+
async function loadTopic(name) {
|
|
69
|
+
const filePath = path.join(TOPICS_DIR, `${name}.md`)
|
|
70
|
+
|
|
71
|
+
if (!await fs.pathExists(filePath)) {
|
|
72
|
+
throw new HelpTopicNotFoundError(name)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const content = await fs.readFile(filePath, 'utf-8')
|
|
76
|
+
return stripFrontmatter(content)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Render markdown content for terminal display
|
|
81
|
+
* @param {string} content - Markdown content
|
|
82
|
+
* @returns {string} Rendered content for terminal
|
|
83
|
+
*/
|
|
84
|
+
function renderTopic(content) {
|
|
85
|
+
marked.use(markedTerminal())
|
|
86
|
+
return marked.parse(content).trimEnd()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Format topic list for display
|
|
91
|
+
* @param {TopicMeta[]} topics - Array of topic metadata
|
|
92
|
+
* @returns {string} Formatted topic list
|
|
93
|
+
*/
|
|
94
|
+
function formatTopicList(topics) {
|
|
95
|
+
if (topics.length === 0) {
|
|
96
|
+
return 'No help topics available.'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const lines = ['Available help topics:\n']
|
|
100
|
+
topics.forEach(({ name, description }) => {
|
|
101
|
+
lines.push(` ${name.padEnd(16)} ${description}`)
|
|
102
|
+
})
|
|
103
|
+
lines.push('\nRun "quire help <topic>" for detailed information.')
|
|
104
|
+
lines.push('Run "quire <command> --help" for command-specific options.')
|
|
105
|
+
|
|
106
|
+
return lines.join('\n')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get formatted list of available help topics
|
|
111
|
+
* @returns {Promise<string>} Formatted topic list for display
|
|
112
|
+
*/
|
|
113
|
+
export async function getTopicList() {
|
|
114
|
+
const topics = await listTopics()
|
|
115
|
+
return formatTopicList(topics)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get formatted help content for a topic
|
|
120
|
+
* @param {string} name - Topic name
|
|
121
|
+
* @returns {Promise<string>} Rendered topic content
|
|
122
|
+
* @throws {HelpTopicNotFoundError} If topic does not exist
|
|
123
|
+
*/
|
|
124
|
+
export async function getTopicContent(name) {
|
|
125
|
+
const content = await loadTopic(name)
|
|
126
|
+
return renderTopic(content)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get the topics directory path (for testing)
|
|
131
|
+
* @returns {string} Path to topics directory
|
|
132
|
+
*/
|
|
133
|
+
export function getTopicsDir() {
|
|
134
|
+
return TOPICS_DIR
|
|
135
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import esmock from 'esmock'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import sinon from 'sinon'
|
|
4
|
+
import test from 'ava'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Help Topics Library Tests
|
|
8
|
+
*
|
|
9
|
+
* Tests the help topics public API.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
test.beforeEach((t) => {
|
|
13
|
+
t.context.sandbox = sinon.createSandbox()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test.afterEach.always((t) => {
|
|
17
|
+
t.context.sandbox.restore()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('getTopicList() returns formatted list of topics', async (t) => {
|
|
21
|
+
const { sandbox } = t.context
|
|
22
|
+
|
|
23
|
+
const mockFs = {
|
|
24
|
+
pathExists: sandbox.stub().resolves(true),
|
|
25
|
+
readdir: sandbox.stub().resolves(['workflows.md', 'debugging.md']),
|
|
26
|
+
readFile: sandbox.stub()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
mockFs.readFile.withArgs(sinon.match(/workflows\.md/), 'utf-8').resolves(`---
|
|
30
|
+
title: Common Workflows
|
|
31
|
+
description: Step-by-step guides
|
|
32
|
+
---
|
|
33
|
+
# Workflows`)
|
|
34
|
+
|
|
35
|
+
mockFs.readFile.withArgs(sinon.match(/debugging\.md/), 'utf-8').resolves(`---
|
|
36
|
+
title: Debugging
|
|
37
|
+
description: Troubleshooting help
|
|
38
|
+
---
|
|
39
|
+
# Debugging`)
|
|
40
|
+
|
|
41
|
+
const { getTopicList } = await esmock('./index.js', {
|
|
42
|
+
'fs-extra': mockFs
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const output = await getTopicList()
|
|
46
|
+
|
|
47
|
+
t.true(output.includes('Available help topics:'))
|
|
48
|
+
t.true(output.includes('debugging'))
|
|
49
|
+
t.true(output.includes('Troubleshooting help'))
|
|
50
|
+
t.true(output.includes('workflows'))
|
|
51
|
+
t.true(output.includes('Step-by-step guides'))
|
|
52
|
+
t.true(output.includes('Run "quire help <topic>"'))
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('getTopicList() returns message when no topics available', async (t) => {
|
|
56
|
+
const { sandbox } = t.context
|
|
57
|
+
|
|
58
|
+
const mockFs = {
|
|
59
|
+
pathExists: sandbox.stub().resolves(false)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const { getTopicList } = await esmock('./index.js', {
|
|
63
|
+
'fs-extra': mockFs
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const output = await getTopicList()
|
|
67
|
+
|
|
68
|
+
t.is(output, 'No help topics available.')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('getTopicList() returns message when topics directory is empty', async (t) => {
|
|
72
|
+
const { sandbox } = t.context
|
|
73
|
+
|
|
74
|
+
const mockFs = {
|
|
75
|
+
pathExists: sandbox.stub().resolves(true),
|
|
76
|
+
readdir: sandbox.stub().resolves([])
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const { getTopicList } = await esmock('./index.js', {
|
|
80
|
+
'fs-extra': mockFs
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const output = await getTopicList()
|
|
84
|
+
|
|
85
|
+
t.is(output, 'No help topics available.')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('getTopicContent() loads and renders topic', async (t) => {
|
|
89
|
+
const { sandbox } = t.context
|
|
90
|
+
|
|
91
|
+
const mockFs = {
|
|
92
|
+
pathExists: sandbox.stub().resolves(true),
|
|
93
|
+
readFile: sandbox.stub().resolves('# Test\n\nContent here.')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const { getTopicContent } = await esmock('./index.js', {
|
|
97
|
+
'fs-extra': mockFs
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const content = await getTopicContent('test')
|
|
101
|
+
|
|
102
|
+
t.is(typeof content, 'string')
|
|
103
|
+
t.true(content.includes('Test'))
|
|
104
|
+
t.true(content.includes('Content here'))
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('getTopicContent() strips frontmatter from content', async (t) => {
|
|
108
|
+
const { sandbox } = t.context
|
|
109
|
+
|
|
110
|
+
const mockFs = {
|
|
111
|
+
pathExists: sandbox.stub().resolves(true),
|
|
112
|
+
readFile: sandbox.stub().resolves(`---
|
|
113
|
+
title: Test Topic
|
|
114
|
+
description: A test
|
|
115
|
+
---
|
|
116
|
+
# Test Topic
|
|
117
|
+
|
|
118
|
+
This is the content.`)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const { getTopicContent } = await esmock('./index.js', {
|
|
122
|
+
'fs-extra': mockFs
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
const content = await getTopicContent('test')
|
|
126
|
+
|
|
127
|
+
t.true(content.includes('Test Topic'))
|
|
128
|
+
t.true(content.includes('This is the content'))
|
|
129
|
+
t.false(content.includes('---'))
|
|
130
|
+
t.false(content.includes('title:'))
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
test('getTopicContent() throws HelpTopicNotFoundError for missing topic', async (t) => {
|
|
134
|
+
const { sandbox } = t.context
|
|
135
|
+
|
|
136
|
+
const mockFs = {
|
|
137
|
+
pathExists: sandbox.stub().resolves(false)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const { getTopicContent } = await esmock('./index.js', {
|
|
141
|
+
'fs-extra': mockFs
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const error = await t.throwsAsync(
|
|
145
|
+
() => getTopicContent('nonexistent'),
|
|
146
|
+
{ name: 'HelpTopicNotFoundError' }
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
t.is(error.code, 'HELP_TOPIC_NOT_FOUND')
|
|
150
|
+
t.is(error.topic, 'nonexistent')
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
test('getTopicsDir() returns the topics directory path', async (t) => {
|
|
154
|
+
const { getTopicsDir } = await import('./index.js')
|
|
155
|
+
|
|
156
|
+
const dir = getTopicsDir()
|
|
157
|
+
|
|
158
|
+
t.true(dir.endsWith('topics'))
|
|
159
|
+
t.true(dir.includes(`lib${path.sep}help`))
|
|
160
|
+
})
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Project and CLI configuration options
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration
|
|
7
|
+
|
|
8
|
+
## Project Configuration
|
|
9
|
+
|
|
10
|
+
The `content/_data/publication.yaml` file contains publication settings:
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
title: My Publication
|
|
14
|
+
subtitle: A Quire Book
|
|
15
|
+
contributor:
|
|
16
|
+
- type: primary
|
|
17
|
+
first_name: Jane
|
|
18
|
+
last_name: Doe
|
|
19
|
+
|
|
20
|
+
url: https://my-publication.example.com
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Common Settings
|
|
24
|
+
|
|
25
|
+
### Publication Metadata
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
title: Publication Title
|
|
29
|
+
subtitle: Optional Subtitle
|
|
30
|
+
reading_line: Additional context
|
|
31
|
+
pub_date: 2024-01-15
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Output Configuration
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
pdf:
|
|
38
|
+
output: _site/downloads/publication.pdf
|
|
39
|
+
|
|
40
|
+
epub:
|
|
41
|
+
output: _site/downloads/publication.epub
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Build Options
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
debug: false
|
|
48
|
+
verbose: false
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## CLI Configuration
|
|
52
|
+
|
|
53
|
+
The CLI stores user preferences separately from project settings.
|
|
54
|
+
|
|
55
|
+
### View Configuration
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
quire config # Show all settings
|
|
59
|
+
quire config path # Show config file location
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Configuration File Location
|
|
63
|
+
|
|
64
|
+
- **macOS:** `~/Library/Preferences/quire-cli-nodejs/config.json`
|
|
65
|
+
- **Linux:** `~/.config/quire-cli-nodejs/config.json`
|
|
66
|
+
- **Windows:** `%APPDATA%\quire-cli-nodejs\config.json`
|
|
67
|
+
|
|
68
|
+
## Environment Variables
|
|
69
|
+
|
|
70
|
+
Override settings via environment variables:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
DEBUG=quire:* quire build # Enable debug output
|
|
74
|
+
QUIRE_LOG_LEVEL=debug quire preview # Set log level
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See full documentation: https://quire.getty.edu/docs-v1/configuration/
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Debugging
|
|
3
|
+
description: Troubleshooting common issues
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging Quire Projects
|
|
7
|
+
|
|
8
|
+
## Debug Output
|
|
9
|
+
|
|
10
|
+
Enable debug output to see detailed information:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
quire build --debug # Enable debug mode
|
|
14
|
+
DEBUG=quire:* quire build # Enable all debug namespaces
|
|
15
|
+
DEBUG=quire:lib:pdf quire pdf # Debug PDF module only
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Common Issues
|
|
19
|
+
|
|
20
|
+
### Build Fails with YAML Errors
|
|
21
|
+
|
|
22
|
+
Run validation to identify syntax issues:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
quire validate
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Common YAML problems:
|
|
29
|
+
- Missing colons after keys
|
|
30
|
+
- Incorrect indentation (use spaces, not tabs)
|
|
31
|
+
- Unquoted special characters
|
|
32
|
+
- Missing closing quotes
|
|
33
|
+
|
|
34
|
+
### PDF Generation Fails
|
|
35
|
+
|
|
36
|
+
1. Check that build output exists: `quire build`
|
|
37
|
+
2. Run with debug: `quire pdf --debug`
|
|
38
|
+
3. Verify the PDF engine is installed
|
|
39
|
+
|
|
40
|
+
### EPUB Generation Fails
|
|
41
|
+
|
|
42
|
+
1. Ensure the build is complete: `quire build`
|
|
43
|
+
2. Check for missing images or broken links
|
|
44
|
+
3. Run with debug: `quire epub --debug`
|
|
45
|
+
|
|
46
|
+
### Preview Not Updating
|
|
47
|
+
|
|
48
|
+
Try a clean build:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
quire clean && quire preview
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### "Not in a Quire project" Error
|
|
55
|
+
|
|
56
|
+
Make sure you're in a directory containing:
|
|
57
|
+
- `content/` directory
|
|
58
|
+
- An Eleventy configuration file (`.eleventy.js` or `eleventy.config.js`)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd your-project-name
|
|
62
|
+
quire preview
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Getting Help
|
|
66
|
+
|
|
67
|
+
- Documentation: https://quire.getty.edu/docs-v1/
|
|
68
|
+
- Community Forum: https://github.com/thegetty/quire/discussions
|
|
69
|
+
- Issue Tracker: https://github.com/thegetty/quire/issues
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: EPUB Generation
|
|
3
|
+
description: Creating e-book publications
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# EPUB Generation
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
quire epub --build # Build and generate EPUB
|
|
12
|
+
quire epub --build --open # Build, generate, and open EPUB
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## EPUB Engines
|
|
16
|
+
|
|
17
|
+
Quire supports two EPUB engines:
|
|
18
|
+
|
|
19
|
+
### epubjs (Default)
|
|
20
|
+
|
|
21
|
+
JavaScript-based EPUB generation.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
quire epub # Uses epubjs by default
|
|
25
|
+
quire epub --lib epubjs # Explicit epubjs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Pandoc
|
|
29
|
+
|
|
30
|
+
Universal document converter with EPUB support. Requires separate installation.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
quire epub --lib pandoc # Use Pandoc
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
EPUB settings in `content/_data/config.yaml`:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
epub:
|
|
42
|
+
output: _site/downloads/my-publication.epub
|
|
43
|
+
# Additional EPUB-specific settings
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Troubleshooting
|
|
47
|
+
|
|
48
|
+
### EPUB fails validation
|
|
49
|
+
|
|
50
|
+
Common issues:
|
|
51
|
+
- Missing required metadata in `content/_data/publication.yaml`
|
|
52
|
+
- Invalid image formats (use JPEG or PNG)
|
|
53
|
+
- Broken internal links
|
|
54
|
+
|
|
55
|
+
### Images not appearing
|
|
56
|
+
|
|
57
|
+
1. Check image paths are relative
|
|
58
|
+
2. Ensure images are in supported formats
|
|
59
|
+
3. Verify images exist in the build output
|
|
60
|
+
|
|
61
|
+
### EPUB not opening in reader
|
|
62
|
+
|
|
63
|
+
1. Validate the EPUB file structure
|
|
64
|
+
2. Check for malformed HTML in content
|
|
65
|
+
3. Ensure all required files are included
|
|
66
|
+
|
|
67
|
+
## Testing Your EPUB
|
|
68
|
+
|
|
69
|
+
Open in different readers to verify:
|
|
70
|
+
- Apple Books (macOS/iOS)
|
|
71
|
+
- Calibre (cross-platform)
|
|
72
|
+
- Adobe Digital Editions
|
|
73
|
+
|
|
74
|
+
See full documentation: https://quire.getty.edu/docs-v1/epub-output/
|