-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds some enhancements/fixes to the `wrangler init` command. - doesn't overwrite `wrangler.toml` if it already exists - installs `wrangler` when creating `package.json` - offers to install `wrangler` into `package.json` even if `package.json` already exists - offers to install `@cloudflare/workers-types` even if `tsconfig.json` already exists - pipes stdio back to the terminal so there's feedback when it's installing npm packages This does have the side effect of making our tests a _little_ slower. I added `--prefer-offline` to the `npm install` calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: #66) This PR also fixes an issue with our tests: `runWrangler()` would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting.
- Loading branch information
1 parent
71b0fab
commit fa750f9
Showing
8 changed files
with
620 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
feat: enhance `wrangler init` | ||
|
||
This PR adds some enhancements/fixes to the `wrangler init` command. | ||
|
||
- doesn't overwrite `wrangler.toml` if it already exists | ||
- installs `wrangler` when creating `package.json` | ||
- offers to install `wrangler` into `package.json` even if `package.json` already exists | ||
- offers to install `@cloudflare/workers-types` even if `tsconfig.json` already exists | ||
- pipes stdio back to the terminal so there's feedback when it's installing npm packages | ||
|
||
This does have the side effect of making out tests slower. I added `--prefer-offline` to the `npm install` calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: https://github.com/cloudflare/wrangler2/issues/66) | ||
|
||
This PR also fixes a bug with our tests - `runWrangler` would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.