From 418b65cfd30d8ce8f428138e28f3fcddc8e95bff Mon Sep 17 00:00:00 2001 From: JacobMGEvans Date: Sun, 6 Feb 2022 16:38:33 -0600 Subject: [PATCH] polish: Added scripts to package.json To get wrangler init projects up and running with good ergonomics for deploying and development, added default scripts "start" & "deploy" with assumed TS files in /src --- packages/wrangler/src/__tests__/index.test.ts | 2 ++ packages/wrangler/src/index.tsx | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/wrangler/src/__tests__/index.test.ts b/packages/wrangler/src/__tests__/index.test.ts index 51f12839ddc9..4cce2fc4ed70 100644 --- a/packages/wrangler/src/__tests__/index.test.ts +++ b/packages/wrangler/src/__tests__/index.test.ts @@ -170,6 +170,8 @@ describe("wrangler", () => { }); expect(fs.existsSync("./tsconfig.json")).toBe(false); expect(mockPackageManager.install).toHaveBeenCalled(); + expect(packageJson.scripts.start).toBe("wrangler dev src/index.ts"); + expect(packageJson.scripts.deploy).toBe("wrangler publish src/index.ts"); }); it("should not touch an existing package.json in the same directory", async () => { diff --git a/packages/wrangler/src/index.tsx b/packages/wrangler/src/index.tsx index ab34c89dc974..0bd74d2855e8 100644 --- a/packages/wrangler/src/index.tsx +++ b/packages/wrangler/src/index.tsx @@ -229,6 +229,10 @@ export async function main(argv: string[]): Promise { { name: "worker", version: "0.0.0", + scripts: { + start: "wrangler dev src/index.ts", + deploy: "wrangler publish src/index.ts", + }, devDependencies: { wrangler: wranglerVersion, },