@thegetty/quire-cli 1.0.0-pre-release.12 → 1.0.0-pre-release.13
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 +2 -2
- package/src/commands/build.js +3 -0
- package/src/commands/clean.js +5 -0
- package/src/commands/preview.js +5 -0
- package/src/commands/version.js +8 -2
- package/src/helpers/is-quire.js +2 -2
- package/src/helpers/test-cwd.js +5 -9
- package/src/lib/quire/index.js +9 -5
- package/LICENSE +0 -1
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegetty/quire-cli",
|
|
3
3
|
"description": "Quire command-line interface",
|
|
4
|
-
"version": "1.0.0-pre-release.
|
|
4
|
+
"version": "1.0.0-pre-release.13",
|
|
5
5
|
"author": "Getty Digital",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://github.com/thegetty/quire/issues"
|
|
9
9
|
},
|
package/src/commands/build.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
2
|
import { api, cli, paths, projectRoot } from '#lib/11ty/index.js'
|
|
3
3
|
import { clean } from '#helpers/clean.js'
|
|
4
|
+
import testcwd from '#helpers/test-cwd.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Quire CLI `build` Command
|
|
@@ -56,6 +57,8 @@ export default class BuildCommand extends Command {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
preAction(command) {
|
|
60
|
+
testcwd(command)
|
|
61
|
+
|
|
59
62
|
const options = command.opts()
|
|
60
63
|
if (options.debug) {
|
|
61
64
|
console.debug('[CLI] Calling \'build\' command pre-action with options', options)
|
package/src/commands/clean.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
2
|
import { clean } from '#helpers/clean.js'
|
|
3
3
|
import { paths, projectRoot } from '#lib/11ty/index.js'
|
|
4
|
+
import testcwd from '#helpers/test-cwd.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Quire CLI `clean` Command
|
|
@@ -53,4 +54,8 @@ export default class CleanCommand extends Command {
|
|
|
53
54
|
|
|
54
55
|
console.debug(`[CLI] ${message} ${deletedPaths}`)
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
preAction(command) {
|
|
59
|
+
testcwd(command)
|
|
60
|
+
}
|
|
56
61
|
}
|
package/src/commands/preview.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
2
|
import { api, cli, paths, projectRoot } from '#lib/11ty/index.js'
|
|
3
|
+
import testcwd from '#helpers/test-cwd.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Quire CLI `preview` Command
|
|
@@ -53,4 +54,8 @@ export default class PreviewCommand extends Command {
|
|
|
53
54
|
api.serve(options)
|
|
54
55
|
}
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
preAction(command) {
|
|
59
|
+
testcwd(command)
|
|
60
|
+
}
|
|
56
61
|
}
|
package/src/commands/version.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Command from '#src/Command.js'
|
|
2
|
+
import { paths, projectRoot } from '#lib/11ty/index.js'
|
|
2
3
|
import * as quire from '#lib/quire/index.js'
|
|
4
|
+
import testcwd from '#helpers/test-cwd.js'
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Quire CLI `version` Command
|
|
@@ -21,7 +23,7 @@ export default class VersionCommand extends Command {
|
|
|
21
23
|
[ '<version>', 'the local quire version to use' ],
|
|
22
24
|
],
|
|
23
25
|
options: [
|
|
24
|
-
[ '-g', '--global', 'set the quire version globally' ],
|
|
26
|
+
// [ '-g', '--global', 'set the quire version globally' ],
|
|
25
27
|
],
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -29,9 +31,13 @@ export default class VersionCommand extends Command {
|
|
|
29
31
|
super(VersionCommand.definition)
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
action(args, options = {}) {
|
|
33
35
|
if (options.debug) {
|
|
34
36
|
console.info('Command \'%s\' called with options %o', this.name, options)
|
|
35
37
|
}
|
|
36
38
|
}
|
|
39
|
+
|
|
40
|
+
preAction(command) {
|
|
41
|
+
testcwd(command)
|
|
42
|
+
}
|
|
37
43
|
}
|
package/src/helpers/is-quire.js
CHANGED
|
@@ -20,8 +20,8 @@ const QUIRE_DOT_FILES = Object.freeze([
|
|
|
20
20
|
* @param {String} dirpath path to a local directory
|
|
21
21
|
* @return {Promise}
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export default function (dirpath) {
|
|
24
24
|
return fs.readdirSync(dirpath)
|
|
25
|
-
.
|
|
25
|
+
.find((entry) => QUIRE_DOT_FILES.includes(entry))
|
|
26
26
|
}
|
|
27
27
|
|
package/src/helpers/test-cwd.js
CHANGED
|
@@ -3,17 +3,13 @@ import isQuire from '#helpers/is-quire.js'
|
|
|
3
3
|
/**
|
|
4
4
|
* Test current working directory is a Quire project directory
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
7
|
-
* @return {Boolean}
|
|
6
|
+
* @param {Command} command the command from which testcwd was called
|
|
8
7
|
*/
|
|
9
8
|
export default (command) => {
|
|
10
|
-
const message = `[CLI]
|
|
9
|
+
const message = `[CLI] ${ command ? command.name() : '' } command must be run while in a Quire project directory. Use 'cd' to navigate to your project directory and re-run the 'quire ${ command ? command.name() : '' }' command.`
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
return true
|
|
11
|
+
if (!isQuire(process.cwd())) {
|
|
12
|
+
console.error(message)
|
|
13
|
+
process.exit(1)
|
|
18
14
|
}
|
|
19
15
|
}
|
package/src/lib/quire/index.js
CHANGED
|
@@ -262,17 +262,21 @@ async function installInProject(projectPath, version, options={}) {
|
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* Retrieve latest published version of the `quire-11ty` package
|
|
265
|
+
|
|
266
|
+
* @todo refactor to programmatically return a specific version
|
|
267
|
+
* of `@thegetty/quire-11ty` from a semantic version string
|
|
268
|
+
* (i.e `^1.0.0-pre-release.0` => `1.0.0-pre-release.2`)
|
|
269
|
+
* so that the latest function may be used like:
|
|
270
|
+
* await latest('^1.0.0-pre-release.0') => '1.0.0-pre-release.2'
|
|
271
|
+
*
|
|
265
272
|
* Nota bene: `npm view [<@scope>/]<name>[@<version>] version`
|
|
266
273
|
* @see https://docs.npmjs.com/cli/v7/commands/npm-view
|
|
267
274
|
* returns a list of versions that satisfy the `<version>` range specifier,
|
|
268
275
|
* piping this to execa `stdout` we get only the last line of output.
|
|
276
|
+
* @todo use [`parse-columns`](https://github.com/sindresorhus/parse-columns)
|
|
277
|
+
* to parse the column formated list of versions returned by `npm view`
|
|
269
278
|
*
|
|
270
279
|
* @return {String} `quire-11ty@latest` semantic version string
|
|
271
|
-
*
|
|
272
|
-
* @TODO refactor `latest()` function to programmatically return a specific
|
|
273
|
-
* version of `@thegetty/quire-11ty` from a semantic version string
|
|
274
|
-
* (i.e `^1.0.0-pre-release.0` => `1.0.0-pre-release.2`) so it may be used like:
|
|
275
|
-
* await latest('^1.0.0-pre-release.0') => '1.0.0-pre-release.2'
|
|
276
280
|
*/
|
|
277
281
|
async function latest() {
|
|
278
282
|
const { stdout: quireVersion } =
|
package/LICENSE
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2022, J Paul Getty Trust.
|