@thegetty/quire-cli 1.0.0-rc.2 → 1.0.0-rc.21

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +93 -7
  2. package/README.md +14 -0
  3. package/bin/cli.js +21 -8
  4. package/package.json +16 -9
  5. package/patches/README.md +19 -0
  6. package/patches/install-npm-version+1.0.9.patch +12119 -0
  7. package/src/Command.js +14 -0
  8. package/src/LOGGING.md +16 -0
  9. package/src/commands/README.md +28 -8
  10. package/src/commands/conf.js +43 -0
  11. package/src/commands/config/config-get.js +35 -0
  12. package/src/commands/config/config-reset.js +34 -0
  13. package/src/commands/config/config-set.js +37 -0
  14. package/src/commands/create.js +25 -7
  15. package/src/commands/epub.js +1 -2
  16. package/src/commands/info.js +128 -0
  17. package/src/commands/pdf.js +59 -10
  18. package/src/helpers/clean.js +5 -0
  19. package/src/helpers/is-empty.js +4 -0
  20. package/src/helpers/is-quire.js +4 -0
  21. package/src/helpers/os-utils.js +4 -0
  22. package/src/helpers/test-cwd.js +4 -0
  23. package/src/helpers/which.js +4 -0
  24. package/src/lib/conf/README.md +104 -0
  25. package/src/lib/conf/config.js +42 -0
  26. package/src/lib/conf/defaults.js +37 -0
  27. package/src/lib/conf/migrations.js +11 -0
  28. package/src/lib/conf/schema.js +30 -0
  29. package/src/lib/epub/index.js +3 -1
  30. package/src/lib/pdf/README.md +11 -4
  31. package/src/lib/pdf/index.js +7 -5
  32. package/src/lib/pdf/paged.js +88 -9
  33. package/src/lib/pdf/pagedPlugin.js +49 -0
  34. package/src/lib/pdf/prince.js +78 -4
  35. package/src/lib/pdf/princePlugin.js +35 -0
  36. package/src/lib/pdf/split.js +61 -0
  37. package/src/lib/quire/index.js +68 -58
  38. package/src/main.js +26 -6
  39. package/src/lib/11ty/plugins/before.js +0 -16
  40. package/src/lib/config/README.md +0 -3
  41. package/src/lib/config/index.js +0 -1
  42. package/src/lib/quire/constants.js +0 -6
  43. package/src/lib/quire/project.js +0 -104
package/CHANGELOG.md CHANGED
@@ -5,19 +5,105 @@ All notable changes to the `quire-cli` will be documented in this file.
5
5
  The log format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  Changelog entries are classified using the following labels:
8
-
9
8
  - `Added`: for new features
10
-
11
9
  - `Bumped`: updated dependencies, only minor or higher will be listed
12
-
13
10
  - `Changed`: for changes in existing functionality
14
-
15
11
  - `Deprecated`: for once-stable features removed in upcoming releases
16
-
17
12
  - `Fixed`: for any bug fixes
18
-
19
13
  - `Removed`: for deprecated features removed in this release
20
14
 
