@thegetty/quire-cli 1.0.0-pre-release.5 → 1.0.0-pre-release.7

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-pre-release.5",
4
+ "version": "1.0.0-pre-release.7",
5
5
  "author": "Getty Digital",
6
6
  "license": "J Paul Getty Trust",
7
7
  "bugs": {
@@ -0,0 +1,17 @@
1
+ import which from 'which'
2
+
3
+ /**
4
+ * A simple wrapper around the `which` utility
5
+ * to find the first instance of an executable in the shell environment PATH
6
+ *
7
+ * @param {String} executable shell executable to find
8
+ */
9
+ export default (executable) => {
10
+ const result = which.sync(executable, { nothrow: true })
11
+ if (!result) {
12
+ console.error(`Unable to locate executable '${executable}'\n
13
+ Ensure that the '${executable}' executable is installed and available in the shell environment PATH.
14
+ `)
15
+ }
16
+ return result
17
+ }
@@ -0,0 +1,21 @@
1
+ // if (!commandExists('pagedjs-cli')) return
2
+ // const opts = [
3
+ // `--outline-tags 'h1'`,
4
+ // `--output ${output}`,
5
+ // ]
6
+ // const { stderror, stdout } = execa('pagedjs-cli', [...opts, input])
7
+
8
+ // console.info(`[CLI:lib/pdf] generating PDF using ${lib}`)
9
+ // const Printer = await import('pagedjs-cli')
10
+ /**
11
+ * Configure the Paged.js Printer options
12
+ * @see https://gitlab.coko.foundation/pagedjs/pagedjs-cli/-/blob/main/src/cli.js
13
+ */
14
+ // const printerOptions = { debug: options.debug || false }
15
+ // const printer = new Printer(printerOptions)
16
+ /**
17
+ * Configure the Paged.js PDF options
18
+ * @see
19
+ */
20
+ // const pdfOptions = {}
21
+ // const pdfFile = await printer.pdf(input, pdfOptions)
@@ -0,0 +1,7 @@
1
+ // if (!commandExists('prince')) return
2
+ // const opts = [
3
+ // `--outline-tags 'h1'`,
4
+ // `--output ${output}`,
5
+ // ]
6
+ // console.info(`[CLI:lib/pdf] generating PDF using ${lib}`)
7
+ // const { stderror, stdout } = execa('prince', [...opts, input])
File without changes
@@ -1,54 +0,0 @@
1
- import Command from '#src/Command.js'
2
- import { build } from '#lib/pdf/index.js'
3
- import open from 'open'
4
-
5
- /**
6
- * Quire CLI `build epub` Command
7
- *
8
- * Generate an EPUB from Eleventy `build` output.
9
- *
10
- * @class EpubCommand
11
- * @extends {Command}
12
- */
13
- export default class EpubCommand extends Command {
14
- static definition = {
15
- name: 'epub',
16
- description: 'Generate publication EPUB',
17
- summary: 'run build epub',
18
- version: '1.0.0',
19
- args: [
20
- ],
21
- options: [
22
- [
23
- '--lib <module>', 'use the specified pdf module', 'pagedjs',
24
- // { choices: ['pagedjs', 'prince'], default: 'pagedjs' }
25
- ],
26
- [ '--open', 'open PDF in default application' ],
27
- [ '--debug', 'run build with debug output to console' ],
28
- ],
29
- }
30
-
31
- constructor() {
32
- super(PDFCommand.definition)
33
- }
34
-
35
- action(options, command) {
36
- if (options.debug) {
37
- console.debug('[CLI] Command \'%s\' called with options %o', this.name(), options)
38
- }
39
- const pdf = await pdf.build()
40
- if (options.open) await open(pdf)
41
- }
42
-
43
- /**
44
- * test that `build site` has been run and output can be reused
45
- * @todo
46
- */
47
- preAction(command) {
48
- const options = command.opts()
49
- if (options.debug) {
50
- console.debug('[CLI] Calling \'build\' command pre-action with options', options)
51
- }
52
- // console.log(command.parent)
53
- }
54
- }
@@ -1,54 +0,0 @@
1
- import Command from '#src/Command.js'
2
- import { build } from '#lib/pdf/index.js'
3
- import open from 'open'
4
-
5
- /**
6
- * Quire CLI `build pdf` Command
7
- *
8
- * Generate a PDF from Eleventy `build` output.
9
- *
10
- * @class PDFCommand
11
- * @extends {Command}
12
- */
13
- export default class PDFCommand extends Command {
14
- static definition = {
15
- name: 'pdf',
16
- description: 'Generate publication PDF',
17
- summary: 'run build pdf',
18
- version: '1.0.0',
19
- args: [
20
- ],
21
- options: [
22
- [
23
- '--lib <module>', 'use the specified pdf module', 'pagedjs',
24
- // { choices: ['pagedjs', 'prince'], default: 'pagedjs' }
25
- ],
26
- [ '--open', 'open PDF in default application' ],
27
- [ '--debug', 'run build with debug output to console' ],
28
- ],
29
- }
30
-
31
- constructor() {
32
- super(PDFCommand.definition)
33
- }
34
-
35
- action(options, command) {
36
- if (options.debug) {
37
- console.debug('[CLI] Command \'%s\' called with options %o', this.name(), options)
38
- }
39
- const pdf = await pdf.build()
40
- if (options.open) await open(pdf)
41
- }
42
-
43
- /**
44
- * test that `build site` has been run and output can be reused
45
- * @todo
46
- */
47
- preAction(command) {
48
- const options = command.opts()
49
- if (options.debug) {
50
- console.debug('[CLI] Calling \'build\' command pre-action with options', options)
51
- }
52
- // console.log(command.parent)
53
- }
54
- }
@@ -1,66 +0,0 @@
1
- import Command from '#src/Command.js'
2
- import { api, cli, paths, projectRoot } from '#lib/11ty/index.js'
3
- import { clean } from '#helpers/clean.js'
4
-
5
- /**
6
- * Quire CLI `build site` Command
7
- *
8
- * Runs the Eleventy `build` to generate static output.
9
- *
10
- * @class SiteCommand
11
- * @extends {Command}
12
- */
13
- export default class SiteCommand extends Command {
14
- static definition = {
15
- name: 'site',
16
- description: 'Generate publication outputs',
17
- summary: 'run build site',
18
- version: '1.0.0',
19
- isDefault: true,
20
- args: [
21
- // [
22
- // '[formats]', 'output formats',
23
- // {
24
- // choices: ['html', 'pdf', 'epub'],
25
- // default: ['html', 'html only']
26
- // }
27
- // ],
28
- ],
29
- options: [
30
- [ '-d', '--dry-run', 'run build without writing files' ],
31
- [ '-q', '--quiet', 'run build with no console messages' ],
32
- [ '-v', '--verbose', 'run build with verbose console messages' ],
33
- [
34
- '--11ty <module>', 'use the specified 11ty module', 'cli',
35
- // { choices: ['api', 'cli'], default: 'cli' }
36
- ],
37
- [ '--debug', 'run build with debug output to console' ],
38
- ],
39
- }
40
-
41
- constructor() {
42
- super(SiteCommand.definition)
43
- }
44
-
45
- action(options, command) {
46
- if (options.debug) {
47
- console.debug('[CLI] Command \'%s\' called with options %o', this.name(), options)
48
- }
49
-
50
- if (options['11ty'] === 'cli') {
51
- console.debug('[CLI] running eleventy using lib/11ty cli')
52
- cli.build(options)
53
- } else {
54
- console.debug('[CLI] running eleventy using lib/11ty api')
55
- api.build(options)
56
- }
57
- }
58
-
59
- preAction(command) {
60
- const options = command.opts()
61
- if (options.debug) {
62
- console.debug('[CLI] Calling \'build\' command pre-action with options', options)
63
- }
64
- clean(projectRoot, paths, options)
65
- }
66
- }