Skip to content

Commit

Permalink
Fix 'pages publish' defaults (#947)
Browse files Browse the repository at this point in the history
* Updated defaults and help of wrangler pages publish

* Update help messaging and make 'directory' required

Co-authored-by: Isaac McFadyen <6243993+mcfadyeni@users.noreply.github.com>
  • Loading branch information
GregBrimble and isaac-mcfadyen committed May 10, 2022
1 parent d84b568 commit 38b7242
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-wolves-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Updated defaults and help of wrangler pages publish
12 changes: 6 additions & 6 deletions packages/wrangler/src/__tests__/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe("pages", () => {
🆙 Publish a directory of static assets as a Pages deployment
Positionals:
directory The directory of Pages Functions [string] [default: \\"functions\\"]
directory The directory of static files to upload [string]
Flags:
-c, --config Path to .toml configuration file [string]
Expand All @@ -267,11 +267,11 @@ describe("pages", () => {
--legacy-env Use legacy environments [boolean]
Options:
--project-name The name of the project you want to list deployments for [string]
--branch The branch of the project you want to list deployments for [string]
--commit-hash The branch of the project you want to list deployments for [string]
--commit-message The branch of the project you want to list deployments for [string]
--commit-dirty The branch of the project you want to list deployments for [boolean]
--project-name The name of the project you want to deploy to [string]
--branch The name of the branch you want to deploy to [string]
--commit-hash The SHA to attach to this deployment [string]
--commit-message The commit message to attach to this deployment [string]
--commit-dirty Whether or not the workspace should be considered dirty for this deployment [boolean]
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose"
`);
Expand Down
22 changes: 11 additions & 11 deletions packages/wrangler/src/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -804,34 +804,30 @@ const createDeployment: CommandModule<
return yargs
.positional("directory", {
type: "string",
default: "functions",
description: "The directory of Pages Functions",
demandOption: true,
description: "The directory of static files to upload",
})
.options({
"project-name": {
type: "string",
description:
"The name of the project you want to list deployments for",
description: "The name of the project you want to deploy to",
},
branch: {
type: "string",
description:
"The branch of the project you want to list deployments for",
description: "The name of the branch you want to deploy to",
},
"commit-hash": {
type: "string",
description:
"The branch of the project you want to list deployments for",
description: "The SHA to attach to this deployment",
},
"commit-message": {
type: "string",
description:
"The branch of the project you want to list deployments for",
description: "The commit message to attach to this deployment",
},
"commit-dirty": {
type: "boolean",
description:
"The branch of the project you want to list deployments for",
"Whether or not the workspace should be considered dirty for this deployment",
},
})
.epilogue(pagesBetaWarning);
Expand All @@ -844,6 +840,10 @@ const createDeployment: CommandModule<
commitMessage,
commitDirty,
}) => {
if (!directory) {
throw new FatalError("Must specify a directory.", 1);
}

const config = getConfigCache<PagesConfigCache>(
PAGES_CONFIG_CACHE_FILENAME
);
Expand Down

0 comments on commit 38b7242

Please sign in to comment.