@thegetty/quire-cli 1.0.0-rc.25 → 1.0.0-rc.27
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 +13 -0
- package/package.json +1 -1
- package/src/commands/info.js +7 -5
- package/src/lib/11ty/cli.js +18 -2
- package/src/LOGGING.md +0 -16
- package/src/PLUGIN.md +0 -57
- package/src/commands/config/config-get.js +0 -35
- package/src/commands/config/config-reset.js +0 -34
- package/src/commands/config/config-set.js +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,19 @@ 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.27]
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed post-v3 `quire info` bug (DEV-19984)
|
|
20
|
+
|
|
21
|
+
## [1.0.0-rc.26]
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Import path using node namespace in the cli info command
|
|
26
|
+
- Correct file extension of cmd module called by the cli
|
|
27
|
+
|
|
15
28
|
## [1.0.0-rc.25]
|
|
16
29
|
|
|
17
30
|
### Changed
|
package/package.json
CHANGED
package/src/commands/info.js
CHANGED
|
@@ -2,7 +2,7 @@ import Command from '#src/Command.js'
|
|
|
2
2
|
import { execaCommand } from 'execa'
|
|
3
3
|
import fs from 'node:fs'
|
|
4
4
|
import os from 'node:os'
|
|
5
|
-
import path from 'path'
|
|
5
|
+
import path from 'node:path'
|
|
6
6
|
import testcwd from '#helpers/test-cwd.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -40,17 +40,19 @@ export default class InfoCommand extends Command {
|
|
|
40
40
|
console.debug('[CLI] Command \'%s\' called', this.name())
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Load filename from config with a default constraint if it doesn't exist
|
|
43
44
|
const versionFileName = this.config.get('versionFile')
|
|
45
|
+
let versionInfo = { cli: '<=1.0.0.rc-7' }
|
|
44
46
|
|
|
45
47
|
try {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
versionInfo = JSON.parse(
|
|
48
|
+
const versionFileData = fs.readFileSync(versionFileName, { encoding: 'utf8' })
|
|
49
|
+
|
|
50
|
+
versionInfo = JSON.parse(versionFileData)
|
|
49
51
|
} catch (error) {
|
|
50
52
|
console.warn(
|
|
51
53
|
`This project was generated with the quire-cli prior to version 1.0.0.rc-8. Updating the version file to the new format, though this project's version file will not contain specific starter version information.`
|
|
52
54
|
)
|
|
53
|
-
|
|
55
|
+
|
|
54
56
|
fs.writeFileSync(versionFileName, JSON.stringify(versionInfo))
|
|
55
57
|
}
|
|
56
58
|
|
package/src/lib/11ty/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execa } from 'execa'
|
|
2
|
+
import fs from 'node:fs'
|
|
2
3
|
import path from 'node:path'
|
|
3
4
|
import paths, { eleventyRoot, projectRoot } from './paths.js'
|
|
4
5
|
|
|
@@ -17,9 +18,24 @@ const factory = (options = {}) => {
|
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Use the version of Eleventy installed to `lib/quire/versions`
|
|
21
|
+
*
|
|
22
|
+
* NB: in eleventy v3 the CLI extension (".cjs") is load-bearing but v2 is simply ".js"
|
|
23
|
+
*
|
|
20
24
|
*/
|
|
21
|
-
const
|
|
22
|
-
|
|
25
|
+
const eleventyModuleDir = path.join(eleventyRoot, 'node_modules', '@11ty', 'eleventy')
|
|
26
|
+
const packagePath = path.join(eleventyModuleDir,'package.json')
|
|
27
|
+
|
|
28
|
+
const pack = JSON.parse(fs.readFileSync(packagePath))
|
|
29
|
+
|
|
30
|
+
const { version } = pack
|
|
31
|
+
|
|
32
|
+
const eleventyMajorVer = version.split('.').at(0)
|
|
33
|
+
|
|
34
|
+
let eleventy = path.join(eleventyModuleDir,'cmd.cjs')
|
|
35
|
+
|
|
36
|
+
if ( Number(eleventyMajorVer) < 3 ) {
|
|
37
|
+
eleventy = path.join(eleventyModuleDir,'cmd.js')
|
|
38
|
+
}
|
|
23
39
|
|
|
24
40
|
const command = [
|
|
25
41
|
eleventy,
|
package/src/LOGGING.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## Logging
|
|
3
|
-
|
|
4
|
-
- https://betterstack.com/community/guides/logging/nodejs-logging-best-practices/
|
|
5
|
-
|
|
6
|
-
### `debug-js`
|
|
7
|
-
- https://github.com/debug-js/debug
|
|
8
|
-
- https://github.com/commenthol/debug-level
|
|
9
|
-
|
|
10
|
-
### Pino
|
|
11
|
-
- https://betterstack.com/community/guides/logging/how-to-install-setup-and-use-pino-to-log-node-js-applications/
|
|
12
|
-
- https://github.com/pinojs/pino
|
|
13
|
-
|
|
14
|
-
### Winston
|
|
15
|
-
- https://betterstack.com/community/guides/logging/how-to-install-setup-and-use-winston-and-morgan-to-log-node-js-applications/
|
|
16
|
-
- https://github.com/winstonjs/winston
|
package/src/PLUGIN.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
## Quire Plugins
|
|
2
|
-
|
|
3
|
-
### Defining Plugins
|
|
4
|
-
|
|
5
|
-
```javascript
|
|
6
|
-
import { definePlugin } from 'quire-cli/plugins'
|
|
7
|
-
|
|
8
|
-
definePlugin({
|
|
9
|
-
commands: [],
|
|
10
|
-
compatability: {
|
|
11
|
-
// quire-cli version
|
|
12
|
-
},
|
|
13
|
-
name: 'plugin-name',
|
|
14
|
-
version: 'semantic-version',
|
|
15
|
-
install: () => {},
|
|
16
|
-
prepare: () => {},
|
|
17
|
-
})
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Adding Quire Commands
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Modifying Quire Commands
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import { modifyCommand } from 'quire-cli/plugins'
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Extend an existing quire-cli command with additional aliases or options
|
|
31
|
-
*
|
|
32
|
-
* @todo how should the version be updated when a command is extended?
|
|
33
|
-
*
|
|
34
|
-
* @typedef {CommandDefinition}
|
|
35
|
-
* @property {String} alias
|
|
36
|
-
* @property {Array<String>} aliases
|
|
37
|
-
* @property {Array<CommandOption>} options
|
|
38
|
-
*
|
|
39
|
-
* @returns {Command} instance of the extended command object
|
|
40
|
-
*/
|
|
41
|
-
modifyCommand(commandName, {})
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Overriding Quire Commands
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
import { replaceCommand } from 'quire-cli/plugins'
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Override an existing quire-cli command
|
|
51
|
-
*
|
|
52
|
-
* @params {CommandDefinition} A complete Command definition
|
|
53
|
-
*
|
|
54
|
-
* @returns {Command} instance of the extended command object
|
|
55
|
-
*/
|
|
56
|
-
replaceCommand({})
|
|
57
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import Command from '#src/Command.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quire CLI `config get` Command
|
|
5
|
-
*
|
|
6
|
-
* @class ConfigGetCommand
|
|
7
|
-
* @extends {Command}
|
|
8
|
-
*/
|
|
9
|
-
export default class ConfigGetCommand extends Command {
|
|
10
|
-
static definition = {
|
|
11
|
-
name: 'config-get',
|
|
12
|
-
description: 'Get the value of a Quire CLI configuration property',
|
|
13
|
-
summary: 'get a cli configuration property',
|
|
14
|
-
version: '1.0.0',
|
|
15
|
-
args: [
|
|
16
|
-
[ '[property]', 'configuration property' ]
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
constructor() {
|
|
21
|
-
super(ConfigGetCommand.definition)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param {String} key
|
|
26
|
-
* @param {Object} options
|
|
27
|
-
* @return {Promise}
|
|
28
|
-
*/
|
|
29
|
-
async action(property, options = {}) {
|
|
30
|
-
for (const [ key, value ] of Object.entries(this.config.store)) {
|
|
31
|
-
if (key.startsWith('__internal__') && !options.debug) continue
|
|
32
|
-
console.info(`${key}: ${JSON.stringify(value, null, 2)}`)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import Command from '#src/Command.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quire CLI `config reset` Command
|
|
5
|
-
*
|
|
6
|
-
* @class ConfigResetCommand
|
|
7
|
-
* @extends {Command}
|
|
8
|
-
*/
|
|
9
|
-
export default class ConfigResetCommand extends Command {
|
|
10
|
-
static definition = {
|
|
11
|
-
name: 'config-reset',
|
|
12
|
-
description: 'Reset the Quire CLI configuration to the default',
|
|
13
|
-
summary: 'reset cli configuration properties to default values',
|
|
14
|
-
version: '1.0.0',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
constructor() {
|
|
18
|
-
super(ConfigResetCommand.definition)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @return {Promise}
|
|
23
|
-
*/
|
|
24
|
-
async action(options = {}) {
|
|
25
|
-
if (options.debug) {
|
|
26
|
-
console.info('Command \'%s\' called with options %o', this.name(), options)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
for (const [ key, value ] of Object.entries(this.config.store)) {
|
|
30
|
-
if (key.startsWith('__internal__') && !options.debug) continue
|
|
31
|
-
console.info(`${key}: ${JSON.stringify(value, null, 2)}`)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Command from '#src/Command.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quire CLI `config set` Command
|
|
5
|
-
*
|
|
6
|
-
* @class ConfigCommand
|
|
7
|
-
* @extends {Command}
|
|
8
|
-
*/
|
|
9
|
-
export default class ConfigSetCommand extends Command {
|
|
10
|
-
static definition = {
|
|
11
|
-
name: 'config-set',
|
|
12
|
-
description: 'Set a Quire CLI configuration property',
|
|
13
|
-
summary: 'set a cli configuration property',
|
|
14
|
-
version: '1.0.0',
|
|
15
|
-
args: [
|
|
16
|
-
[ '[key]', 'configuration property key' ],
|
|
17
|
-
[ '[value]', 'configuration property value' ]
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
super(ConfigSetCommand.definition)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {String} key
|
|
27
|
-
* @param {String} value
|
|
28
|
-
* @param {Object} options
|
|
29
|
-
* @return {Promise}
|
|
30
|
-
*/
|
|
31
|
-
async action(key, value, options = {}) {
|
|
32
|
-
for (const [ key, value ] of Object.entries(this.config.store)) {
|
|
33
|
-
if (key.startsWith('__internal__') && !options.debug) continue
|
|
34
|
-
console.info(`${key}: ${JSON.stringify(value, null, 2)}`)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|