-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use vip dev-env configuration file from parent directories #1468
Conversation
@@ -74,9 +74,14 @@ export interface ConfigurationFileOptions { | |||
'media-redirect-domain'?: string; | |||
photon?: boolean; | |||
|
|||
meta?: ConfigurationFileMeta; |
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.
Note: I see there are some type issues causing test failures, fixing those now. |
Just a note on |
Thank you! The code appears to be updated to work with |
The tests have been fixed and this is ready for review. |
This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed. This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved. |
Commenting to unstale this. I'm going to re-merge trunk and get this reviewed. |
@alecgeatches I took the liberty and merged the trunk. |
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.
Tested, works great. Even went as far as:
mkdir -p 1/2/3/4/5/6/7/8/9/10
cd 1/2/3/4/5/6/7/8/9/10
vip dev-env start
On the other hand, this also works:
mv .wpvip ../
/tmp/vip-go-skeleton production vip dev-env start
Using environment test-ancestor-configuration from /private/tmp/.wpvip/vip-dev-env.yml
I'm not sure whether this is an imaginary or a real problem, but this may lead to unintended consequences.
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.
After further discussion it seems that many other developer tools follow the same traversal strategy, so let's go with it.
We print the path to the file we use, so it's going to be easier to spot in case the unintended file is being used to start the env.
This is awesome. Let's make sure to test on Windows as well so that we don't have any unexpected surprises there :) In a future PR, it could be interesting to support a reference to a VIP environment in the config file for pulling defaults (similar to how you can do |
oh good point re: Windows. Booting up :) |
Tested both under WSL and native Win, works as expected. |
009c260
to
631f443
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Note: I made a final change in here to address the security fix made by @sjinks in #1652 in this commit: 631f443. The new code moves These changes also drop the |
Description
Extends configuration file support to work in any subdirectory of a VIP site.
vip dev-env
commands run anywhere within a configured site will automatically use the site's configuration file.vip dev-env create
will pull environment settings from the.wpvip
configuration folder, and subsequentvip dev-env
commands will use the site's configured slug. There's no longer any need to remember a slug or where configuration is setup as long as it's in the root of a VIP site.In the demo below, a skeleton site is set up with this structure:
The video demonstrates using the same site's development environment in the site root, and within a theme folder:
vip-dev-env-version-1.mp4
Additional changes
.vip-dev-env.yml
file previously could be located anywhere. For consistency, the file is now always loaded from the configuration directory in.wpvip/vip-dev-env.yml
. Because the configuration directory is hidden, the.
has been removed from thevip-dev-env.yml
filename.configuration-version
from0.preview-unstable
to1
.vip dev-env create
.Steps to Test
Manually
These changes can be tested globally via
npm run build && npm link
using theadd/configuration-file-from-ancestor
branch, or commands can be run directly from compiled files like this:$ cd vip-cli $ npm run build $ node dist/bin/vip-dev-env-start.js
Clone vip-go-skeleton into a new directory:
In the
vip-go-skeleton/
root directory, create a.wpvip/
folder containing avip-dev-env.yml
configuration file:$ cd vip-go-skeleton $ mkdir .wpvip $ vim .wpvip/vip-dev-env.yml
Add the following configuration file contents:
In the same root
vip-go-skeleton/
directory, create and run the environment:vip dev-env create
/vip dev-env start
commands can also be run in any subdirectory of the configured skeleton site.Verify that
vip dev-env
commands work in subdirectories ofvip-go-skeleton/
Try entering deeper subdirectories (e.g. something in
themes/
) and ensurevip dev-env
commands automatically pull the environment slug from the root site directory.Tests
New end-to-end tests have been added in
__tests/devenv-e2e/013-configuration-file.spec.js
. Run these tests with: