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

[wrangler] move assets.directory logs on file changes to debug #6873

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

zwily
Copy link
Contributor

@zwily zwily commented Oct 1, 2024

What this PR solves / how to test

When using wrangler dev with a worker with an assets dir set, every time a file changed in that dir, it was logged. This causes a lot of noise when that dir is the target of a build (like with remix). This commit moved that logging to debug.

Fixes N/A

Author has addressed the following

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: trivial
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: external PR
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Changeset included
    • Changeset not necessary because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: small change

@zwily zwily requested a review from a team as a code owner October 1, 2024 15:55
Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: 74e086e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

}).on("all", async (eventName, changedPath) => {
const message = getAssetChangeMessage(eventName, changedPath);

logger.log(`🌀 ${message}...`);
Copy link
Member

Choose a reason for hiding this comment

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

I think we should log the message inside the debounce

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Log something like "x files in assets directory changed"?

@zwily
Copy link
Contributor Author

zwily commented Oct 1, 2024

This change doesn't catch the logging in --x-dev-env. Notice that I'm capturing the # of changes now to log, but I don't know how to do that in

async #ensureWatchingAssets(assetsPath: string | undefined) {
because there's no debounce there - (the debouncing is handled elsewhere). Can we just eliminate the logging completely?

Copy link
Contributor

github-actions bot commented Oct 2, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-wrangler-6873

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6873/npm-package-wrangler-6873

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-wrangler-6873 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-create-cloudflare-6873 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-cloudflare-kv-asset-handler-6873
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-miniflare-6873
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-cloudflare-pages-shared-6873
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-cloudflare-vitest-pool-workers-6873
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-cloudflare-workers-editor-shared-6873
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11145622423/npm-package-cloudflare-workers-shared-6873

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.79.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240925.0
workerd 1.20240925.0 1.20240925.0
workerd --version 1.20240925.0 2024-09-25

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

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

Can you continue logging each asset change message but use logger.debug instead? This would reduce noise by default but still have this info accessible if necessary. Thanks so much for all the PRs and issues btw, really appreciate it!

@zwily zwily changed the title [wrangler] stop logging every change in assets.directory in dev [wrangler] move assets.directory logs on file changes to debug Oct 2, 2024
@zwily
Copy link
Contributor Author

zwily commented Oct 2, 2024

Can you continue logging each asset change message but use logger.debug instead? This would reduce noise by default but still have this info accessible if necessary. Thanks so much for all the PRs and issues btw, really appreciate it!

That's a much better idea. I made that change, and also changed the logging in x-dev-env

@RamIdeas
Copy link
Contributor

RamIdeas commented Oct 2, 2024

I also did the same in #6881

My rationale was we don't print the source files changes when we reload the dev server so there's no need to do so for assets either

@emily-shen emily-shen merged commit b123f43 into cloudflare:main Oct 2, 2024
17 checks passed
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label Oct 2, 2024
Copy link

holopin-bot bot commented Oct 2, 2024

Congratulations @zwily, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cm1rzbk1m24280cmcjve1as6e

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

@workers-devprod workers-devprod mentioned this pull request Oct 2, 2024
@zwily
Copy link
Contributor Author

zwily commented Oct 2, 2024

Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution [Holopin] Recognizes an open-source contribution, big or small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants