You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .changeset/deep-onions-move.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ Interactively handle `wrangler deploy`s that are probably assets-only, where the
6
6
7
7
For example:
8
8
9
-
`npx wrangler deploy ./public` will now ask if you meant to deploy an folder of assets only, ask for a name, set the compat date and then ask to write your choices out to `wrangler.json` for subsequent deployments.
9
+
`npx wrangler deploy ./public` will now ask if you meant to deploy a folder of assets only, ask for a name, set the compat date and then ask whether to write your choices out to `wrangler.json` for subsequent deployments.
10
10
11
-
`npx wrangler deploy --assets=./public` will now ask for a name, set the compat date and then ask to write your choices out to `wrangler.json` for subsequent deployments.
11
+
`npx wrangler deploy --assets=./public` will now ask for a name, set the compat date and then ask whether to write your choices out to `wrangler.json` for subsequent deployments.
12
12
13
-
In non-interactive contexts, we will error as we currently do.
13
+
In non-interactive contexts, Wrangler will error as it currently does.
Please run wrangler deploy instead of wrangler deploy ./assets next time. Wrangler will automatically use the configuration saved to wrangler.json.
2806
+
to <cwd>/wrangler.jsonc.
2807
+
Please run \`wrangler deploy\` instead of \`wrangler deploy ./assets\` next time. Wrangler will automatically use the configuration saved to wrangler.jsonc.
Please run wrangler deploy instead of wrangler deploy ./assets next time. Wrangler will automatically use the configuration saved to wrangler.json.
2868
+
to <cwd>/wrangler.jsonc.
2869
+
Please run \`wrangler deploy\` instead of \`wrangler deploy ./assets\` next time. Wrangler will automatically use the configuration saved to wrangler.jsonc.
2870
+
2871
+
Proceeding with deployment...
2872
+
2873
+
Total Upload: xx KiB / gzip: xx KiB
2874
+
Worker Startup Time: 100 ms
2875
+
Uploaded test-name (TIMINGS)
2876
+
Deployed test-name triggers (TIMINGS)
2877
+
https://test-name.test-sub-domain.workers.dev
2878
+
Current Version ID: Galaxy-Class"
2879
+
`);
2880
+
});
2881
+
2882
+
it("should suggest 'my-project' if the default name from the cwd is invalid",async()=>{
2883
+
process.chdir("../");
2884
+
fs.renameSync("my-site","[blah]");
2885
+
process.chdir("[blah]");
2886
+
// if the user has used --assets flag and args.script is not set, we just need to prompt for the name and add compat date
2887
+
mockPrompt({
2888
+
text: "What do you want to name your project?",
2889
+
// not [blah] because it is an invalid worker name
2890
+
options: {defaultValue: "my-project"},
2891
+
result: "test-name",
2892
+
});
2893
+
mockConfirm({
2894
+
text: "Do you want Wrangler to write a wrangler.json config file to store this configuration?\nThis will allow you to simply run `wrangler deploy` on future deployments.",
2895
+
result: true,
2896
+
});
2897
+
2898
+
constbodies: AssetManifest[]=[];
2899
+
awaitmockAUSRequest(bodies);
2900
+
2901
+
awaitrunWrangler("deploy --assets ./assets");
2902
+
expect(bodies.length).toBe(1);
2903
+
expect(bodies[0]).toEqual({
2904
+
manifest: {
2905
+
"/index.html": {
2906
+
hash: "8308ce789f3d08668ce87176838d59d0",
2907
+
size: 17,
2908
+
},
2909
+
},
2910
+
});
2911
+
expect(fs.readFileSync("wrangler.jsonc","utf-8"))
2912
+
.toMatchInlineSnapshot(`
2913
+
"{
2914
+
\\"name\\": \\"test-name\\",
2915
+
\\"compatibility_date\\": \\"2024-01-01\\",
2916
+
\\"assets\\": {
2917
+
\\"directory\\": \\"./assets\\"
2918
+
}
2919
+
}"
2920
+
`);
2921
+
});
2922
+
2923
+
it("should bail if the user denies that they are trying to deploy a directory",async()=>{
2924
+
mockConfirm({
2925
+
text: "It looks like you are trying to deploy a directory of static assets only. Is this correct?",
[Error: The entry-point file at "assets" was not found.
2932
+
The provided entry-point path, "assets", points to a directory, rather than a file.
2933
+
2934
+
If you want to deploy a directory of static assets, you can do so by using the \`--assets\` flag. For example:
2935
+
2936
+
wrangler deploy --assets=./assets
2937
+
]
2938
+
`);
2939
+
});
2940
+
2941
+
it("does not write out a wrangler config file if the user says no",async()=>{
2942
+
mockPrompt({
2943
+
text: "What do you want to name your project?",
2944
+
options: {defaultValue: "my-site"},
2945
+
result: "test-name",
2946
+
});
2947
+
mockConfirm({
2948
+
text: "Do you want Wrangler to write a wrangler.json config file to store this configuration?\nThis will allow you to simply run `wrangler deploy` on future deployments.",
No compatibility date found Defaulting to today: 2024-01-01
2970
+
2971
+
You should run wrangler deploy --name test-name --compatibility-date 2024-01-01 --assets ./assets next time to deploy this Worker without going through this flow again.
@@ -464,16 +464,15 @@ export async function handleMaybeAssetsDeployment(
464
464
writeFileSync(configPath,jsonString);
465
465
logger.log(`Wrote \n${jsonString}\n to ${chalk.bold(configPath)}.`);
466
466
logger.log(
467
-
`Please run ${chalk.bold("wrangler deploy")} instead of ${chalk.bold(`wrangler deploy ${args.assets}`)} next time. Wrangler will automatically use the configuration saved to wrangler.json.`
467
+
`Please run ${chalk.bold("`wrangler deploy`")} instead of ${chalk.bold(`\`wrangler deploy ${args.assets}\``)} next time. Wrangler will automatically use the configuration saved to wrangler.jsonc.`
0 commit comments