#49460 closed enhancement (fixed)
wp-config gets cleaned out from build folder on rebuild
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.4 | Priority: | normal |
| Severity: | normal | Version: | 5.4 |
| Component: | Build/Test Tools | Keywords: | has-patch |
| Focuses: | Cc: |
Description
If there is a wp-config.php file in the build folder, it gets cleaned out when npm run build is run.
This has become a problem because the newest version of @wordpress/env allows us to setup a unified core/gutenberg development environment from the build folder of our local wordpress-develop. In doing so, it writes a wp-config.php to that folder, which gets wiped out on running npm run build, destroying the development environment.
In testing a fix for this issue, I came across an existing bug in the clean:files task: because BUILD_DIR gets prepended to the strings in the buildFiles array, if any of those strings is a negation, it won't work because the ! will now be in the middle of the string, instead of at the start.
I'm adding a patch for both the main issue and the bug.
Attachments (2)
Change History (10)
#2
in reply to:
↑ description
@
6 years ago
- Milestone changed from Awaiting Review to 5.4
#3
@
6 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 47303:
#4
@
6 years ago
To my understanding, this means that from now on any edit to wp-config.php in the src directory won't be copied over the build directory any longer. Not sure it's ideal for the ones of us that run WordPress from build as it will require to manually edit build/wp-config.php while working on src.
#5
@
6 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Replying to afercia:
To my understanding, this means that from now on any edit to
wp-config.phpin thesrcdirectory won't be copied over thebuilddirectory any longer. Not sure it's ideal for the ones of us that run WordPress frombuildas it will require to manually editbuild/wp-config.phpwhile working onsrc.
Wouldn't placing the file one level above build and src resolve this?
As an alternative, we could preserve the file if it exists in build, but still copy it over from src if it also exists there. 49460.2.diff should do that.
#6
@
6 years ago
As an alternative, we could preserve the file if it exists in build, but still copy it over from src if it also exists there. 49460.2.diff should do that.
Thanks @SergeyBiryukov, this seems to me the best way forward!
It's the solution most compatible with @wordpress/env, which adds wp-config in the root of the WP instance it's running from. This is because @wordpress/env can be configured to run not only from build or src but from any tag or version of development or production WP, so we can't assume a particular folder structure.
Replying to isabel_brison:
Just noting that
wp-config.phpcan be put one level above thebuildfolder, that way it doesn't get cleaned out but still gets recognized by WordPress.That said, I guess it makes sense to preserve it in the
buildfolder if it's there.