@thegetty/quire-cli 1.0.0-rc.35 → 1.0.0-rc.36
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 +36 -0
- package/README.md +9 -0
- package/bin/cli.js +19 -1
- package/package.json +21 -8
- package/patches/README.md +19 -0
- package/patches/install-npm-version+1.0.9.patch +12119 -0
- package/schemas/objects.schema.json +12 -38
- package/schemas/publication.schema.json +0 -22
- package/schemas/references.schema.json +0 -1
- package/src/Command.js +26 -6
- package/src/Command.spec.js +99 -0
- package/src/commands/README.md +213 -122
- package/src/commands/build.js +46 -37
- package/src/commands/build.spec.js +113 -0
- package/src/commands/build.test.js +402 -0
- package/src/commands/clean.js +25 -19
- package/src/commands/clean.spec.js +108 -0
- package/src/commands/clean.test.js +260 -0
- package/src/commands/config.js +251 -0
- package/src/commands/config.spec.js +107 -0
- package/src/commands/config.test.js +715 -0
- package/src/commands/create.js +42 -14
- package/src/commands/create.spec.js +112 -0
- package/src/commands/create.test.js +415 -0
- package/src/commands/epub.js +59 -30
- package/src/commands/epub.spec.js +114 -0
- package/src/commands/epub.test.js +503 -0
- package/src/commands/index.js +9 -2
- package/src/commands/info.js +18 -24
- package/src/commands/info.spec.js +64 -0
- package/src/commands/info.test.js +415 -0
- package/src/commands/pdf.js +58 -84
- package/src/commands/pdf.spec.js +114 -0
- package/src/commands/pdf.test.js +464 -0
- package/src/commands/preview.js +26 -31
- package/src/commands/preview.spec.js +97 -0
- package/src/commands/preview.test.js +250 -0
- package/src/commands/use.js +56 -0
- package/src/commands/use.spec.js +61 -0
- package/src/commands/use.test.js +280 -0
- package/src/commands/validate.js +31 -19
- package/src/commands/validate.spec.js +82 -0
- package/src/commands/validate.test.js +234 -0
- package/src/commands/workflows.js +70 -0
- package/src/errors/build/build-failed-error.js +19 -0
- package/src/errors/build/config-field-missing-error.js +20 -0
- package/src/errors/build/config-file-not-found-error.js +20 -0
- package/src/errors/build/index.js +11 -0
- package/src/errors/index.js +48 -0
- package/src/errors/install/dependency-install-error.js +19 -0
- package/src/errors/install/directory-not-empty-error.js +25 -0
- package/src/errors/install/index.js +12 -0
- package/src/errors/install/invalid-path-error.js +31 -0
- package/src/errors/install/invalid-starter-error.js +27 -0
- package/src/errors/install/version-not-found-error.js +35 -0
- package/src/errors/output/epub-generation-error.js +19 -0
- package/src/errors/output/index.js +14 -0
- package/src/errors/output/invalid-epub-library-error.js +20 -0
- package/src/errors/output/invalid-pdf-library-error.js +20 -0
- package/src/errors/output/missing-build-output-error.js +21 -0
- package/src/errors/output/pdf-generation-error.js +24 -0
- package/src/errors/output/tool-not-found-error.js +37 -0
- package/src/errors/project/index.js +10 -0
- package/src/errors/project/not-in-project-error.js +20 -0
- package/src/errors/project/project-create-error.js +21 -0
- package/src/errors/quire-error.js +27 -0
- package/src/errors/validation/validation-error.js +20 -11
- package/src/helpers/clean.js +1 -1
- package/src/helpers/docs-url.js +32 -0
- package/src/helpers/test-cwd.js +5 -6
- package/src/helpers/test-cwd.test.js +192 -0
- package/src/helpers/which.js +10 -4
- package/src/lib/11ty/README.md +135 -19
- package/src/lib/11ty/api.js +176 -93
- package/src/lib/11ty/cli.js +77 -35
- package/src/lib/11ty/index.js +64 -5
- package/src/lib/11ty/index.test.js +655 -0
- package/src/lib/README.md +275 -0
- package/src/lib/commander/index.js +100 -0
- package/src/lib/commander/index.test.js +86 -0
- package/src/lib/commander/options.js +195 -0
- package/src/lib/commander/options.test.js +109 -0
- package/src/lib/conf/README.md +84 -73
- package/src/lib/conf/config.js +5 -3
- package/src/lib/conf/config.test.js +281 -0
- package/src/lib/conf/defaults.js +44 -0
- package/src/lib/conf/format.js +60 -0
- package/src/lib/conf/format.test.js +106 -0
- package/src/lib/conf/helpers.js +91 -0
- package/src/lib/conf/helpers.test.js +136 -0
- package/src/lib/conf/index.js +22 -0
- package/src/lib/conf/schema.js +53 -8
- package/src/lib/epub/README.md +133 -2
- package/src/lib/epub/engines.js +46 -0
- package/src/lib/epub/epub.js +36 -11
- package/src/lib/epub/index.js +111 -21
- package/src/lib/epub/index.test.js +518 -0
- package/src/lib/epub/pandoc.js +33 -4
- package/src/lib/epub/pandoc.test.js +122 -0
- package/src/lib/epub/schema.js +21 -0
- package/src/lib/error/README.md +170 -0
- package/src/lib/error/handler.js +107 -0
- package/src/lib/git/README.md +151 -2
- package/src/lib/git/index.js +217 -13
- package/src/lib/git/index.spec.js +80 -0
- package/src/lib/git/index.test.js +453 -0
- package/src/lib/installer/index.js +309 -0
- package/src/lib/installer/index.spec.js +83 -0
- package/src/lib/installer/index.test.js +545 -0
- package/src/lib/logger/README.md +424 -0
- package/src/lib/logger/debug.js +90 -0
- package/src/lib/logger/debug.spec.js +130 -0
- package/src/lib/logger/index.js +228 -0
- package/src/lib/logger/index.spec.js +131 -0
- package/src/lib/logger/index.test.js +477 -0
- package/src/lib/npm/README.md +127 -0
- package/src/lib/npm/index.js +198 -0
- package/src/lib/npm/index.spec.js +60 -0
- package/src/lib/npm/index.test.js +355 -0
- package/src/lib/pdf/README.md +131 -0
- package/src/lib/pdf/engines.js +46 -0
- package/src/lib/pdf/index.js +124 -21
- package/src/lib/pdf/index.test.js +708 -0
- package/src/lib/pdf/paged.js +100 -52
- package/src/lib/pdf/paged.test.js +366 -0
- package/src/lib/pdf/prince.js +115 -37
- package/src/lib/pdf/prince.test.js +202 -0
- package/src/lib/pdf/schema.js +21 -0
- package/src/lib/pdf/split.js +61 -33
- package/src/lib/pdf/split.test.js +445 -0
- package/src/lib/process/manager.js +110 -0
- package/src/lib/process/manager.test.js +55 -0
- package/src/lib/project/build.js +143 -0
- package/src/lib/project/build.test.js +253 -0
- package/src/lib/project/config.js +48 -0
- package/src/lib/project/config.test.js +134 -0
- package/src/{helpers/is-quire.js → lib/project/detect.js} +5 -3
- package/src/lib/project/detect.test.js +157 -0
- package/src/lib/project/index.js +40 -0
- package/src/lib/project/paths.js +224 -0
- package/src/lib/project/version.js +110 -0
- package/src/lib/project/version.test.js +350 -0
- package/src/lib/reporter/README.md +211 -2
- package/src/lib/reporter/index.js +512 -0
- package/src/lib/reporter/index.test.js +593 -0
- package/src/main.js +134 -47
- package/src/main.spec.js +61 -0
- package/src/main.test.js +347 -0
- package/src/validators/utils.js +2 -1
- package/src/commands/conf.js +0 -43
- package/src/commands/version.js +0 -43
- package/src/lib/11ty/paths.js +0 -103
- package/src/lib/i18n/README.md +0 -3
- package/src/lib/i18n/config.js +0 -53
- package/src/lib/i18n/index.js +0 -43
- package/src/lib/i18n/localeService.js +0 -58
- package/src/lib/quire/README.md +0 -19
- package/src/lib/quire/index.js +0 -350
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,42 @@ Changelog entries are classified using the following labels:
|
|
|
12
12
|
- `Fixed`: for any bug fixes
|
|
13
13
|
- `Removed`: for deprecated features removed in this release
|
|
14
14
|
|
|
15
|
+
## [Unreleased]
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- New `quire validate` command to check YAML syntax in `content/_data/` directory
|
|
20
|
+
- New `quire use <version>` command (renamed from `quire version`) to change quire-11ty version
|
|
21
|
+
- Config settings for default PDF and EPUB engines via `quire settings set pdfEngine <engine>` and `quire settings set epubEngine <engine>`
|
|
22
|
+
- Config settings for default log level via `quire settings set logLevel <level>`
|
|
23
|
+
- Debug logger module with namespace support (`DEBUG=quire:*`)
|
|
24
|
+
- Process manager for graceful shutdown handling (Ctrl+C) during long-running operations
|
|
25
|
+
- `--build` flag for `quire pdf` and `quire epub` commands to run build first if output is missing
|
|
26
|
+
- `--engine` option for `quire pdf` and `quire epub` commands (deprecates `--lib`)
|
|
27
|
+
- Helper functions for build output detection (`hasSiteOutput`, `hasEpubOutput`, `hasPdfOutput`)
|
|
28
|
+
- Comprehensive error handling system with domain-specific error classes
|
|
29
|
+
- Documentation for CLI architecture, error handling, and testing
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Renamed `quire conf` command to `quire config` (aliased as `quire settings`)
|
|
34
|
+
- Renamed `quire version` command to `quire use`
|
|
35
|
+
- Refactored error handling to use thrown errors instead of `process.exit()` for better testability
|
|
36
|
+
- Commands now inherit `debug()` and `logger` methods from base Command class
|
|
37
|
+
- Improved log output with configurable log levels (trace, debug, info, warn, error, silent)
|
|
38
|
+
- Replaced `simple-git` dependency with a lightweight git façade module
|
|
39
|
+
- Replaced `execaCommand` with `execa` for improved command execution
|
|
40
|
+
- Encapsulated project concerns into dedicated `lib/project` module
|
|
41
|
+
- Encapsulated 11ty interactions into a façade module with process lifecycle management
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- `quire new` command arguments and options validation
|
|
46
|
+
- Command lifecycle hook errors are now correctly handled and reported
|
|
47
|
+
- Disabled auto-deletion of project directory on `quire new` failures to prevent accidental data loss
|
|
48
|
+
- Package schema files validation
|
|
49
|
+
- Process manager import paths for logger module
|
|
50
|
+
|
|
15
51
|
## [1.0.0-rc.33]
|
|
16
52
|
|
|
17
53
|
### Bumped
|
package/README.md
CHANGED
|
@@ -24,3 +24,12 @@ npm install quire-cli --install-strategy=nested
|
|
|
24
24
|
```sh
|
|
25
25
|
npx quire-cli --help
|
|
26
26
|
```
|
|
27
|
+
|
|
28
|
+
### Testing
|
|
29
|
+
|
|
30
|
+
The CLI uses two types of test files for commands:
|
|
31
|
+
|
|
32
|
+
- **`*.spec.js`** - Contract/interface tests that verify the command definition is correctly transformed into Commander.js Command object instance and the public API is correct
|
|
33
|
+
- **`*.test.js`** - Integration/behavior tests that verify command execution with real dependencies
|
|
34
|
+
|
|
35
|
+
See [docs/testing-commands.md](docs/testing-commands.md) for the complete testing guide and patterns.
|
package/bin/cli.js
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-warnings
|
|
2
|
-
import cli from '#src/main.js'
|
|
3
2
|
import config from '#src/lib/conf/config.js'
|
|
4
3
|
import packageConfig from '#src/packageConfig.js'
|
|
5
4
|
import updateNotifier from 'update-notifier'
|
|
6
5
|
|
|
6
|
+
// Import process manager to register signal handlers for graceful shutdown
|
|
7
|
+
import '#lib/process/manager.js'
|
|
8
|
+
|
|
7
9
|
process.removeAllListeners('warning')
|
|
8
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Set log level from config before importing CLI modules
|
|
13
|
+
*
|
|
14
|
+
* This env var is read by the logger at module creation time.
|
|
15
|
+
* Setting it here ensures all loggers (including module-level ones)
|
|
16
|
+
* use the configured level.
|
|
17
|
+
*
|
|
18
|
+
* @see lib/logger/index.js
|
|
19
|
+
*/
|
|
20
|
+
process.env.QUIRE_LOG_LEVEL = config.get('logLevel') || 'info'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Dynamic import ensures env var is set before logger modules are loaded
|
|
24
|
+
*/
|
|
25
|
+
const { default: cli } = await import('#src/main.js')
|
|
26
|
+
|
|
9
27
|
/**
|
|
10
28
|
* Interval constants in milliseconds
|
|
11
29
|
*/
|
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.36",
|
|
5
5
|
"author": "Getty Digital",
|
|
6
6
|
"license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
|
|
7
7
|
"bugs": {
|
|
@@ -39,26 +39,34 @@
|
|
|
39
39
|
"docs": "jsdoc2md --configure jsdoc.json --files src/**/*.js > docs/cli.md",
|
|
40
40
|
"lint": "eslint src --ext .js",
|
|
41
41
|
"lint:fix": "npm run lint -- --fix",
|
|
42
|
-
"test": "
|
|
42
|
+
"test": "ava",
|
|
43
|
+
"test:watch": "ava --watch",
|
|
44
|
+
"test:unit": "ava src/commands/**/*.spec.js src/lib/**/*.spec.js",
|
|
45
|
+
"test:integration": "ava src/commands/**/*.test.js src/helpers/**/*.test.js src/lib/**/*.test.js",
|
|
46
|
+
"test:e2e": "ava test/e2e/**/*.e2e.js",
|
|
47
|
+
"test:coverage": "c8 ava"
|
|
43
48
|
},
|
|
44
49
|
"imports": {
|
|
45
50
|
"#root/*": "./*",
|
|
46
51
|
"#src/*.js": "./src/*.js",
|
|
47
52
|
"#helpers/*.js": "./src/helpers/*.js",
|
|
48
|
-
"#lib/*.js": "./src/lib/*.js"
|
|
53
|
+
"#lib/*.js": "./src/lib/*.js",
|
|
54
|
+
"#debug": "./src/lib/logger/debug.js"
|
|
49
55
|
},
|
|
50
56
|
"dependencies": {
|
|
51
57
|
"ajv": "^8.16.0",
|
|
52
58
|
"boxen": "^7.0.1",
|
|
53
59
|
"chalk": "^5.2.0",
|
|
54
|
-
"commander": "^
|
|
55
|
-
"conf": "^
|
|
60
|
+
"commander": "^14.0.2",
|
|
61
|
+
"conf": "^15.0.2",
|
|
56
62
|
"cross-env": "^7.0.3",
|
|
63
|
+
"debug": "^4.4.0",
|
|
57
64
|
"del": "^7.0.0",
|
|
58
65
|
"epubjs-cli": "^0.1.6",
|
|
59
66
|
"execa": "^6.1.0",
|
|
60
67
|
"fs-extra": "^11.1.0",
|
|
61
68
|
"hosted-git-info": "^6.1.1",
|
|
69
|
+
"i18next": "^22.4.9",
|
|
62
70
|
"inquirer": "^9.1.4",
|
|
63
71
|
"js-yaml": "^4.1.0",
|
|
64
72
|
"loglevel": "^1.8.1",
|
|
@@ -66,14 +74,19 @@
|
|
|
66
74
|
"open": "^8.4.0",
|
|
67
75
|
"ora": "^6.1.2",
|
|
68
76
|
"pagedjs-cli": "^0.4.3",
|
|
77
|
+
"pdf-lib": "^1.17.1",
|
|
69
78
|
"read-package-up": "^11.0.0",
|
|
70
79
|
"semver": "^7.3.8",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
80
|
+
"update-notifier": "^7.3.1",
|
|
81
|
+
"which": "^2.0.2"
|
|
73
82
|
},
|
|
74
83
|
"devDependencies": {
|
|
84
|
+
"ava": "^6.2.0",
|
|
75
85
|
"eslint": "^8.32.0",
|
|
76
|
-
"
|
|
86
|
+
"esmock": "^2.7.3",
|
|
87
|
+
"jsdoc-to-markdown": "^9.1.1",
|
|
88
|
+
"memfs": "^4.51.1",
|
|
89
|
+
"sinon": "^17.0.1"
|
|
77
90
|
},
|
|
78
91
|
"engines": {
|
|
79
92
|
"node": ">=22"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Quire CLI Patches
|
|
2
|
+
|
|
3
|
+
Patches in this directory are applied to locally installed `node_modules` by the npm `postinstall` script ([npm scripts docs](https://docs.npmjs.com/cli/v10/using-npm/scripts)).
|
|
4
|
+
|
|
5
|
+
See [`patch-package`](https://github.com/ds300/patch-package) documenation for [making](https://github.com/ds300/patch-package#making-patches), [updating](https://github.com/ds300/patch-package#updating-patches), [applying](https://github.com/ds300/patch-package#applying-patches) and [reversing](https://github.com/ds300/patch-package#applying-patches) patches.
|
|
6
|
+
|
|
7
|
+
*Nota bene*
|
|
8
|
+
|
|
9
|
+
Patching the `quire-cli` package dependencies changes the way in which it must be must be installed. When installing the `quire-cli` as a _local package dependency_ the `--install-strategy=nested` flag must be used as follows
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install quire-cli --install-strategy=nested
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Installing the `quire-cli` as a global npm module has not changed,
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install quire-cli --global
|
|
19
|
+
```
|