@thegetty/quire-cli 1.0.0-pre-release.13 → 1.0.0-pre-release.14

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.13",
4
+ "version": "1.0.0-pre-release.14",
5
5
  "author": "Getty Digital",
6
6
  "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
7
7
  "bugs": {
@@ -23,15 +23,6 @@ const cliRoot = path.resolve(__dirname, path.join('..', '..'))
23
23
  const eleventyConfig = '.eleventy.js'
24
24
  const version = 'latest'
25
25
 
26
- // Test project directory for an eleventy configuration file
27
- const hasEleventyConfig = (dir) => {
28
- try {
29
- return fs.readdirSync(dir).includes(eleventyConfig)
30
- } catch (error) {
31
- throw new Error(`[CLI:11ty] Unable to read project directory for eleventy config ${error}`)
32
- }
33
- }
34
-
35
26
  export const projectRoot = process.cwd()
36
27
 
37
28
  const inputDir = path.join(projectRoot, 'content')
@@ -47,10 +38,49 @@ const libQuirePath = path.resolve(__dirname, path.join(cliRoot, 'lib', 'quire',
47
38
  * Nota bene: to get a relative path to the `eleventyRoot`,
48
39
  * for example when the version is specified is 'latest',
49
40
  * it must be set to the real path to the symlink target.
41
+ *
42
+ * @todo refactor how and *when* the eleventyRoot is determined:
43
+ * - we only need eleventyRoot for cli commands that run 11ty
44
+ * - paths module is a concern of the `quire` module
45
+ * - global quire-cli installation
46
+ * - local quire-cli installation
47
+ *
48
+ * For an excellent developer experience, the quire-11ty code should be
49
+ * installed into an `11ty` or `quire-11ty` directory in the `projectRoot`
50
+ * this will allow us to more easily manage symlinks for local development
51
+ * using unpublished `quire-11ty` code.
52
+ * @example
53
+ * ```sh
54
+ * blargh/
55
+ * .git/
56
+ * .gitignore
57
+ * .node-version
58
+ * .quire-version
59
+ * 11ty@ --> /Users/mph/Code/Getty/quire/packages/11ty
60
+ * content/
61
+ * CHANGELOG.md
62
+ * LICENSE
63
+ * README.md
64
+ * package.json
65
+ * package-lock.json
66
+ * ```
67
+ * Installing to a directory will allow more cleanly `eject` and `uneject`
68
+ * using a symlink or single directory `rm -rf`.
69
+ * Should the `11ty` directory be a dot directory to hide the complexity from
70
+ * users or should it be visible to be more explicit when project is ejected?
50
71
  */
51
- export const eleventyRoot = hasEleventyConfig(projectRoot)
52
- ? projectRoot
53
- : fs.realpathSync(libQuirePath)
72
+ const getEleventyRoot = () => {
73
+ // try {
74
+ // return fs.readdirSync(projectRoot).includes(eleventyConfig)
75
+ // ? projectRoot
76
+ // : fs.realpathSync(libQuirePath)
77
+ // } catch (error) {
78
+ // throw new Error(`[CLI:11ty] Unable to read project directory for eleventy config ${error}`)
79
+ // }
80
+ return projectRoot
81
+ }
82
+
83
+ export const eleventyRoot = getEleventyRoot()
54
84
 
55
85
  export default {
56
86
  config: path.join(eleventyRoot, '.eleventy.js'),