Skip to content

Commit

Permalink
polish: Added scripts to package.json
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JacobMGEvans committed Feb 6, 2022
1 parent 536c7e5 commit 418b65c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/wrangler/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ export async function main(argv: string[]): Promise<void> {
{
name: "worker",
version: "0.0.0",
scripts: {
start: "wrangler dev src/index.ts",
deploy: "wrangler publish src/index.ts",
},
devDependencies: {
wrangler: wranglerVersion,
},
Expand Down

0 comments on commit 418b65c

Please sign in to comment.