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

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 +87 -7
  2. package/README.md +14 -0
  3. package/bin/cli.js +20 -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 +41 -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,99 @@ 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.20]
16
+
17
+ ### Changed
18
+
19
+ - Replace Node `import` assertions (deprecated) with file operations
20
+
21
+ ### Fixed
22
+
23
+ - Quire new command fails with newer version of Node #968
24
+
25
+ ## [1.0.0-rc.19]
26
+
27
+ ### Added
28
+
29
+ - `jsdoc-to-markdown` to development dependencies
30
+ - JSDoc configuration (see https://jsdoc.app/about-configuring-jsdoc)
31
+ - Npm script `docs` to run jsdoc-to-markdown
32
+
33
+ ## [1.0.0-rc.18]
34
+
35
+ ### Added
36
+
37
+ - Quire CLI configuration management using the `conf` package
38
+ - `quire conf` command to manage cli configuration properties
39
+
40
+ ## [1.0.0-rc.17]
41
+
42
+ ### Bumped
43
+
44
+ - `install-npm-version` patch version
45
+
46
+ ### Changed
47
+
48
+ - update patch `install-npm-version`
49
+
50
+ ## [1.0.0-rc.16]
51
+
52
+ ### Added
53
+
54
+ - Patch for `install-npm-version`; see https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
55
+
56
+ ### Changed
57
+
58
+ **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.
59
+
60
+ ### Fixed
61
+
62
+ - Dependency instal error on Windows when running quire new DEV-19124
63
+
64
+ ## [1.0.0-rc.12]
65
+
66
+ ### Added
67
+ - Handling for single-page PDFs
68
+ - Paged and Prince plugins to map quire pages to PDF page sections
69
+
70
+ ### Changed
71
+
72
+ - `quire clean` also removes `.11ty-vite` in the project root
73
+
74
+ ## [1.0.0-rc.11]
75
+
76
+ ### Bumped
77
+ - `epubjs-cli` to version 0.1.6
78
+ - `pagedjs-cli` to version 0.4.3
79
+
80
+ ### Fixed
81
+ - EPUB validation error where pages that include SVGs must include SVG as property under `readingOrder`
82
+
83
+ ## [1.0.0-rc.10]
84
+
85
+ ### Added
86
+ - 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.
87
+
88
+ ## [1.0.0-rc.9]
89
+
90
+ ### Added
91
+ - Update old `.quire` files when running `info` command on versions prior to `1.0.0-rc.8`
92
+ - Include `quire-cli` version used to generate project in `info` output
93
+ - Adds headings to `info` output
94
+
95
+ ## [1.0.0-rc.8]
96
+
97
+ ### Added
98
+ - Added `info` command to output package versions
21
99
 
22
- ## [Unreleased]
100
+ ## [1.0.0-rc.7]
23
101
 
102
+ ### Added
103
+ - 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,43 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
-
2
+ import { fileURLToPath } from 'node:url'
3
+ import fs from 'node:fs'
3
4
  import cli from '#src/main.js'
4
- import packageConfig from '#root/package.json' assert { type: 'json' }
5
+ import config from '#src/lib/conf/config.js'
5
6
  import updateNotifier from 'update-notifier'
6
7
 
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
+
10
+ const packagePath = path.join(__dirname, 'package.json')
11
+ const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
12
+
7
13
  process.removeAllListeners('warning')
8
14
 
15
+ /**
16
+ * Interval constants in milliseconds
17
+ */
9
18
  const INTERVAL = Object.freeze({
10
- MINUTES: 1000 * 60 * 1,
19
+ MINUTE: 1000 * 60 * 1,
11
20
  HOURLY: 1000 * 60 * 60,
12
21
  DAILY: 1000 * 60 * 60 * 24,
13
22
  WEEKLY: 1000 * 60 * 60 * 24 * 7
14
23
  })
15
24
 
25
+ const updateChannel = config.get('updateChannel')
26
+ const updateIterval = config.get('updateIterval')
27
+
16
28
  /**
17
- * Check for quire-cli updates
29
+ * Create a notifier to Check for quire-cli updates
18
30
  * @see https://github.com/yeoman/update-notifier#usage
19
31
  *
20
- * @todo user configuration of choosen update interval
32
+ * @todo refactor to check multiple channels
21
33
  */
22
34
  const notifier = updateNotifier({
23
- distTag: 'rc',
35
+ distTag: updateChannel,
24
36
  pkg: packageConfig,
25
- updateCheckInterval: INTERVAL.DAILY,
37
+ updateCheckInterval: INTERVAL[updateIterval],
26
38
  })
27
39
 
28
- notifier.notify()
40
+ notifier.notify({ defer: false })
29
41
 
30
42
  /**
31
43
  * 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.20",
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
+ ```