Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): fixed issues preventing execution from windows #2672

Merged
merged 3 commits into from Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/semantic-release.js
Expand Up @@ -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];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we capture details that we can look back to in the future, could you mention the details that lead to this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output of git -v on Windows at my current install is: git version 2.39.0.windows.2. This is not fully semver compliant. Issue #git-for-windows/git#4086 was opened (and closed) recently regarding this (tl;dr it is not going to change). It appears the semver package works and the find-versions package does not. The loose option extracts the version info from the string correctly. The non-Windows versions could have similar issues in the future that this will hopefully avoid. find-versions could be updated but a rejection would not be unexpected.

if (lt(gitVersion, MIN_GIT_VERSION)) {
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
process.exit(1);
Expand Down
11 changes: 8 additions & 3 deletions lib/plugins/utils.js
Expand Up @@ -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) {
Expand Down