-
Notifications
You must be signed in to change notification settings - Fork 0
feat: all fixes + self-hosted Google Fonts with Next.js parity #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1360,6 +1360,73 @@ export async function deploy(options: DeployOptions): Promise<void> { | |||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| // Step 6c: Patch dist/server/wrangler.json with env configs from the user's | ||||||||||||||||
| // wrangler.jsonc. The @cloudflare/vite-plugin strips env-specific sections | ||||||||||||||||
| // when generating the output config, so `wrangler deploy --env <name>` can't | ||||||||||||||||
| // resolve environment-specific vars/bindings from the generated file alone. | ||||||||||||||||
| { | ||||||||||||||||
| const distWranglerPath = path.join(root, "dist", "server", "wrangler.json"); | ||||||||||||||||
| if (fs.existsSync(distWranglerPath)) { | ||||||||||||||||
| const userConfigPath = ["wrangler.jsonc", "wrangler.json", "wrangler.toml"] | ||||||||||||||||
| .map((f) => path.join(root, f)) | ||||||||||||||||
| .find((f) => fs.existsSync(f)); | ||||||||||||||||
|
|
||||||||||||||||
| if (userConfigPath && (userConfigPath.endsWith(".json") || userConfigPath.endsWith(".jsonc"))) { | ||||||||||||||||
| try { | ||||||||||||||||
| const userRaw = fs.readFileSync(userConfigPath, "utf-8"); | ||||||||||||||||
| // Strip JSONC comments while preserving strings (// inside "..." is not a comment) | ||||||||||||||||
| let userClean = ""; | ||||||||||||||||
| let inString = false; | ||||||||||||||||
| let i = 0; | ||||||||||||||||
| while (i < userRaw.length) { | ||||||||||||||||
| if (inString) { | ||||||||||||||||
| if (userRaw[i] === "\\" && i + 1 < userRaw.length) { | ||||||||||||||||
| userClean += userRaw[i] + userRaw[i + 1]; | ||||||||||||||||
| i += 2; | ||||||||||||||||
| } else if (userRaw[i] === '"') { | ||||||||||||||||
| userClean += '"'; | ||||||||||||||||
| inString = false; | ||||||||||||||||
| i++; | ||||||||||||||||
| } else { | ||||||||||||||||
| userClean += userRaw[i]; | ||||||||||||||||
| i++; | ||||||||||||||||
| } | ||||||||||||||||
| } else if (userRaw[i] === '"') { | ||||||||||||||||
| userClean += '"'; | ||||||||||||||||
| inString = true; | ||||||||||||||||
| i++; | ||||||||||||||||
| } else if (userRaw[i] === "/" && userRaw[i + 1] === "/") { | ||||||||||||||||
| // Skip to end of line | ||||||||||||||||
| while (i < userRaw.length && userRaw[i] !== "\n") i++; | ||||||||||||||||
| } else if (userRaw[i] === "/" && userRaw[i + 1] === "*") { | ||||||||||||||||
| i += 2; | ||||||||||||||||
| while (i < userRaw.length && !(userRaw[i] === "*" && userRaw[i + 1] === "/")) i++; | ||||||||||||||||
| i += 2; | ||||||||||||||||
| } else { | ||||||||||||||||
| userClean += userRaw[i]; | ||||||||||||||||
| i++; | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| // Remove trailing commas | ||||||||||||||||
| userClean = userClean.replace(/,\s*([\]}])/g, "$1"); | ||||||||||||||||
| const userConfig = JSON.parse(userClean); | ||||||||||||||||
|
|
||||||||||||||||
| if (userConfig.env) { | ||||||||||||||||
| const distConfig = JSON.parse(fs.readFileSync(distWranglerPath, "utf-8")); | ||||||||||||||||
| distConfig.env = userConfig.env; | ||||||||||||||||
| // Also ensure migrations are carried over | ||||||||||||||||
| if (userConfig.migrations && !distConfig.migrations?.length) { | ||||||||||||||||
| distConfig.migrations = userConfig.migrations; | ||||||||||||||||
| } | ||||||||||||||||
| fs.writeFileSync(distWranglerPath, JSON.stringify(distConfig)); | ||||||||||||||||
| } | ||||||||||||||||
| } catch { | ||||||||||||||||
| // Non-fatal — deploy will proceed with existing config | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+1423
to
+1425
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a warning log when env patching fails. Silent error swallowing here could confuse users when 🛠️ Proposed fix- } catch {
- // Non-fatal — deploy will proceed with existing config
+ } catch (err) {
+ // Non-fatal — deploy will proceed with existing config
+ console.warn(` Warning: Could not patch wrangler.json with env config: ${err instanceof Error ? err.message : err}`);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| // Step 7: Deploy via wrangler | ||||||||||||||||
| const url = runWranglerDeploy(root, { | ||||||||||||||||
| preview: options.preview ?? false, | ||||||||||||||||
|
|
||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: streamloop/vinext
Length of output: 100
🏁 Script executed:
Repository: streamloop/vinext
Length of output: 696
🌐 Web query:
GitHub Actions pull_request event fork head.repo.full_name documentation💡 Result:
In GitHub Actions workflows triggered by the pull_request event, the full name of the fork repository (head repository) is available in the github context as github.event.pull_request.head.repo.full_name. This is a string in the format "owner/repo" for the repository containing the head branch of the pull request. This property is particularly useful for distinguishing pull requests from forks. For example, to skip a job if the PR originates from a fork: jobs: example: if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - ... The github.event context mirrors the webhook payload for the pull_request event, where head.repo is a repository object containing full_name, fork (boolean), name, etc. Official GitHub documentation confirms github.event is the full event webhook payload, and community/official action docs reference this path explicitly for fork detection in pull_request events. Note: This is only populated for pull_request and pull_request_target events. For forks, head.repo.full_name differs from github.repository (the base repo).
Citations:
Skip fork PRs explicitly, not just non-owned repos.
For
pull_requestevents, GitHub sends fork PR events to the base repository. The conditiongithub.repository_owner == 'cloudflare' || github.repository_owner == 'streamloop'will always evaluate to true for PRs to this repository regardless of fork origin, becausegithub.repository_ownerrefers to the base repository owner, not the PR's source. This means fork PRs still enter the publish job, contradicting the Line 13 comment intent.To properly skip fork PRs, guard the job with both an owner check and a fork detection:
Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents