-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
wp-env: Correctly parse basename for wporg zip sources #22093
wp-env: Correctly parse basename for wporg zip sources #22093
Conversation
packages/env/lib/config.js
Outdated
workDirectoryPath, | ||
encodeURIComponent( wpOrgFields[ 2 ] ) | ||
), | ||
basename: encodeURIComponent( wpOrgFields[ 2 ] ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just make this apply to the zipFields
thing below, and use the second index instead of the first? I guess a reason to not do that would be to allow zip sources from elsewhere to continue working :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good addition. It should make zip sources a lot easier to work with.
I think this needs rebased and it is probably good to go. Imo, it would also be ideal if we just use the zip type for this instead of creating new source types. E.g. inside the zip type condition, check to see if it is also a wporg source, and then set the basename & path correctly in that situation. |
…ectory name as the name of the plugin/theme.
Fix to use zip source type. @noahtallen |
packages/env/lib/config.js
Outdated
); | ||
if ( wpOrgFields ) { | ||
return { | ||
type: 'zip', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this just be added to the zipFields section below?
Should we do this for all ZIP URLs and not just ones hosted on |
packages/env/lib/config.js
Outdated
basename: encodeURIComponent( wpOrgFields[ 1 ] ), | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseSourceString
has unit tests. These should be updated to test this new functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added unit tests.
@noisysocks Is it better to keep the version number in the directory name? |
since we can know (being a WordPress tool and all) that wporg URLs always look this way, maybe that makes it easier to just support the wporg format? Do we know enough to guarantee a different zip source will use a format we can understand? Though, I guess if it's just |
I'm gonna merge this so that it can at least be fixed for wporg sources for now. I think we can expand this behavior as a follow up without blocking it for wporg sources :) |
I think that other URLs are more likely to have conflicting basenames. |
Description
In the case of plugin/theme from downloads.wordpress.org, use the directory name as the name of the plugin/theme.
before
after
How has this been tested?
config wp-env.json
run
./packages/env/bin/wp-env start
Types of changes
Checklist: