From 301687fc0cb9e8caf0999b3926132168826d47be Mon Sep 17 00:00:00 2001 From: "Chris. Webster" Date: Sat, 14 Jan 2023 16:43:48 -0800 Subject: [PATCH 1/2] fix: Detect git version on windows git does not fully match semver, especially on the windows version. Using loose checking in findVersions is able to match the version. Signed-off-by: Chris. Webster --- bin/semantic-release.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/semantic-release.js b/bin/semantic-release.js index fb941e8a20..cee3f98ddd 100755 --- a/bin/semantic-release.js +++ b/bin/semantic-release.js @@ -25,7 +25,7 @@ See https://github.com/semantic-release/semantic-release/blob/master/docs/suppor execa("git", ["--version"]) .then(({ stdout }) => { - const gitVersion = findVersions(stdout)[0]; + const gitVersion = findVersions(stdout, { loose: true })[0]; if (lt(gitVersion, MIN_GIT_VERSION)) { console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`); process.exit(1); From 725a39e9d269006db3e8e7cdff20caab0b380458 Mon Sep 17 00:00:00 2001 From: "Chris. Webster" Date: Sat, 14 Jan 2023 16:54:51 -0800 Subject: [PATCH 2/2] fix: use `file://` url loading plugins The `file://` url is required for the `win32`platform but supported on all platforms. Signed-off-by: Chris. Webster --- lib/plugins/utils.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/plugins/utils.js b/lib/plugins/utils.js index a156c0468d..dbc892d8a2 100644 --- a/lib/plugins/utils.js +++ b/lib/plugins/utils.js @@ -52,9 +52,14 @@ export async function loadPlugin({cwd}, name, pluginsPath) { ? dirname(resolveFrom.silent(__dirname, pluginsPath[name]) || resolveFrom(cwd, pluginsPath[name])) : __dirname; - // See https://github.com/mysticatea/eslint-plugin-node/issues/250 - // eslint-disable-next-line node/no-unsupported-features/es-syntax - return isFunction(name) ? name : (await import(resolveFrom.silent(basePath, name) || resolveFrom(cwd, name))).default; + if (!isFunction(name)) { + const file = resolveFrom.silent(basePath, name) || resolveFrom(cwd, name); + // See https://github.com/mysticatea/eslint-plugin-node/issues/250 + // eslint-disable-next-line node/no-unsupported-features/es-syntax + name = (await import(`file://${file}`)).default; + } + + return name; } export function parseConfig(plugin) {