@thegetty/quire-cli 1.0.0-rc.24 → 1.0.0-rc.25
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 +10 -0
- package/package.json +1 -1
- package/src/PLUGIN.md +57 -0
- package/src/lib/quire/index.js +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,16 @@ 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.25]
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Use quire-cli config values for quire-11ty version and version file name
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Install path for quire-11ty versions
|
|
24
|
+
|
|
15
25
|
## [1.0.0-rc.24]
|
|
16
26
|
|
|
17
27
|
### Changed
|
package/package.json
CHANGED
package/src/PLUGIN.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
```
|
package/src/lib/quire/index.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { IS_WINDOWS } from '#helpers/os-utils.js'
|
|
2
2
|
import { chdir, cwd } from 'node:process'
|
|
3
3
|
import { execa, execaCommand } from 'execa'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
4
5
|
import { isEmpty } from '#helpers/is-empty.js'
|
|
6
|
+
import config from '#lib/conf/config.js'
|
|
5
7
|
import fetch from 'node-fetch'
|
|
6
8
|
import fs from 'fs-extra'
|
|
7
|
-
import git from '#
|
|
9
|
+
import git from '#lib/git/index.js'
|
|
8
10
|
import inv from 'install-npm-version'
|
|
9
11
|
import packageConfig from '#src/packageConfig.js'
|
|
10
12
|
import path from 'node:path'
|
|
11
13
|
import semver from 'semver'
|
|
12
14
|
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
16
|
+
const __dirname = path.dirname(__filename)
|
|
17
|
+
|
|
13
18
|
// Version install path is relative to process working directory
|
|
14
19
|
const INSTALL_PATH = path.join('src', 'lib', 'quire', 'versions')
|
|
15
20
|
const PACKAGE_NAME = '@thegetty/quire-11ty'
|
|
16
|
-
|
|
21
|
+
|
|
22
|
+
const QUIRE_VERSION = config.get('quireVersion')
|
|
23
|
+
const VERSION_FILE = config.get('versionFile')
|
|
17
24
|
|
|
18
25
|
/**
|
|
19
26
|
* Return an absolute path to an installed quire-11ty version
|
|
20
27
|
*
|
|
21
28
|
* @return {String} path to installed quire-11ty version
|
|
22
29
|
*/
|
|
23
|
-
function getPath(version=
|
|
30
|
+
function getPath(version=QUIRE_VERSION) {
|
|
24
31
|
const absolutePath = path.relative('/', path.join(INSTALL_PATH, version))
|
|
25
32
|
if (!fs.existsSync(absolutePath)) {
|
|
26
33
|
console.error(`[CLI:quire] quire-11ty@${version} is not installed`)
|
|
@@ -86,8 +93,8 @@ async function initStarter (starter, projectPath, options) {
|
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
console.debug('[CLI:quire] init-starter',
|
|
89
|
-
`\n project
|
|
90
|
-
`\n starter:
|
|
96
|
+
`\n project: ${path.join(__dirname, projectPath)}`,
|
|
97
|
+
`\n starter: ${starter}`
|
|
91
98
|
)
|
|
92
99
|
|
|
93
100
|
/**
|
|
@@ -149,7 +156,7 @@ async function initStarter (starter, projectPath, options) {
|
|
|
149
156
|
* @return {Promise}
|
|
150
157
|
*/
|
|
151
158
|
async function install(options = {}) {
|
|
152
|
-
const version = options.quireVersion ||
|
|
159
|
+
const version = options.quireVersion || QUIRE_VERSION
|
|
153
160
|
console.debug(`[CLI:quire] installing quire-11ty@${version}`)
|
|
154
161
|
const absoluteInstallPath = path.join(__dirname, 'versions')
|
|
155
162
|
fs.ensureDirSync(absoluteInstallPath)
|
|
@@ -180,7 +187,6 @@ async function install(options = {}) {
|
|
|
180
187
|
* these must be `devDependencies` so that they are not bundled into
|
|
181
188
|
* the final `_site` package when running `quire build`
|
|
182
189
|
*/
|
|
183
|
-
const currentWorkingDirectory = cwd()
|
|
184
190
|
chdir(path.join(absoluteInstallPath, version))
|
|
185
191
|
await execaCommand('npm cache clean --force')
|
|
186
192
|
await execaCommand('npm install --save-dev')
|