workers-sdk
workers-sdk copied to clipboard
🚀 Feature Request: Pages publish should support --site-exclude/--site-include
Describe the solution
Context: I have a static web page I am attempting to migrate from Amazon S3 to Cloudflare Pages. With Amazon, there was a simple program I could run on a directory and it would do something like an rsync (IE upload changed files only) of the directory to the server. CloudFlare pages appears to prefer a situation where I push a git repo and CloudFlare checks out the git repo and runs a "builder". I would prefer to just upload you the files. I have a source control repo for the site but it is not practical to give you access to it.
Problem: I have hit a blocker because wrangler pages publish appears to only be able to upload complete directories. However, I have a .hg (source control) subdirectory in the directory. That should absolutely not be uploaded.
The wrangler publish command, for whatever "workers" are, has a convenient --site-exclude command which addresses my need exactly. However it is not supported for wrangler pages publish: https://developers.cloudflare.com/workers/wrangler/commands/#pages
This is a feature the amazon equivalent does have (--exclude) and is a pretty standard feature for most archival/uploading tools (rsync, zip, etc).
Expected behavior: Could wrangler pages adopt a file include/exclude pattern system? Using the tool without this feature is going to be pretty awkward.
cc @tanushree-sharma
It's very strange that this is not supported, currently there's only this hardcoded array: https://github.com/cloudflare/workers-sdk/blob/0c0374cce3908a47f7459ba4810855c1ce124349/packages/wrangler/src/pages/validate.ts#L44-L53
Having a --site-exclude parameter or an exclude config property support would be great.
While this won't be added to Pages, you can customise what is ignored at upload in Workers Assets using an .assetignore file: https://developers.cloudflare.com/workers/static-assets/binding/#ignoring-assets
This is quite disappointing when Assets isn't yet fit for purpose and migration from Pages. Until static config and a way better DX around building, preview links, etc. I can't recommend anyone migrate to Assets.
Especially when in some cases like the node_modules one, the behaviour is still technically a regression: https://github.com/cloudflare/workers-sdk/issues/3615#issuecomment-1883184775
Should folks consider Pages effectively deprecated at this point?
In the interest of not jumping the gun, i'll keep this issue open! Didn't mean to confuse anyone about Pages, just a PSA in case you're in a position to move to Workers Assets, that does currently have a customisable ignore file. Sorry for the confusion 🧡
It was made abundantly clear that this won’t be added even via a public pull request.
Is that an option again, given there’s a workers implementation that can be extended?