@thegetty/quire-cli 1.0.0-rc.22 → 1.0.0-rc.24

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 CHANGED
@@ -12,32 +12,31 @@ 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
- ## [1.0.0-rc.22]
15
+ ## [1.0.0-rc.24]
16
16
 
17
- ### Added
17
+ ### Changed
18
18
 
19
- - `read-package-up` to dependencies
20
- - `packageConfig` module, exports parsed `package.json` configuration file
19
+ - Replace Node `import` assertions (deprecated) with a packageConfig module
21
20
 
22
- ### Changed
21
+ ### Fixed
23
22
 
24
- - Read package configuration using `read-package-up` and export the configuration object from the `packageConfig` module
23
+ - Quire new command fails with newer version of Node #968
25
24
 
26
- ## [1.0.0-rc.21]
25
+ ## [1.0.0-rc.23]
27
26
 
28
- ### Fixed
27
+ :warning: broken release candidate
29
28
 
30
- - Fixed missing import of `node:path`
29
+ ## [1.0.0-rc.22]
31
30
 
32
- ## [1.0.0-rc.20]
31
+ :warning: broken release candidate
33
32
 
34
- ### Changed
33
+ ## [1.0.0-rc.21]
35
34
 
36
- - Replace Node `import` assertions (deprecated) with file operations
35
+ :warning: broken release candidate
37
36
 
38
- ### Fixed
37
+ ## [1.0.0-rc.20]
39
38
 
40
- - Quire new command fails with newer version of Node #968
39
+ :warning: broken release candidate
41
40
 
42
41
  ## [1.0.0-rc.19]
43
42
 
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.22",
4
+ "version": "1.0.0-rc.24",
5
5
  "author": "Getty Digital",
6
6
  "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
7
7
  "bugs": {
@@ -64,6 +64,7 @@
64
64
  "install-npm-version": "^1.0.9",
65
65
  "js-yaml": "^4.1.0",
66
66
  "loglevel": "^1.8.1",
67
+ "node-fetch": "^3.3.2",
67
68
  "open": "^8.4.0",
68
69
  "ora": "^6.1.2",
69
70
  "pagedjs-cli": "^0.4.3",
@@ -10,21 +10,20 @@ import packageConfig from '#src/packageConfig.js'
10
10
  import path from 'node:path'
11
11
  import semver from 'semver'
12
12
 
13
- const { name: PACKAGE_NAME } = packageConfig
14
-
15
13
  // Version install path is relative to process working directory
16
14
  const INSTALL_PATH = path.join('src', 'lib', 'quire', 'versions')
15
+ const PACKAGE_NAME = '@thegetty/quire-11ty'
17
16
  const VERSION_FILE = '.quire'
18
17
 
19
18
  /**
20
- * Return an absolute path to an installed `quire-11ty` version
19
+ * Return an absolute path to an installed quire-11ty version
21
20
  *
22
- * @return {String} path to installed `quire-11ty` version
21
+ * @return {String} path to installed quire-11ty version
23
22
  */
24
23
  function getPath(version='latest') {
25
- const absolutePath = path.relative('/', `${INSTALL_PATH}/${version}`)
24
+ const absolutePath = path.relative('/', path.join(INSTALL_PATH, version))
26
25
  if (!fs.existsSync(absolutePath)) {
27
- console.error(`[CLI:quire] \`quire-11ty@${version}\` is not installed`)
26
+ console.error(`[CLI:quire] quire-11ty@${version} is not installed`)
28
27
  return null
29
28
  }
30
29
  console.debug(`[CLI:quire] %s`, absolutePath)
@@ -32,7 +31,7 @@ function getPath(version='latest') {
32
31
  }
33
32
 
34
33
  /**
35
- * Read the required `quire-11ty` version for the project `.quire` file
34
+ * Read the required quire-11ty version for the quire version file
36
35
  *
37
36
  * @param {String} projectPath Absolute system path to the project root
38
37
  *
@@ -47,7 +46,7 @@ function getVersion(projectPath) {
47
46
  }
48
47
 
49
48
  /**
50
- * Read the required `quire-11ty` and starter versions from starter `package.json` `peerDependencies`
49
+ * Read required quire-11ty and starter versions from starter peerDependencies
51
50
  *
52
51
  * @param {String} projectPath Absolute system path to the project root
53
52
  *
@@ -101,19 +100,19 @@ async function initStarter (starter, projectPath, options) {
101
100
  .catch((error) => console.error('[CLI:error] ', error))
102
101
 
103
102
  /**
104
- * Determine the `quire-11ty` version to use in the new project,
105
- * from the `quireVersion` option or as required by the starter project.
103
+ * Determine the quire-11ty version to use in the new project,
104
+ * from the quireVersion option or as required by the starter project.
106
105
  *
107
- * Uses `latest` to get the latest semantic version compatible with version ranges
106
+ * Uses 'latest' to get the latest semantic version compatible with version ranges
108
107
  */
109
108
  const { quire11tyVersion, starterVersion } = await getVersionsFromStarter(projectPath)
110
109
  const quireVersion = await latest(options.quireVersion || quire11tyVersion)
111
110
  setVersion(projectPath, quireVersion)
112
111
 
113
112
  /**
114
- * Write quire-11ty, cli, starter name and version to VERSION_FILE
113
+ * Write quire-11ty, quire-cli, starter versions to the version file
115
114
  */
116
- const versionInfo = {
115
+ const versionInfo = {
117
116
  cli: packageConfig.version,
118
117
  starter: `${starter}@${starterVersion}`,
119
118
  }
@@ -142,7 +141,7 @@ async function initStarter (starter, projectPath, options) {
142
141
  }
143
142
 
144
143
  /**
145
- * Install `quire-11ty`, default to 'latest' version
144
+ * Install quire-11ty (default to 'latest' version)
146
145
  *
147
146
  * @TODO refactor this to be callable by the installInProject method
148
147
  *
@@ -182,8 +181,7 @@ async function install(options = {}) {
182
181
  * the final `_site` package when running `quire build`
183
182
  */
184
183
  const currentWorkingDirectory = cwd()
185
- const versionDir = path.join(absoluteInstallPath, version)
186
- chdir(versionDir)
184
+ chdir(path.join(absoluteInstallPath, version))
187
185
  await execaCommand('npm cache clean --force')
188
186
  await execaCommand('npm install --save-dev')
189
187
  }
package/src/main.js CHANGED
@@ -1,7 +1,4 @@
1
1
  import { Argument, Command, Option } from 'commander'
2
- import { dirname, join } from 'node:path'
3
- import { fileURLToPath } from 'node:url'
4
- import fs from 'node:fs'
5
2
  import commands from '#src/commands/index.js'
6
3
  import config from '#lib/conf/config.js'
7
4
  import packageConfig from '#src/packageConfig.js'
@@ -1,5 +1,15 @@
1
+ import { dirname } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
1
3
  import { readPackageUpSync } from 'read-package-up'
2
4
 
3
- const { packageJson } = readPackageUpSync()
5
+ const __filename = fileURLToPath(import.meta.url)
6
+ const __dirname = dirname(__filename)
7
+
8
+ /**
9
+ * Nota bene: current working directory will be that from which cli commands
10
+ * are being, readPackageUpSync is passed the directory of this module as the
11
+ * starting path to search for the quire-cli package config file.
12
+ */
13
+ const { packageJson } = readPackageUpSync({ cwd: __dirname, normalize: true })
4
14
 
5
15
  export default packageJson