-
Notifications
You must be signed in to change notification settings - Fork 690
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
Add wrangler pages project validate [directory]
command
#3762
Conversation
🦋 Changeset detectedLatest commit: 96032a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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/5889398203/npm-package-wrangler-3762 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5889398203/npm-package-wrangler-3762 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5889398203/npm-package-wrangler-3762 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5889398203/npm-package-cloudflare-pages-shared-3762 Note that these links will no longer work once the GitHub Actions artifact expires. |
Codecov Report
@@ Coverage Diff @@
## main #3762 +/- ##
==========================================
+ Coverage 75.17% 75.25% +0.08%
==========================================
Files 194 195 +1
Lines 11410 11428 +18
Branches 3013 3014 +1
==========================================
+ Hits 8577 8600 +23
+ Misses 2833 2828 -5
|
d133664
to
c058fee
Compare
c058fee
to
9415794
Compare
const directory = resolve(args.directory); | ||
|
||
// TODO(future): Use this to more efficiently load files in and speed up uploading | ||
// Limit memory to 1 GB unless more is specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this bit about limiting memory?
) => { | ||
const files = await readdir(dir); | ||
|
||
await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's 10,000k files in a directory, will this blow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's prooooobably worth pulling in p-queue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is just a refactor, and I'd rather keep it to just a copy-paste job right now rather than changing anything about how this actually works. Would totally be fine with creating a new issue to follow-up on improving this though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeahhh I realized that after I made the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - probably worth improving this code, but that's out of scope of this PR
Co-authored-by: John Fawcett <jfawcett@cloudflare.com>
What this PR solves / how to test:
For internal use, we want to validate a static asset directory ahead of actually uploading it.
This PR just pulls out the validation logic we were already doing into its own command and then adds some more tests to cover the failure cases of a file size too large and having too many assets.
Associated docs issue(s)/PR(s):
n/a
Author has included the following, where applicable:
Reviewer is to perform the following, as applicable:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.