@thegetty/quire-cli 1.0.0-pre-release.8 → 1.0.0-pre-release.9
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 +1 -1
- package/package.json +1 -1
- package/src/commands/index.js +6 -2
- package/src/helpers/os-utils.js +5 -0
- package/src/lib/11ty/api.js +6 -1
- package/src/lib/quire/index.js +2 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/commands/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IS_WINDOWS } from '#helpers/os-utils.js'
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
2
3
|
import fs from 'fs-extra'
|
|
3
4
|
import path from 'node:path'
|
|
4
5
|
|
|
@@ -14,7 +15,10 @@ const thisfile = path.basename(__filename)
|
|
|
14
15
|
const commands = await Promise.all(
|
|
15
16
|
fs.readdirSync(__dirname)
|
|
16
17
|
.filter((file) => file !== thisfile && file.match(/^.*\.js$/))
|
|
17
|
-
.map((file) =>
|
|
18
|
+
.map((file) => IS_WINDOWS
|
|
19
|
+
? import(pathToFileURL(path.resolve(__dirname, file)))
|
|
20
|
+
: import(path.resolve(__dirname, file))
|
|
21
|
+
)
|
|
18
22
|
).then((modules) => {
|
|
19
23
|
return modules.map(({ default: CommandClass }) => new CommandClass())
|
|
20
24
|
})
|
package/src/lib/11ty/api.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IS_WINDOWS } from '#helpers/os-utils.js'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
1
3
|
import path from 'node:path'
|
|
2
4
|
import paths, { eleventyRoot, projectRoot } from './paths.js'
|
|
3
5
|
|
|
@@ -18,7 +20,10 @@ const factory = async (options = {}) => {
|
|
|
18
20
|
/**
|
|
19
21
|
* Dynamically import the correct version of Eleventy from `lib/quire/versions`
|
|
20
22
|
*/
|
|
21
|
-
const
|
|
23
|
+
const modulePath = path.join(eleventyRoot, 'node_modules', '@11ty', 'eleventy', 'src', 'Eleventy.js')
|
|
24
|
+
const { default: Eleventy } = IS_WINDOWS
|
|
25
|
+
? await import(pathToFileURL(modulePath))
|
|
26
|
+
: await import(modulePath)
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
29
|
* Set Eleventy passthrough copy options
|
package/src/lib/quire/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IS_WINDOWS } from '#helpers/os-utils.js'
|
|
1
2
|
import { chdir, cwd } from 'node:process'
|
|
2
3
|
import { execa, execaCommand } from 'execa'
|
|
3
4
|
import { fileURLToPath } from 'node:url'
|
|
@@ -16,9 +17,6 @@ const INSTALL_PATH = path.join('src', 'lib', 'quire', 'versions')
|
|
|
16
17
|
const PACKAGE_NAME = '@thegetty/quire-11ty'
|
|
17
18
|
const VERSION_FILE = '.quire'
|
|
18
19
|
|
|
19
|
-
const IS_WINDOWS =
|
|
20
|
-
process.platform === 'win32' || /^(cygwin|msys)$/.test(process.env.OSTYPE)
|
|
21
|
-
|
|
22
20
|
/**
|
|
23
21
|
* Return an absolute path to an installed `quire-11ty` version
|
|
24
22
|
*
|
|
@@ -30,7 +28,7 @@ function getPath(version='latest') {
|
|
|
30
28
|
console.error(`[CLI:quire] \`quire-11ty@${version}\` is not installed`)
|
|
31
29
|
return null
|
|
32
30
|
}
|
|
33
|
-
console.debug(`[CLI:quire]
|
|
31
|
+
console.debug(`[CLI:quire] %s`, absolutePath)
|
|
34
32
|
return absolutePath
|
|
35
33
|
}
|
|
36
34
|
|