@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
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import test from 'ava'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
import esmock from 'esmock'
|
|
4
|
-
|
|
5
|
-
test.beforeEach((t) => {
|
|
6
|
-
t.context.sandbox = sinon.createSandbox()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test.afterEach.always((t) => {
|
|
10
|
-
t.context.sandbox.restore()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('checkOutdatedQuire11ty returns N/A when package.json does not exist', async (t) => {
|
|
14
|
-
const { sandbox } = t.context
|
|
15
|
-
|
|
16
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
17
|
-
'node:fs': {
|
|
18
|
-
default: {
|
|
19
|
-
existsSync: sandbox.stub().returns(false),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const result = await checkOutdatedQuire11ty()
|
|
25
|
-
|
|
26
|
-
t.true(result.ok)
|
|
27
|
-
t.is(result.level, 'na')
|
|
28
|
-
t.regex(result.message, /not installed/)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
test('checkOutdatedQuire11ty returns N/A when package.json is not a quire-11ty project', async (t) => {
|
|
32
|
-
const { sandbox } = t.context
|
|
33
|
-
|
|
34
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
35
|
-
'node:fs': {
|
|
36
|
-
default: {
|
|
37
|
-
existsSync: sandbox.stub().returns(true),
|
|
38
|
-
readFileSync: sandbox.stub().returns(JSON.stringify({
|
|
39
|
-
name: 'some-other-package',
|
|
40
|
-
version: '1.0.0',
|
|
41
|
-
})),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const result = await checkOutdatedQuire11ty()
|
|
47
|
-
|
|
48
|
-
t.true(result.ok)
|
|
49
|
-
t.is(result.level, 'na')
|
|
50
|
-
t.regex(result.message, /not installed/)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
test('checkOutdatedQuire11ty returns ok when version is up to date', async (t) => {
|
|
54
|
-
const { sandbox } = t.context
|
|
55
|
-
|
|
56
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
57
|
-
'node:fs': {
|
|
58
|
-
default: {
|
|
59
|
-
existsSync: sandbox.stub().returns(true),
|
|
60
|
-
readFileSync: sandbox.stub().returns(JSON.stringify({
|
|
61
|
-
name: '@thegetty/quire-11ty',
|
|
62
|
-
version: '1.0.0-rc.33',
|
|
63
|
-
})),
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
'#lib/npm/index.js': {
|
|
67
|
-
default: {
|
|
68
|
-
view: sandbox.stub().resolves('1.0.0-rc.33'),
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
'#lib/conf/config.js': {
|
|
72
|
-
default: {
|
|
73
|
-
get: sandbox.stub().returns('rc'),
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const result = await checkOutdatedQuire11ty()
|
|
79
|
-
|
|
80
|
-
t.true(result.ok)
|
|
81
|
-
t.regex(result.message, /1\.0\.0-rc\.33/)
|
|
82
|
-
t.regex(result.message, /up to date/)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
test('checkOutdatedQuire11ty returns warning when version is outdated', async (t) => {
|
|
86
|
-
const { sandbox } = t.context
|
|
87
|
-
|
|
88
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
89
|
-
'node:fs': {
|
|
90
|
-
default: {
|
|
91
|
-
existsSync: sandbox.stub().returns(true),
|
|
92
|
-
readFileSync: sandbox.stub().returns(JSON.stringify({
|
|
93
|
-
name: '@thegetty/quire-11ty',
|
|
94
|
-
version: '1.0.0-rc.30',
|
|
95
|
-
})),
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
'#lib/npm/index.js': {
|
|
99
|
-
default: {
|
|
100
|
-
view: sandbox.stub().resolves('1.0.0-rc.33'),
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
'#lib/conf/config.js': {
|
|
104
|
-
default: {
|
|
105
|
-
get: sandbox.stub().returns('rc'),
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
const result = await checkOutdatedQuire11ty()
|
|
111
|
-
|
|
112
|
-
t.false(result.ok)
|
|
113
|
-
t.is(result.level, 'warn')
|
|
114
|
-
t.regex(result.message, /1\.0\.0-rc\.30 installed/)
|
|
115
|
-
t.regex(result.message, /1\.0\.0-rc\.33 available/)
|
|
116
|
-
t.truthy(result.remediation)
|
|
117
|
-
t.truthy(result.docsUrl)
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
test('checkOutdatedQuire11ty returns warning when cannot read installed version', async (t) => {
|
|
121
|
-
const { sandbox } = t.context
|
|
122
|
-
|
|
123
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
124
|
-
'node:fs': {
|
|
125
|
-
default: {
|
|
126
|
-
existsSync: sandbox.stub().returns(true),
|
|
127
|
-
readFileSync: sandbox.stub().throws(new Error('ENOENT')),
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
const result = await checkOutdatedQuire11ty()
|
|
133
|
-
|
|
134
|
-
t.false(result.ok)
|
|
135
|
-
t.is(result.level, 'warn')
|
|
136
|
-
t.regex(result.message, /Could not read/)
|
|
137
|
-
t.truthy(result.remediation)
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
test('checkOutdatedQuire11ty returns ok with message when network check fails', async (t) => {
|
|
141
|
-
const { sandbox } = t.context
|
|
142
|
-
|
|
143
|
-
const { checkOutdatedQuire11ty } = await esmock('./quire-11ty.js', {
|
|
144
|
-
'node:fs': {
|
|
145
|
-
default: {
|
|
146
|
-
existsSync: sandbox.stub().returns(true),
|
|
147
|
-
readFileSync: sandbox.stub().returns(JSON.stringify({
|
|
148
|
-
name: '@thegetty/quire-11ty',
|
|
149
|
-
version: '1.0.0-rc.30',
|
|
150
|
-
})),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
'#lib/npm/index.js': {
|
|
154
|
-
default: {
|
|
155
|
-
view: sandbox.stub().rejects(new Error('Network error')),
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
'#lib/conf/config.js': {
|
|
159
|
-
default: {
|
|
160
|
-
get: sandbox.stub().returns('rc'),
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
const result = await checkOutdatedQuire11ty()
|
|
166
|
-
|
|
167
|
-
t.true(result.ok)
|
|
168
|
-
t.regex(result.message, /1\.0\.0-rc\.30/)
|
|
169
|
-
t.regex(result.message, /could not check/)
|
|
170
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quire project detection check
|
|
3
|
-
*
|
|
4
|
-
* @module lib/doctor/checks/project/quire-project
|
|
5
|
-
*/
|
|
6
|
-
import fs from 'node:fs'
|
|
7
|
-
import { PROJECT_MARKERS } from '#lib/project/index.js'
|
|
8
|
-
import createDebug from '#debug'
|
|
9
|
-
import { DOCS_BASE_URL } from '#lib/doctor/constants.js'
|
|
10
|
-
|
|
11
|
-
const debug = createDebug('lib:doctor:quire-project')
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if current directory is a Quire project
|
|
15
|
-
* @returns {import('../../index.js').CheckResult}
|
|
16
|
-
*/
|
|
17
|
-
export function checkQuireProject() {
|
|
18
|
-
const found = PROJECT_MARKERS.find((marker) => fs.existsSync(marker))
|
|
19
|
-
debug('Quire project marker: %s', found || 'none')
|
|
20
|
-
|
|
21
|
-
if (found) {
|
|
22
|
-
return {
|
|
23
|
-
ok: true,
|
|
24
|
-
message: `Detected via ${found}`,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
ok: false,
|
|
30
|
-
message: 'No Quire project marker found',
|
|
31
|
-
remediation: `This command should be run from within a Quire project directory.
|
|
32
|
-
• Navigate to your project: cd your-project-name
|
|
33
|
-
• Or create a new project: quire new my-project`,
|
|
34
|
-
docsUrl: `${DOCS_BASE_URL}/quire-commands/#start-a-new-project`,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default checkQuireProject
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import test from 'ava'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
import esmock from 'esmock'
|
|
4
|
-
|
|
5
|
-
test.beforeEach((t) => {
|
|
6
|
-
t.context.sandbox = sinon.createSandbox()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test.afterEach.always((t) => {
|
|
10
|
-
t.context.sandbox.restore()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('checkQuireProject returns ok when marker file exists', async (t) => {
|
|
14
|
-
const { sandbox } = t.context
|
|
15
|
-
|
|
16
|
-
const { checkQuireProject } = await esmock('./quire-project.js', {
|
|
17
|
-
'node:fs': {
|
|
18
|
-
default: {
|
|
19
|
-
existsSync: sandbox.stub().callsFake((path) => path === '.quire'),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const result = checkQuireProject()
|
|
25
|
-
|
|
26
|
-
t.true(result.ok)
|
|
27
|
-
t.regex(result.message, /Detected via \.quire/)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
test('checkQuireProject returns not ok when no marker file exists', async (t) => {
|
|
31
|
-
const { sandbox } = t.context
|
|
32
|
-
|
|
33
|
-
const { checkQuireProject } = await esmock('./quire-project.js', {
|
|
34
|
-
'node:fs': {
|
|
35
|
-
default: {
|
|
36
|
-
existsSync: sandbox.stub().returns(false),
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const result = checkQuireProject()
|
|
42
|
-
|
|
43
|
-
t.false(result.ok)
|
|
44
|
-
t.regex(result.message, /No Quire project marker/)
|
|
45
|
-
t.truthy(result.remediation, 'should include remediation guidance')
|
|
46
|
-
t.truthy(result.docsUrl, 'should include documentation link')
|
|
47
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool checks
|
|
3
|
-
*
|
|
4
|
-
* Optional external tools that enhance Quire output capabilities.
|
|
5
|
-
* These are not required for core Quire functionality.
|
|
6
|
-
*
|
|
7
|
-
* @module lib/doctor/checks/tools
|
|
8
|
-
*/
|
|
9
|
-
export { checkPrinceAvailable } from './prince-available.js'
|
|
10
|
-
export { checkPandocAvailable } from './pandoc-available.js'
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pandoc availability check
|
|
3
|
-
*
|
|
4
|
-
* Checks if Pandoc is installed and available in PATH.
|
|
5
|
-
* Pandoc is an optional EPUB engine - only required when using --engine pandoc.
|
|
6
|
-
*
|
|
7
|
-
* @module lib/doctor/checks/tools/pandoc-available
|
|
8
|
-
*/
|
|
9
|
-
import which from 'which'
|
|
10
|
-
import createDebug from '#debug'
|
|
11
|
-
import { getPlatform, Platform } from '#lib/platform.js'
|
|
12
|
-
import { DOCS_BASE_URL } from '#lib/doctor/constants.js'
|
|
13
|
-
|
|
14
|
-
const debug = createDebug('lib:doctor:pandoc-available')
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get pandoc binary path if available
|
|
18
|
-
* @returns {string|null} Path to pandoc binary or null if not found
|
|
19
|
-
*/
|
|
20
|
-
function getPandocPath() {
|
|
21
|
-
return which.sync('pandoc', { nothrow: true })
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get OS-specific Pandoc installation instructions
|
|
26
|
-
* @returns {string}
|
|
27
|
-
*/
|
|
28
|
-
function getRemediation() {
|
|
29
|
-
const platform = getPlatform()
|
|
30
|
-
|
|
31
|
-
switch (platform) {
|
|
32
|
-
case Platform.MACOS:
|
|
33
|
-
return `Pandoc is optional (only needed for --engine pandoc).
|
|
34
|
-
• Install via Homebrew: brew install pandoc
|
|
35
|
-
• Or download from: https://pandoc.org/installing.html`
|
|
36
|
-
case Platform.WINDOWS:
|
|
37
|
-
return `Pandoc is optional (only needed for --engine pandoc).
|
|
38
|
-
• Install via winget: winget install --source winget --exact --id JohnMacFarlane.Pandoc
|
|
39
|
-
• Or download from: https://pandoc.org/installing.html
|
|
40
|
-
• Restart your terminal after installation`
|
|
41
|
-
case Platform.LINUX:
|
|
42
|
-
return `Pandoc is optional (only needed for --engine pandoc).
|
|
43
|
-
• Install via package manager: apt install pandoc / dnf install pandoc
|
|
44
|
-
• Or download from: https://pandoc.org/installing.html`
|
|
45
|
-
default:
|
|
46
|
-
return `Pandoc is optional (only needed for --engine pandoc).
|
|
47
|
-
• Download from: https://pandoc.org/installing.html`
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Check Pandoc is available in PATH
|
|
53
|
-
*
|
|
54
|
-
* This is an optional check - Pandoc is only required when using
|
|
55
|
-
* the --engine pandoc option for EPUB generation. The default engine
|
|
56
|
-
* (epubjs) does not require Pandoc.
|
|
57
|
-
*
|
|
58
|
-
* @returns {import('../../index.js').CheckResult}
|
|
59
|
-
*/
|
|
60
|
-
export function checkPandocAvailable() {
|
|
61
|
-
const pandocPath = getPandocPath()
|
|
62
|
-
const ok = !!pandocPath
|
|
63
|
-
debug('pandoc available: %s', ok)
|
|
64
|
-
|
|
65
|
-
if (ok) {
|
|
66
|
-
return {
|
|
67
|
-
ok: true,
|
|
68
|
-
message: 'installed',
|
|
69
|
-
details: pandocPath,
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
ok: false,
|
|
75
|
-
level: 'warn',
|
|
76
|
-
message: 'not found (optional)',
|
|
77
|
-
remediation: getRemediation(),
|
|
78
|
-
docsUrl: `${DOCS_BASE_URL}/quire-commands/#epub`,
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default checkPandocAvailable
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import test from 'ava'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
import esmock from 'esmock'
|
|
4
|
-
|
|
5
|
-
test.beforeEach((t) => {
|
|
6
|
-
t.context.sandbox = sinon.createSandbox()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test.afterEach.always((t) => {
|
|
10
|
-
t.context.sandbox.restore()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('checkPandocAvailable returns ok when pandoc is available', async (t) => {
|
|
14
|
-
const { sandbox } = t.context
|
|
15
|
-
|
|
16
|
-
const { checkPandocAvailable } = await esmock('./pandoc-available.js', {
|
|
17
|
-
which: {
|
|
18
|
-
sync: sandbox.stub().returns('/usr/local/bin/pandoc'),
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const result = checkPandocAvailable()
|
|
23
|
-
|
|
24
|
-
t.true(result.ok)
|
|
25
|
-
t.regex(result.message, /installed/)
|
|
26
|
-
t.is(result.details, '/usr/local/bin/pandoc')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test('checkPandocAvailable returns warning when pandoc is missing', async (t) => {
|
|
30
|
-
const { sandbox } = t.context
|
|
31
|
-
|
|
32
|
-
const { checkPandocAvailable } = await esmock('./pandoc-available.js', {
|
|
33
|
-
which: {
|
|
34
|
-
sync: sandbox.stub().returns(null),
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const result = checkPandocAvailable()
|
|
39
|
-
|
|
40
|
-
t.false(result.ok)
|
|
41
|
-
t.is(result.level, 'warn', 'should be a warning, not an error')
|
|
42
|
-
t.is(result.message, 'not found (optional)')
|
|
43
|
-
t.truthy(result.remediation, 'should include remediation guidance')
|
|
44
|
-
t.truthy(result.docsUrl, 'should include documentation link')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
test('checkPandocAvailable remediation includes download link', async (t) => {
|
|
48
|
-
const { sandbox } = t.context
|
|
49
|
-
|
|
50
|
-
const { checkPandocAvailable } = await esmock('./pandoc-available.js', {
|
|
51
|
-
which: {
|
|
52
|
-
sync: sandbox.stub().returns(null),
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const result = checkPandocAvailable()
|
|
57
|
-
|
|
58
|
-
t.regex(result.remediation, /pandoc\.org/, 'should include Pandoc download URL')
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
test('checkPandocAvailable remediation mentions --engine pandoc', async (t) => {
|
|
62
|
-
const { sandbox } = t.context
|
|
63
|
-
|
|
64
|
-
const { checkPandocAvailable } = await esmock('./pandoc-available.js', {
|
|
65
|
-
which: {
|
|
66
|
-
sync: sandbox.stub().returns(null),
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const result = checkPandocAvailable()
|
|
71
|
-
|
|
72
|
-
t.regex(result.remediation, /--engine pandoc/, 'should mention --engine pandoc flag')
|
|
73
|
-
})
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PrinceXML availability check
|
|
3
|
-
*
|
|
4
|
-
* Checks if PrinceXML is installed and available in PATH.
|
|
5
|
-
* PrinceXML is an optional PDF engine - only required when using --engine prince.
|
|
6
|
-
*
|
|
7
|
-
* @module lib/doctor/checks/tools/prince-available
|
|
8
|
-
*/
|
|
9
|
-
import which from 'which'
|
|
10
|
-
import createDebug from '#debug'
|
|
11
|
-
import { getPlatform, Platform } from '#lib/platform.js'
|
|
12
|
-
import { DOCS_BASE_URL } from '#lib/doctor/constants.js'
|
|
13
|
-
|
|
14
|
-
const debug = createDebug('lib:doctor:prince-available')
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get prince binary path if available
|
|
18
|
-
* @returns {string|null} Path to prince binary or null if not found
|
|
19
|
-
*/
|
|
20
|
-
function getPrincePath() {
|
|
21
|
-
return which.sync('prince', { nothrow: true })
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get OS-specific PrinceXML installation instructions
|
|
26
|
-
* @returns {string}
|
|
27
|
-
*/
|
|
28
|
-
function getRemediation() {
|
|
29
|
-
const platform = getPlatform()
|
|
30
|
-
|
|
31
|
-
switch (platform) {
|
|
32
|
-
case Platform.MACOS:
|
|
33
|
-
return `PrinceXML is optional (only needed for --engine prince).
|
|
34
|
-
• Download from: https://www.princexml.com/download/
|
|
35
|
-
• Or install via Homebrew: brew install --cask prince`
|
|
36
|
-
case Platform.WINDOWS:
|
|
37
|
-
return `PrinceXML is optional (only needed for --engine prince).
|
|
38
|
-
• Download from: https://www.princexml.com/download/
|
|
39
|
-
• Restart your terminal after installation`
|
|
40
|
-
case Platform.LINUX:
|
|
41
|
-
return `PrinceXML is optional (only needed for --engine prince).
|
|
42
|
-
• Download from: https://www.princexml.com/download/
|
|
43
|
-
• Follow platform-specific installation instructions`
|
|
44
|
-
default:
|
|
45
|
-
return `PrinceXML is optional (only needed for --engine prince).
|
|
46
|
-
• Download from: https://www.princexml.com/download/`
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Check PrinceXML is available in PATH
|
|
52
|
-
*
|
|
53
|
-
* This is an optional check - PrinceXML is only required when using
|
|
54
|
-
* the --engine prince option for PDF generation. The default engine
|
|
55
|
-
* (Paged.js) does not require PrinceXML.
|
|
56
|
-
*
|
|
57
|
-
* @returns {import('../../index.js').CheckResult}
|
|
58
|
-
*/
|
|
59
|
-
export function checkPrinceAvailable() {
|
|
60
|
-
const princePath = getPrincePath()
|
|
61
|
-
const ok = !!princePath
|
|
62
|
-
debug('prince available: %s', ok)
|
|
63
|
-
|
|
64
|
-
if (ok) {
|
|
65
|
-
return {
|
|
66
|
-
ok: true,
|
|
67
|
-
message: 'installed',
|
|
68
|
-
details: princePath,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
ok: false,
|
|
74
|
-
level: 'warn',
|
|
75
|
-
message: 'not found (optional)',
|
|
76
|
-
remediation: getRemediation(),
|
|
77
|
-
docsUrl: `${DOCS_BASE_URL}/quire-commands/#pdf`,
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default checkPrinceAvailable
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import test from 'ava'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
import esmock from 'esmock'
|
|
4
|
-
|
|
5
|
-
test.beforeEach((t) => {
|
|
6
|
-
t.context.sandbox = sinon.createSandbox()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test.afterEach.always((t) => {
|
|
10
|
-
t.context.sandbox.restore()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('checkPrinceAvailable returns ok when prince is available', async (t) => {
|
|
14
|
-
const { sandbox } = t.context
|
|
15
|
-
|
|
16
|
-
const { checkPrinceAvailable } = await esmock('./prince-available.js', {
|
|
17
|
-
which: {
|
|
18
|
-
sync: sandbox.stub().returns('/usr/local/bin/prince'),
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const result = checkPrinceAvailable()
|
|
23
|
-
|
|
24
|
-
t.true(result.ok)
|
|
25
|
-
t.regex(result.message, /installed/)
|
|
26
|
-
t.is(result.details, '/usr/local/bin/prince')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test('checkPrinceAvailable returns warning when prince is missing', async (t) => {
|
|
30
|
-
const { sandbox } = t.context
|
|
31
|
-
|
|
32
|
-
const { checkPrinceAvailable } = await esmock('./prince-available.js', {
|
|
33
|
-
which: {
|
|
34
|
-
sync: sandbox.stub().returns(null),
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const result = checkPrinceAvailable()
|
|
39
|
-
|
|
40
|
-
t.false(result.ok)
|
|
41
|
-
t.is(result.level, 'warn', 'should be a warning, not an error')
|
|
42
|
-
t.is(result.message, 'not found (optional)')
|
|
43
|
-
t.truthy(result.remediation, 'should include remediation guidance')
|
|
44
|
-
t.truthy(result.docsUrl, 'should include documentation link')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
test('checkPrinceAvailable remediation includes download link', async (t) => {
|
|
48
|
-
const { sandbox } = t.context
|
|
49
|
-
|
|
50
|
-
const { checkPrinceAvailable } = await esmock('./prince-available.js', {
|
|
51
|
-
which: {
|
|
52
|
-
sync: sandbox.stub().returns(null),
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const result = checkPrinceAvailable()
|
|
57
|
-
|
|
58
|
-
t.regex(result.remediation, /princexml\.com/, 'should include PrinceXML download URL')
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
test('checkPrinceAvailable remediation mentions --engine prince', async (t) => {
|
|
62
|
-
const { sandbox } = t.context
|
|
63
|
-
|
|
64
|
-
const { checkPrinceAvailable } = await esmock('./prince-available.js', {
|
|
65
|
-
which: {
|
|
66
|
-
sync: sandbox.stub().returns(null),
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const result = checkPrinceAvailable()
|
|
71
|
-
|
|
72
|
-
t.regex(result.remediation, /--engine prince/, 'should mention --engine prince flag')
|
|
73
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-export shared constants for doctor checks
|
|
3
|
-
*
|
|
4
|
-
* This module re-exports constants from the shared lib/constants.js
|
|
5
|
-
* to maintain backwards compatibility with existing doctor check imports.
|
|
6
|
-
*
|
|
7
|
-
* @module lib/doctor/constants
|
|
8
|
-
*/
|
|
9
|
-
export {
|
|
10
|
-
DOCS_BASE_URL,
|
|
11
|
-
QUIRE_11TY_PACKAGE,
|
|
12
|
-
REQUIRED_NODE_VERSION,
|
|
13
|
-
} from '#lib/constants.js'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Stale threshold intervals in milliseconds, keyed by setting name.
|
|
17
|
-
*
|
|
18
|
-
* Used by output checks (stale-build, pdf-output, epub-output) to determine
|
|
19
|
-
* how much time must elapse before an output is flagged as stale.
|
|
20
|
-
*
|
|
21
|
-
* @constant {Object<string, number>}
|
|
22
|
-
*/
|
|
23
|
-
export const STALE_THRESHOLDS = Object.freeze({
|
|
24
|
-
ZERO: 0,
|
|
25
|
-
SHORT: 5 * 60 * 1000,
|
|
26
|
-
HOURLY: 60 * 60 * 1000,
|
|
27
|
-
DAILY: 12 * 60 * 60 * 1000,
|
|
28
|
-
NEVER: Infinity,
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Resolve the staleThreshold config value to milliseconds.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} value - One of the STALE_THRESHOLDS keys
|
|
35
|
-
* @returns {number} Threshold in milliseconds
|
|
36
|
-
*/
|
|
37
|
-
export function resolveStaleThreshold(value) {
|
|
38
|
-
return STALE_THRESHOLDS[value] ?? STALE_THRESHOLDS.HOURLY
|
|
39
|
-
}
|