15
+ ## [1.0.0-rc.21]
16
+
17
+ ### Fixed
18
+
19
+ - Fixed missing import of `node:path`
20
+
21
+ ## [1.0.0-rc.20]
22
+
23
+ ### Changed
24
+
25
+ - Replace Node `import` assertions (deprecated) with file operations
26
+
27
+ ### Fixed
28
+
29
+ - Quire new command fails with newer version of Node #968
30
+
31
+ ## [1.0.0-rc.19]
32
+
33
+ ### Added
34
+
35
+ - `jsdoc-to-markdown` to development dependencies
36
+ - JSDoc configuration (see https://jsdoc.app/about-configuring-jsdoc)
37
+ - Npm script `docs` to run jsdoc-to-markdown
38
+
39
+ ## [1.0.0-rc.18]
40
+
41
+ ### Added
42
+
43
+ - Quire CLI configuration management using the `conf` package
44
+ - `quire conf` command to manage cli configuration properties
45
+
46
+ ## [1.0.0-rc.17]
47
+
48
+ ### Bumped
49
+
50
+ - `install-npm-version` patch version
51
+
52
+ ### Changed
53
+
54
+ - update patch `install-npm-version`
55
+
56
+ ## [1.0.0-rc.16]
57
+
58
+ ### Added
59
+
60
+ - Patch for `install-npm-version`; see https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
61
+
62
+ ### Changed
63
+
64
+ **Nota bene** installing `quire-cli` as a _local package_ requires running `npm install` with the `--install-strategy=nested` flag; installing `quire-cli` as a global node module has not changed.
65
+
66
+ ### Fixed
67
+
68
+ - Dependency instal error on Windows when running quire new DEV-19124
69
+
70
+ ## [1.0.0-rc.12]
71
+
72
+ ### Added
73
+ - Handling for single-page PDFs
74
+ - Paged and Prince plugins to map quire pages to PDF page sections
75
+
76
+ ### Changed
77
+
78
+ - `quire clean` also removes `.11ty-vite` in the project root
79
+
80
+ ## [1.0.0-rc.11]
81
+
82
+ ### Bumped
83
+ - `epubjs-cli` to version 0.1.6
84
+ - `pagedjs-cli` to version 0.4.3
85
+
86
+ ### Fixed
87
+ - EPUB validation error where pages that include SVGs must include SVG as property under `readingOrder`
88
+
89
+ ## [1.0.0-rc.10]
90
+
91
+ ### Added
92
+ - Support semantic version ranges for `quire-11ty` in quire starter projects and the `--quire-version` option of the `quire new` command, and use the latest compatible `quire-11ty` version when creating and installing a new project.
93
+
94
+ ## [1.0.0-rc.9]
95
+
96
+ ### Added
97
+ - Update old `.quire` files when running `info` command on versions prior to `1.0.0-rc.8`
98
+ - Include `quire-cli` version used to generate project in `info` output
99
+ - Adds headings to `info` output
100
+
101
+ ## [1.0.0-rc.8]
102
+
103
+ ### Added
104
+ - Added `info` command to output package versions
21
105
 
22
- ## [Unreleased]
106
+ ## [1.0.0-rc.7]
23
107
 
108
+ ### Added
109
+ - Added `new` command `--quire-path` option to support development with local version of `quire-11ty`
package/README.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  The `quire-cli` implements the [command pattern](https://en.wikipedia.org/wiki/Command_pattern) to receive input from a user and delegate command behavoir to modules for the services, such as `git` and `11ty`, involved in working on Quire publications.
4
4
 
5
+ ### Installing the CLI
6
+
7
+ The `quire-cli` can be installed as a global npm module as follows
8
+
9
+ ```sh
10
+ npm install quire-cli --global
11
+ ```
12
+
13
+ Installing the `quire-cli` as a _local package dependency_ requires additional npm command flags to support patching package dependencies as follows,
14
+
15
+ ```sh
16
+ npm install quire-cli --install-strategy=nested
17
+ ```
18
+
5
19
  ### Using the CLI
6
20
 
7
21
  `npx` supports executing npm package binaries even when they are not yet installed and will download the package into a cache if it does not find either a locally or globally installed version. Simply run
package/bin/cli.js CHANGED
@@ -1,31 +1,44 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
-
2
+ import { dirname, join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import fs from 'node:fs'
3
5
  import cli from '#src/main.js'
4
- import packageConfig from '#root/package.json' assert { type: 'json' }
6
+ import config from '#src/lib/conf/config.js'
5
7
  import updateNotifier from 'update-notifier'
6
8
 
9
+ const __dirname = dirname(fileURLToPath(import.meta.url))
10
+
11
+ const packagePath = join(__dirname, 'package.json')
12
+ const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
13
+
7
14
  process.removeAllListeners('warning')
8
15
 
16
+ /**
17
+ * Interval constants in milliseconds
18
+ */
9
19
  const INTERVAL = Object.freeze({
10
- MINUTES: 1000 * 60 * 1,
20
+ MINUTE: 1000 * 60 * 1,
11
21
  HOURLY: 1000 * 60 * 60,
12
22
  DAILY: 1000 * 60 * 60 * 24,
13
23
  WEEKLY: 1000 * 60 * 60 * 24 * 7
14
24
  })
15
25
 
26
+ const updateChannel = config.get('updateChannel')
27
+ const updateIterval = config.get('updateIterval')
28
+
16
29
  /**
17
- * Check for quire-cli updates
30
+ * Create a notifier to Check for quire-cli updates
18
31
  * @see https://github.com/yeoman/update-notifier#usage
19
32
  *
20
- * @todo user configuration of choosen update interval
33
+ * @todo refactor to check multiple channels
21
34
  */
22
35
  const notifier = updateNotifier({
23
- distTag: 'rc',
36
+ distTag: updateChannel,
24
37
  pkg: packageConfig,
25
- updateCheckInterval: INTERVAL.DAILY,
38
+ updateCheckInterval: INTERVAL[updateIterval],
26
39
  })
27
40
 
28
- notifier.notify()
41
+ notifier.notify({ defer: false })
29
42
 
30
43
  /**
31
44
  * Run the cli program
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.2",
4
+ "version": "1.0.0-rc.21",
5
5
  "author": "Getty Digital",
6
6
  "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
7
7
  "bugs": {
@@ -19,7 +19,8 @@
19
19
  "type": "module",
20
20
  "files": [
21
21
  "bin/",
22
- "scripts",
22
+ "patches/",
23
+ "scripts/",
23
24
  "src/",
24
25
  "CHANGELOG.md",
25
26
  "LICENSE",
@@ -34,8 +35,10 @@
34
35
  "directory": "packages/cli"
35
36
  },
36
37
  "scripts": {
38
+ "docs": "jsdoc2md --configure jsdoc.json --files src/**/*.js > docs/cli.md",
37
39
  "lint": "eslint src --ext .js",
38
40
  "lint:fix": "npm run lint -- --fix",
41
+ "postinstall": "cross-env patch-package --error-on-fail",
39
42
  "test": "echo \"Error: no test specified\" && exit 1"
40
43
  },
41
44
  "imports": {
@@ -45,29 +48,33 @@
45
48
  "#lib/*.js": "./src/lib/*.js"
46
49
  },
47
50
  "dependencies": {
51
+ "ajv": "^8.16.0",
48
52
  "boxen": "^7.0.1",
49
53
  "chalk": "^5.2.0",
50
- "commander": "^10.0.0",
51
- "conf": "^11.0.1",
54
+ "commander": "^12.1.0",
55
+ "conf": "^13.1.0",
52
56
  "cross-env": "^7.0.3",
53
57
  "del": "^7.0.0",
54
- "epubjs-cli": "^0.1.1",
58
+ "epubjs-cli": "^0.1.6",
55
59
  "execa": "^6.1.0",
56
60
  "fs-extra": "^11.1.0",
57
61
  "hosted-git-info": "^6.1.1",
58
62
  "i18next": "^22.4.9",
59
63
  "inquirer": "^9.1.4",
60
- "install-npm-version": "^1.0.8",
64
+ "install-npm-version": "^1.0.9",
65
+ "js-yaml": "^4.1.0",
61
66
  "loglevel": "^1.8.1",
62
67
  "open": "^8.4.0",
63
68
  "ora": "^6.1.2",
64
- "pagedjs-cli": "^0.3.3",
69
+ "pagedjs-cli": "^0.4.3",
70
+ "patch-package": "^8.0.0",
65
71
  "semver": "^7.3.8",
66
72
  "simple-git": "^3.16.0",
67
- "update-notifier": "^6.0.2"
73
+ "update-notifier": "^7.3.1"
68
74
  },
69
75
  "devDependencies": {
70
- "eslint": "^8.32.0"
76
+ "eslint": "^8.32.0",
77
+ "jsdoc-to-markdown": "^9.1.1"
71
78
  },
72
79
  "engines": {
73
80
  "node": ">=14.16"
@@ -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
+ ```