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

Scripts: Use start without watcher using --no-watch #44237

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

kkmuffme
Copy link
Contributor

What?

Sometimes there's a use case, where we don't want to use "npm start" with the watcher.

Why?

"npm start" directly followed by Ctrl+C, or certain CI environments that want to create unminified JS for analysis without changing the config,...

How?

  • change package.json "start" to "wp-scripts start --no-watch"
  • run "npm start -- --no-watch"

Testing Instructions

any gutenberg, isntead of "npm start" run "npm start -- --no-watch", which will create the unminified/dev JS without starting the watcher.

@gziolo gziolo added [Tool] WP Scripts /packages/scripts [Type] Bug An existing feature does not function as intended labels Sep 17, 2022
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Thank you for opening this PR. The change proposed makes sense 👍🏻

There are some formatting issues and running npm run format will fix them.

packages/scripts/scripts/start.js Outdated Show resolved Hide resolved
@kkmuffme kkmuffme force-pushed the start-no-watch-option branch from 50e7d48 to 4cc05a3 Compare September 17, 2022 19:54
@kkmuffme kkmuffme requested review from gziolo and removed request for ntwb, ajitbohra, ryanwelcher and nerrad September 17, 2022 19:55
@gziolo gziolo changed the title use start without watcher using --no-watch Scripta: Use start without watcher using --no-watch Sep 18, 2022
@gziolo gziolo changed the title Scripta: Use start without watcher using --no-watch Scripts: Use start without watcher using --no-watch Sep 18, 2022
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

I added an entry in the Changelog file. I need to test it locally before merging to trunk.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

It works correctly with --no-watch but breaks when the option is not passed:

Screen Shot 2022-09-21 at 09 22 30

Screen Shot 2022-09-21 at 09 22 39

I created a test block with:

npx wp-create-block test-block --no-wp-scripts
cd test-block

All inside the Gutenberg repository.

@ryanwelcher ryanwelcher added [Type] Enhancement A suggestion for improvement. and removed [Type] Bug An existing feature does not function as intended labels Oct 5, 2022
@kkmuffme kkmuffme force-pushed the start-no-watch-option branch from 2076d6a to 40d45c7 Compare October 17, 2022 08:10
@kkmuffme
Copy link
Contributor Author

Sorry for the delay, fixed now. It's ready to be merged now

@gziolo
Copy link
Member

gziolo commented Oct 19, 2022

Thank you for addressing my feedback. I will land it as soon as I have a chance to test it again.

@kkmuffme
Copy link
Contributor Author

@gziolo could you please check and merge this now?

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

This tests well with the changes applied. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] WP Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants