Skip to content

feat(cli): Add check-client command to verify bundle freshness #7517

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

JerryWu1234
Copy link
Contributor

@JerryWu1234 JerryWu1234 commented Apr 15, 2025

What is it?

fixes: #7479
This commit adds a new CLI command that checks if the client bundle is up-to-date by:

  • Comparing source file modification times with the manifest file
  • Running a build if source files are newer than the manifest
  • Providing interactive prompts for user confirmation
  • Integrating with the existing Qwik CLI system

Description

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I made corresponding changes to the Qwik docs
  • I added new tests to cover the fix / functionality

Copy link

changeset-bot bot commented Apr 15, 2025

🦋 Changeset detected

Latest commit: 449eb30

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

This PR includes changesets to release 4 packages
Name Type
@builder.io/qwik-city Patch
@builder.io/qwik Patch
eslint-plugin-qwik Patch
create-qwik 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

Copy link

pkg-pr-new bot commented Apr 15, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@builder.io/qwik@7517
npm i https://pkg.pr.new/@builder.io/qwik-city@7517
npm i https://pkg.pr.new/eslint-plugin-qwik@7517
npm i https://pkg.pr.new/create-qwik@7517

commit: 449eb30

Copy link
Contributor

github-actions bot commented Apr 15, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 449eb30

@JerryWu1234 JerryWu1234 marked this pull request as ready for review April 16, 2025 09:16
@JerryWu1234 JerryWu1234 requested a review from a team as a code owner April 16, 2025 09:16
@JerryWu1234 JerryWu1234 self-assigned this Apr 17, 2025
Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

Ok, good start, but it needs to be quiet and fast, and not fancy in any way.

@JerryWu1234
Copy link
Contributor Author

@wmertens I refactored code, it seems to look much better right now

Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

Looking a lot better, but can be even cleaner :)

Move all check-client related functions and constants into a single index.ts file to improve maintainability and reduce file fragmentation
Modify the check-client command to accept `src` and `dist` as arguments instead of hardcoding them. This change enhances flexibility and allows for more dynamic usage of the command across different adapters. The corresponding build scripts in various adapters' `package.json` files have been updated to pass these arguments.
Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

starting to look really nice!

Remove redundant log steps and improve error handling in the client check process.
This change focuses on reducing noise in the logs and ensuring clearer error messages.
@JerryWu1234
Copy link
Contributor Author

@wmertens done

@gioboa gioboa requested a review from wmertens May 2, 2025 12:35
Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

almost there! 👍

@JerryWu1234
Copy link
Contributor Author

done

The function name `isNewerThan` was renamed to `hasNewer` to better reflect its purpose of checking if any files in the directory are newer than the given timestamp. This improves code readability and understanding.
@JerryWu1234
Copy link
Contributor Author

@wmertens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐞] server build should detect when client build is missing or out of date
3 participants