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 wp-env start for non-english core sources #24884

Merged

Conversation

ixkaito
Copy link
Contributor

@ixkaito ixkaito commented Aug 28, 2020

Description

To specify the anchor parameter of wp config set to define( 'WP_DEBUG', in configureWordPress() instead of using the default /* That’s all, stop editing!, because non-English WordPress core doesn't have that line in wp-config-sample.php and will return errors. This will fix #22938.

By the way, I also tested --anchor="define( 'WP_DEBUG', true );" --placement=after, --anchor="define( 'WP_DEBUG', false );" --placement=after, etc. It inserts values properly to the wp-config.php, but the CLI still returns Error: Could not process the 'wp-config.php' transformation. Reason: Unable to locate placement anchor..

I know this might not be the best solution, but it's better to make wp-env work in all environments first.

How has this been tested?

  • npx wp-env start with the default .wp-env.json
  • npx wp-env start with "core": "https://ja.wordpress.org/latest-ja.zip" in .wp-env.json
  • npm run test

All of these returned no warnings and errors, and the front page of WordPress was displayed at http://localhost:8888.

Screenshots

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

Copy link
Member

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

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

image

✔️ Firstly, this does successfully install the correct WordPress image for me

image

✔️ Secondly, this continues correctly adding the config values.

✔️ Finally, this continues working for a default install with no modifications.

Also, the test failures are unrelated, since the RN tests do not rely on wp-env.

@@ -83,7 +83,7 @@ async function configureWordPress( environment, config, spinner ) {
// Add quotes around string values to work with multi-word strings better.
value = typeof value === 'string' ? `"${ value }"` : value;
setupCommands.push(
`wp config set ${ key } ${ value }${
`wp config set ${ key } ${ value } --anchor="define( 'WP_DEBUG',"${
Copy link
Member

Choose a reason for hiding this comment

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

This works for me assuming that WP_DEBUG is always defined :p

@noahtallen noahtallen changed the title Fix the failure of wp-env start on a non-English WordPress core. fix #22938 Fix wp-env start for non-english core sources Aug 28, 2020
@noahtallen noahtallen merged commit e6d4483 into WordPress:master Aug 28, 2020
@noahtallen noahtallen added [Tool] Env /packages/env [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling labels Aug 28, 2020
@github-actions github-actions bot added this to the Gutenberg 8.9 milestone Aug 28, 2020
@ixkaito ixkaito deleted the fix/wp-env-start-for-non-english-wp-core branch August 31, 2020 05:17
arm-band added a commit to arm-band/wp_geidon that referenced this pull request Sep 4, 2020
    - `wp-env` を 1.6.0 から 2.0.0 へ
        - 英語版以外のコアでも `wp-env start` 最中にエラーでコケなくなった( [#22938](WordPress/gutenberg#22938) -> [#24884](WordPress/gutenberg#24884) )
            - これを受けて npm scripts をワンライナー化
- `sample.env`に Browsersync の proxy と port を記載
- Ususama に合わせて変更
    - `gulp-notify` のエラーメッセージ出力を追加
    - `gulp-watch` から `gulp.watch` に変更
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] Env /packages/env [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If a non-English package is specified with wp-env , an error occurs at wp-env start .
2 participants