Skip to content

Commit d4c1171

Browse files
authored
Unhide 'wrangler pages functions build' (#8795)
* Unhide 'wrangler pages functions build' * Accept live docs URLs
1 parent 1ba9e97 commit d4c1171

File tree

6 files changed

+137
-101
lines changed

6 files changed

+137
-101
lines changed

.changeset/tiny-ideas-nail.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": minor
3+
---
4+
5+
feat: Unhide `wrangler pages functions build` command.
6+
7+
This is already documented for Pages Plugins and by officially documenting it, we can ease the transition to Workers Assets for users of Pages Functions.

packages/wrangler/src/__tests__/pages/pages.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe("pages", () => {
2424
2525
COMMANDS
2626
wrangler pages dev [directory] [-- command..] Develop your full-stack Pages application locally
27+
wrangler pages functions Helpers related to Pages Functions
2728
wrangler pages project Interact with your Pages projects
2829
wrangler pages deployment Interact with the deployments of a project
2930
wrangler pages deploy [directory] Deploy a directory of static assets as a Pages deployment [aliases: publish]

packages/wrangler/src/pages/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function Options(yargs: CommonYargsArgv) {
5050
outfile: {
5151
type: "string",
5252
description: "The location of the output Worker script",
53+
deprecated: true,
5354
},
5455
outdir: {
5556
type: "string",

packages/wrangler/src/pages/index.ts

Lines changed: 94 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -25,114 +25,108 @@ process.on("SIGTERM", () => {
2525
});
2626

2727
export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) {
28-
return (
29-
yargs
30-
.command(subHelp)
31-
.command(
32-
"dev [directory] [-- command..]",
33-
"Develop your full-stack Pages application locally",
34-
Dev.Options,
35-
Dev.Handler
36-
)
37-
/**
38-
* `wrangler pages functions` is meant for internal use only for now,
39-
* so let's hide this command from the help output
40-
*/
41-
.command("functions", false, (args) =>
42-
args
43-
.command(subHelp)
44-
.command(
45-
"build [directory]",
46-
"Compile a folder of Cloudflare Pages Functions into a single Worker",
47-
Build.Options,
48-
Build.Handler
49-
)
50-
.command(
51-
"build-env [projectDir]",
52-
"Render a list of environment variables from the config file",
53-
BuildEnv.Options,
54-
BuildEnv.Handler
55-
)
56-
.command(
57-
"optimize-routes [routesPath] [outputRoutesPath]",
58-
"Consolidate and optimize the route paths declared in _routes.json",
59-
Functions.OptimizeRoutesOptions,
60-
Functions.OptimizeRoutesHandler
61-
)
62-
)
63-
.command("project", "Interact with your Pages projects", (args) =>
28+
return yargs
29+
.command(subHelp)
30+
.command(
31+
"dev [directory] [-- command..]",
32+
"Develop your full-stack Pages application locally",
33+
Dev.Options,
34+
Dev.Handler
35+
)
36+
.command("functions", "Helpers related to Pages Functions", (args) =>
37+
args
38+
.command(subHelp)
39+
.command(
40+
"build [directory]",
41+
"Compile a folder of Pages Functions into a single Worker",
42+
Build.Options,
43+
Build.Handler
44+
)
45+
.command(
46+
"build-env [projectDir]",
47+
false, // Render a list of environment variables from the config file
48+
BuildEnv.Options,
49+
BuildEnv.Handler
50+
)
51+
.command(
52+
"optimize-routes [routesPath] [outputRoutesPath]",
53+
false, // Consolidate and optimize the route paths declared in _routes.json
54+
Functions.OptimizeRoutesOptions,
55+
Functions.OptimizeRoutesHandler
56+
)
57+
)
58+
.command("project", "Interact with your Pages projects", (args) =>
59+
args
60+
.command(subHelp)
61+
.command(
62+
"list",
63+
"List your Cloudflare Pages projects",
64+
Projects.ListOptions,
65+
Projects.ListHandler
66+
)
67+
.command(
68+
"create [project-name]",
69+
"Create a new Cloudflare Pages project",
70+
Projects.CreateOptions,
71+
Projects.CreateHandler
72+
)
73+
.command(
74+
"delete [project-name]",
75+
"Delete a Cloudflare Pages project",
76+
Projects.DeleteOptions,
77+
Projects.DeleteHandler
78+
)
79+
.command("upload [directory]", false, Upload.Options, Upload.Handler)
80+
.command(
81+
"validate [directory]",
82+
false,
83+
Validate.Options,
84+
Validate.Handler
85+
)
86+
)
87+
.command(
88+
"deployment",
89+
"Interact with the deployments of a project",
90+
(args) =>
6491
args
6592
.command(subHelp)
6693
.command(
6794
"list",
68-
"List your Cloudflare Pages projects",
69-
Projects.ListOptions,
70-
Projects.ListHandler
71-
)
72-
.command(
73-
"create [project-name]",
74-
"Create a new Cloudflare Pages project",
75-
Projects.CreateOptions,
76-
Projects.CreateHandler
95+
"List deployments in your Cloudflare Pages project",
96+
Deployments.ListOptions,
97+
Deployments.ListHandler
7798
)
7899
.command(
79-
"delete [project-name]",
80-
"Delete a Cloudflare Pages project",
81-
Projects.DeleteOptions,
82-
Projects.DeleteHandler
100+
"create [directory]",
101+
"Publish a directory of static assets as a Pages deployment",
102+
Deploy.Options,
103+
Deploy.Handler
83104
)
84-
.command("upload [directory]", false, Upload.Options, Upload.Handler)
85105
.command(
86-
"validate [directory]",
87-
false,
88-
Validate.Options,
89-
Validate.Handler
106+
"tail [deployment]",
107+
"Start a tailing session for a project's deployment and " +
108+
"livestream logs from your Functions",
109+
DeploymentTails.Options,
110+
DeploymentTails.Handler
90111
)
112+
)
113+
.command(
114+
["deploy [directory]", "publish [directory]"],
115+
"Deploy a directory of static assets as a Pages deployment",
116+
Deploy.Options,
117+
Deploy.Handler
118+
)
119+
.command(
120+
"secret",
121+
"Generate a secret that can be referenced in a Pages project",
122+
(secretYargs) => secret(secretYargs, subHelp)
123+
)
124+
.command("download", "Download settings from your project", (args) =>
125+
args.command(
126+
"config [projectName]",
127+
"Experimental: Download your Pages project config as a Wrangler configuration file",
128+
DownloadConfig.Options,
129+
DownloadConfig.Handler
91130
)
92-
.command(
93-
"deployment",
94-
"Interact with the deployments of a project",
95-
(args) =>
96-
args
97-
.command(subHelp)
98-
.command(
99-
"list",
100-
"List deployments in your Cloudflare Pages project",
101-
Deployments.ListOptions,
102-
Deployments.ListHandler
103-
)
104-
.command(
105-
"create [directory]",
106-
"Publish a directory of static assets as a Pages deployment",
107-
Deploy.Options,
108-
Deploy.Handler
109-
)
110-
.command(
111-
"tail [deployment]",
112-
"Start a tailing session for a project's deployment and " +
113-
"livestream logs from your Functions",
114-
DeploymentTails.Options,
115-
DeploymentTails.Handler
116-
)
117-
)
118-
.command(
119-
["deploy [directory]", "publish [directory]"],
120-
"Deploy a directory of static assets as a Pages deployment",
121-
Deploy.Options,
122-
Deploy.Handler
123-
)
124-
.command(
125-
"secret",
126-
"Generate a secret that can be referenced in a Pages project",
127-
(secretYargs) => secret(secretYargs, subHelp)
128-
)
129-
.command("download", "Download settings from your project", (args) =>
130-
args.command(
131-
"config [projectName]",
132-
"Experimental: Download your Pages project config as a Wrangler configuration file",
133-
DownloadConfig.Options,
134-
DownloadConfig.Handler
135-
)
136-
)
137-
);
131+
);
138132
}

tools/deployments/__tests__/validate-pr-description.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,39 @@ Fixes [AA-000](https://jira.cfdata.org/browse/AA-000).
116116
).toHaveLength(0);
117117
});
118118

119+
it("should accept a docs link", () => {
120+
expect(
121+
validateDescription(
122+
"",
123+
`## What this PR solves / how to test
124+
125+
Fixes [AA-000](https://jira.cfdata.org/browse/AA-000).
126+
127+
## Author has addressed the following
128+
129+
- Tests
130+
- [ ] TODO (before merge)
131+
- [x] Tests included
132+
- [ ] Tests not necessary because:
133+
- E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
134+
- [ ] I don't know
135+
- [ ] Required
136+
- [x] Not required because: test
137+
- Public documentation
138+
- [ ] TODO (before merge)
139+
- [x] Cloudflare docs PR(s): https://developers.cloudflare.com/workers/something-here/
140+
- [ ] Documentation not necessary because:
141+
- Wrangler V3 Backport
142+
- [ ] TODO (before merge)
143+
- [x] Wrangler PR: https://github.com/cloudflare/workers-sdk/pull/123
144+
- [ ] Not necessary because:
145+
`,
146+
"[]",
147+
'[".changeset/hello-world.md"]'
148+
)
149+
).toHaveLength(0);
150+
});
151+
119152
it("should not accept e2e unknown", () => {
120153
expect(
121154
validateDescription(

tools/deployments/validate-pr-description.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function validateDescription(
9494

9595
if (
9696
!(
97-
/- \[x\] Cloudflare docs PR\(s\): https:\/\/github\.com\/cloudflare\/cloudflare-docs\/(pull|issues)\/\d+/i.test(
97+
/- \[x\] Cloudflare docs PR\(s\): https:\/\/(github\.com\/cloudflare\/cloudflare-docs\/(pull|issues)\/\d+|developers\.cloudflare\.com\/.*)/i.test(
9898
body
9999
) || /- \[x\] Documentation not necessary because: .+/i.test(body)
100100
)

0 commit comments

Comments
 (0)