Skip to content

Detect non-framework static sites - #11180

Merged
penalosa merged 3 commits into
mainfrom
penalosa/pure-static-autoconfig
Nov 5, 2025
Merged

Detect non-framework static sites#11180
penalosa merged 3 commits into
mainfrom
penalosa/pure-static-autoconfig

Conversation

@penalosa

@penalosa penalosa commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Fixes https://jira.cfdata.org/browse/DEVX-2266

Support non-framework static sites with autoconfig by looking for a folder that contains an index.html file, and treating that as the output directory.


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: pending
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: new feature

@penalosa
penalosa requested a review from a team as a code owner November 5, 2025 13:35
@changeset-bot

changeset-bot Bot commented Nov 5, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 955c719

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

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2025

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11180

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11180

miniflare

npm i https://pkg.pr.new/miniflare@11180

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11180

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11180

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11180

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11180

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11180

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11180

wrangler

npm i https://pkg.pr.new/wrangler@11180

commit: 955c719

@github-actions

github-actions Bot commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main penalosa/pure-static-autoconfig might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-11180
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

outputDir: process.cwd(),
});
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we are missing a test to make sure that we detect when a fist child dir is actually detected as the outputDir?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean here—could you expand?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh sorry I misread the test below 🤔

I thought it was checking a directory of this shape:

  • index.html
  • random
    • index.html

and making sure that the html from the random dir wasn't being picked up

Sorry my bad 🙂


That being said, maybe the case I just described should also be tested?

e.g.

it("outputDir should prioritize the project directory over its child directories", async () => {
	await seed({
	    "index.html": `<h1>Hello World</h1>`,
		"public/index.html": `<h1>Hello World</h1>`,
	});

	await expect(details.getDetailsForAutoConfig()).resolves.toMatchObject({
		outputDir: process.cwd(),
	});
});

?

Comment thread packages/wrangler/src/autoconfig/c3-vendor/add-wrangler-gitignore.ts Outdated
Comment thread packages/wrangler/src/autoconfig/get-details.ts Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Nov 5, 2025
@penalosa
penalosa merged commit 53b0fce into main Nov 5, 2025
38 of 40 checks passed
@penalosa
penalosa deleted the penalosa/pure-static-autoconfig branch November 5, 2025 16:41
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Nov 5, 2025
@Hafiz613

Hafiz613 commented Nov 5, 2025 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants