Skip to content

Commit

Permalink
refactor: prevent bundling entire package.json in built code (#6753)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Sep 24, 2024
1 parent 638a550 commit 4e33f2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eight-emus-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

refactor: prevent bundling entire `package.json` in built code
8 changes: 7 additions & 1 deletion packages/wrangler/src/update-check.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import chalk from "chalk";
import supportsColor from "supports-color";
import checkForUpdate from "update-check";
import pkg, { version as wranglerVersion } from "../package.json";
import {
name as wranglerName,
version as wranglerVersion,
} from "../package.json";
import { logger } from "./logger";
import type { Result } from "update-check";

Expand Down Expand Up @@ -42,6 +45,9 @@ After installation, run Wrangler with \`npx wrangler\`.`

async function doUpdateCheck(): Promise<string | undefined> {
let update: Result | null = null;
// `check-update` only requires the name and version to check. This way we
// don't have to bundle the entire `package.json` in the final build.
const pkg = { name: wranglerName, version: wranglerVersion };
try {
// default cache for update check is 1 day
update = await checkForUpdate(pkg, {
Expand Down

0 comments on commit 4e33f2c

Please sign in to comment.