@cloudflare/deploy-helpers 0.20.4 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JXU4CCEI.mjs → chunk-Y4VATABS.mjs} +3 -4
- package/dist/{context-CYOACjI9.d.mts → context-qB2Gxcuw.d.mts} +7 -5
- package/dist/context.d.mts +1 -1
- package/dist/context.mjs +1 -1
- package/dist/index.d.mts +72 -31
- package/dist/index.mjs +274 -149
- package/dist/metafile-esm.json +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { fetchResult, fetchPagedListResult,
|
|
3
|
-
export { initDeployHelpersContext } from './chunk-
|
|
2
|
+
import { fetchResult, fetchPagedListResult, logger, confirm, fetchListResult, prompt, select } from './chunk-Y4VATABS.mjs';
|
|
3
|
+
export { initDeployHelpersContext } from './chunk-Y4VATABS.mjs';
|
|
4
4
|
import { createWorkerUploadForm, moduleTypeMimeType } from './chunk-DSGVRFIS.mjs';
|
|
5
5
|
export { createWorkerUploadForm, fromMimeType, handleUnsafeCapnp, moduleTypeMimeType } from './chunk-DSGVRFIS.mjs';
|
|
6
6
|
import { __commonJS, __name, __require, __toESM, __export } from './chunk-U6NEESU5.mjs';
|
|
@@ -2916,7 +2916,7 @@ function describeConflictOwner(remote) {
|
|
|
2916
2916
|
if (remote.source === "wrangler") {
|
|
2917
2917
|
return remote.owner_worker_name ? `owned by worker "${remote.owner_worker_name}"` : "owned by another Worker";
|
|
2918
2918
|
}
|
|
2919
|
-
return
|
|
2919
|
+
return "managed outside this deployment";
|
|
2920
2920
|
}
|
|
2921
2921
|
__name(describeConflictOwner, "describeConflictOwner");
|
|
2922
2922
|
function renderEmailRoutingPlan(plan, workerName) {
|
|
@@ -3583,19 +3583,25 @@ async function listQueues(complianceConfig, accountId, page, name) {
|
|
|
3583
3583
|
);
|
|
3584
3584
|
}
|
|
3585
3585
|
__name(listQueues, "listQueues");
|
|
3586
|
-
async function getQueue(complianceConfig, accountId, queueName) {
|
|
3586
|
+
async function getQueue(complianceConfig, accountId, queueName, queueCreateCommand) {
|
|
3587
3587
|
const queues = await listQueues(complianceConfig, accountId, 1, queueName);
|
|
3588
3588
|
if (queues.length === 0) {
|
|
3589
|
+
const createQueueGuidance = queueCreateCommand ? ` To create it, run: ${queueCreateCommand(queueName)}` : "";
|
|
3589
3590
|
throw new UserError(
|
|
3590
|
-
`Queue "${queueName}" does not exist
|
|
3591
|
+
`Queue "${queueName}" does not exist.${createQueueGuidance}`,
|
|
3591
3592
|
{ telemetryMessage: "queues lookup missing queue" }
|
|
3592
3593
|
);
|
|
3593
3594
|
}
|
|
3594
3595
|
return queues[0];
|
|
3595
3596
|
}
|
|
3596
3597
|
__name(getQueue, "getQueue");
|
|
3597
|
-
async function postConsumer(complianceConfig, accountId, queueName, body) {
|
|
3598
|
-
const queue = await getQueue(
|
|
3598
|
+
async function postConsumer(complianceConfig, accountId, queueName, body, queueCreateCommand) {
|
|
3599
|
+
const queue = await getQueue(
|
|
3600
|
+
complianceConfig,
|
|
3601
|
+
accountId,
|
|
3602
|
+
queueName,
|
|
3603
|
+
queueCreateCommand
|
|
3604
|
+
);
|
|
3599
3605
|
return postConsumerById(complianceConfig, accountId, queue.queue_id, body);
|
|
3600
3606
|
}
|
|
3601
3607
|
__name(postConsumer, "postConsumer");
|
|
@@ -3621,8 +3627,13 @@ async function putConsumerById(complianceConfig, accountId, queueId, consumerId,
|
|
|
3621
3627
|
);
|
|
3622
3628
|
}
|
|
3623
3629
|
__name(putConsumerById, "putConsumerById");
|
|
3624
|
-
async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body) {
|
|
3625
|
-
const queue = await getQueue(
|
|
3630
|
+
async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body, queueCreateCommand) {
|
|
3631
|
+
const queue = await getQueue(
|
|
3632
|
+
complianceConfig,
|
|
3633
|
+
accountId,
|
|
3634
|
+
queueName,
|
|
3635
|
+
queueCreateCommand
|
|
3636
|
+
);
|
|
3626
3637
|
const targetConsumer = await resolveWorkerConsumerByName(
|
|
3627
3638
|
complianceConfig,
|
|
3628
3639
|
accountId,
|
|
@@ -3697,8 +3708,13 @@ async function deleteConsumerById(complianceConfig, accountId, queueId, consumer
|
|
|
3697
3708
|
);
|
|
3698
3709
|
}
|
|
3699
3710
|
__name(deleteConsumerById, "deleteConsumerById");
|
|
3700
|
-
async function deletePullConsumer(complianceConfig, accountId, queueName) {
|
|
3701
|
-
const queue = await getQueue(
|
|
3711
|
+
async function deletePullConsumer(complianceConfig, accountId, queueName, queueCreateCommand) {
|
|
3712
|
+
const queue = await getQueue(
|
|
3713
|
+
complianceConfig,
|
|
3714
|
+
accountId,
|
|
3715
|
+
queueName,
|
|
3716
|
+
queueCreateCommand
|
|
3717
|
+
);
|
|
3702
3718
|
const consumer = queue.consumers[0];
|
|
3703
3719
|
if (consumer?.type !== "http_pull") {
|
|
3704
3720
|
throw new UserError(`No http_pull consumer exists for queue ${queueName}`, {
|
|
@@ -3713,13 +3729,23 @@ async function deletePullConsumer(complianceConfig, accountId, queueName) {
|
|
|
3713
3729
|
);
|
|
3714
3730
|
}
|
|
3715
3731
|
__name(deletePullConsumer, "deletePullConsumer");
|
|
3716
|
-
async function listConsumers(complianceConfig, accountId, queueName) {
|
|
3717
|
-
const queue = await getQueue(
|
|
3732
|
+
async function listConsumers(complianceConfig, accountId, queueName, queueCreateCommand) {
|
|
3733
|
+
const queue = await getQueue(
|
|
3734
|
+
complianceConfig,
|
|
3735
|
+
accountId,
|
|
3736
|
+
queueName,
|
|
3737
|
+
queueCreateCommand
|
|
3738
|
+
);
|
|
3718
3739
|
return queue.consumers;
|
|
3719
3740
|
}
|
|
3720
3741
|
__name(listConsumers, "listConsumers");
|
|
3721
|
-
async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName) {
|
|
3722
|
-
const queue = await getQueue(
|
|
3742
|
+
async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName, queueCreateCommand) {
|
|
3743
|
+
const queue = await getQueue(
|
|
3744
|
+
complianceConfig,
|
|
3745
|
+
accountId,
|
|
3746
|
+
queueName,
|
|
3747
|
+
queueCreateCommand
|
|
3748
|
+
);
|
|
3723
3749
|
const targetConsumer = await resolveWorkerConsumerByName(
|
|
3724
3750
|
complianceConfig,
|
|
3725
3751
|
accountId,
|
|
@@ -3735,11 +3761,16 @@ async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scri
|
|
|
3735
3761
|
);
|
|
3736
3762
|
}
|
|
3737
3763
|
__name(deleteWorkerConsumer, "deleteWorkerConsumer");
|
|
3738
|
-
async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2) {
|
|
3764
|
+
async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2, queueCreateCommand) {
|
|
3739
3765
|
const consumers = config2.queues.consumers || [];
|
|
3740
3766
|
const updateConsumers = [];
|
|
3741
3767
|
for (const consumer of consumers) {
|
|
3742
|
-
const queue = await getQueue(
|
|
3768
|
+
const queue = await getQueue(
|
|
3769
|
+
complianceConfig,
|
|
3770
|
+
accountId,
|
|
3771
|
+
consumer.queue,
|
|
3772
|
+
queueCreateCommand
|
|
3773
|
+
);
|
|
3743
3774
|
const body = {
|
|
3744
3775
|
type: "worker",
|
|
3745
3776
|
dead_letter_queue: consumer.dead_letter_queue,
|
|
@@ -3764,7 +3795,8 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
|
|
|
3764
3795
|
consumer.queue,
|
|
3765
3796
|
scriptName,
|
|
3766
3797
|
envName,
|
|
3767
|
-
body
|
|
3798
|
+
body,
|
|
3799
|
+
queueCreateCommand
|
|
3768
3800
|
).then(
|
|
3769
3801
|
() => ({ targets: [`Consumer for ${consumer.queue}`] }),
|
|
3770
3802
|
(error62) => ({ targets: [], error: error62 })
|
|
@@ -3773,7 +3805,13 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
|
|
|
3773
3805
|
continue;
|
|
3774
3806
|
}
|
|
3775
3807
|
updateConsumers.push(
|
|
3776
|
-
postConsumer(
|
|
3808
|
+
postConsumer(
|
|
3809
|
+
complianceConfig,
|
|
3810
|
+
accountId,
|
|
3811
|
+
consumer.queue,
|
|
3812
|
+
body,
|
|
3813
|
+
queueCreateCommand
|
|
3814
|
+
).then(
|
|
3777
3815
|
() => ({
|
|
3778
3816
|
targets: [`Consumer for ${consumer.queue}`]
|
|
3779
3817
|
}),
|
|
@@ -3791,7 +3829,7 @@ var queuesUrl = /* @__PURE__ */ __name((accountId, queueId) => {
|
|
|
3791
3829
|
}
|
|
3792
3830
|
return url3;
|
|
3793
3831
|
}, "queuesUrl");
|
|
3794
|
-
async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName) {
|
|
3832
|
+
async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName, queueCreateCommand) {
|
|
3795
3833
|
const producerNames = (config2.queues.producers || []).flatMap((producer) => {
|
|
3796
3834
|
if (producer.queue) {
|
|
3797
3835
|
return [producer.queue];
|
|
@@ -3822,8 +3860,9 @@ async function ensureQueuesExistByConfig(config2, accountId, includeProducers =
|
|
|
3822
3860
|
const queueSet = new Set(existingQueues);
|
|
3823
3861
|
for (const queue of queueNames) {
|
|
3824
3862
|
if (!queueSet.has(queue)) {
|
|
3863
|
+
const createQueueGuidance = queueCreateCommand ? ` To create it, run: ${queueCreateCommand(queue)}` : "";
|
|
3825
3864
|
throw new UserError(
|
|
3826
|
-
`Queue "${queue}" does not exist
|
|
3865
|
+
`Queue "${queue}" does not exist.${createQueueGuidance}`,
|
|
3827
3866
|
{ telemetryMessage: "queues config missing queue" }
|
|
3828
3867
|
);
|
|
3829
3868
|
}
|
|
@@ -3996,7 +4035,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
|
|
|
3996
4035
|
if (subdomainAvailabilityCheckError.code === 10032) ; else if (subdomainAvailabilityCheckError.code === 10031) {
|
|
3997
4036
|
if (automaticSubdomain) {
|
|
3998
4037
|
throw new UserError(
|
|
3999
|
-
|
|
4038
|
+
`Could not automatically register "${potentialName}" as your workers.dev subdomain because the name is unavailable. Register a different subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
|
|
4000
4039
|
{
|
|
4001
4040
|
telemetryMessage: "workers dev automatic registration name unavailable"
|
|
4002
4041
|
}
|
|
@@ -4009,7 +4048,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
|
|
|
4009
4048
|
} else {
|
|
4010
4049
|
if (automaticSubdomain) {
|
|
4011
4050
|
throw new UserError(
|
|
4012
|
-
|
|
4051
|
+
`Could not verify whether "${potentialName}" is available as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
|
|
4013
4052
|
{
|
|
4014
4053
|
telemetryMessage: "workers dev automatic registration availability check failed"
|
|
4015
4054
|
}
|
|
@@ -4048,7 +4087,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
|
|
|
4048
4087
|
const subdomainCreationError = err;
|
|
4049
4088
|
if (automaticSubdomain) {
|
|
4050
4089
|
throw new UserError(
|
|
4051
|
-
|
|
4090
|
+
`Could not automatically register "${potentialName}" as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
|
|
4052
4091
|
{
|
|
4053
4092
|
telemetryMessage: "workers dev automatic registration creation failed"
|
|
4054
4093
|
}
|
|
@@ -4095,7 +4134,13 @@ async function triggersDeploy(props) {
|
|
|
4095
4134
|
const { accountId } = props;
|
|
4096
4135
|
assert6(accountId);
|
|
4097
4136
|
if (props.validated !== true) {
|
|
4098
|
-
await ensureQueuesExistByConfig(
|
|
4137
|
+
await ensureQueuesExistByConfig(
|
|
4138
|
+
config2,
|
|
4139
|
+
accountId,
|
|
4140
|
+
true,
|
|
4141
|
+
scriptName,
|
|
4142
|
+
props.queueCreateCommand
|
|
4143
|
+
);
|
|
4099
4144
|
}
|
|
4100
4145
|
const routesOnly = [];
|
|
4101
4146
|
const customDomainsOnly = [];
|
|
@@ -4249,7 +4294,8 @@ ${dashLink}`, {
|
|
|
4249
4294
|
config2,
|
|
4250
4295
|
accountId,
|
|
4251
4296
|
scriptName,
|
|
4252
|
-
config2
|
|
4297
|
+
config2,
|
|
4298
|
+
props.queueCreateCommand
|
|
4253
4299
|
);
|
|
4254
4300
|
deployments.push(
|
|
4255
4301
|
...consumerUpdates.map(
|
|
@@ -4530,9 +4576,8 @@ function getSubdomainValuesAPIMock(config_workers_dev, config_preview_urls, rout
|
|
|
4530
4576
|
};
|
|
4531
4577
|
}
|
|
4532
4578
|
__name(getSubdomainValuesAPIMock, "getSubdomainValuesAPIMock");
|
|
4533
|
-
function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
|
|
4534
|
-
const
|
|
4535
|
-
const workersDevAssignment = `${workersDevField}${cliPresentation.configFieldAssignmentSeparator}${beforeEnabled}`;
|
|
4579
|
+
function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled, configFile, workersDevConfigFieldName, workersDevConfigAssignment) {
|
|
4580
|
+
const workersDevAssignment = workersDevConfigAssignment(beforeEnabled);
|
|
4536
4581
|
const status = /* @__PURE__ */ __name((enabled, past) => {
|
|
4537
4582
|
if (past) {
|
|
4538
4583
|
return enabled ? "enabled" : "disabled";
|
|
@@ -4541,12 +4586,12 @@ function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
|
|
|
4541
4586
|
}
|
|
4542
4587
|
}, "status");
|
|
4543
4588
|
return [
|
|
4544
|
-
`Because '${
|
|
4545
|
-
`To override this setting, you can ${status(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${
|
|
4589
|
+
`Because '${workersDevConfigFieldName}' is not in your ${configFile}, it will be ${status(afterEnabled, true)} for this deployment by default.`,
|
|
4590
|
+
`To override this setting, you can ${status(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${configFile}.`
|
|
4546
4591
|
].join("\n");
|
|
4547
4592
|
}
|
|
4548
4593
|
__name(renderWorkersDevDefaultWarning, "renderWorkersDevDefaultWarning");
|
|
4549
|
-
async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy) {
|
|
4594
|
+
async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy, configFile, previewUrlsConfigAssignment) {
|
|
4550
4595
|
const changed = after.workers_dev !== before.workers_dev || after.preview_urls !== before.preview_urls;
|
|
4551
4596
|
if (!changed) {
|
|
4552
4597
|
return after;
|
|
@@ -4571,7 +4616,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
|
|
|
4571
4616
|
"Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
|
|
4572
4617
|
` ${previewUrl}`,
|
|
4573
4618
|
"",
|
|
4574
|
-
`To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting
|
|
4619
|
+
`To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(false)}\` in your ${configFile}.`
|
|
4575
4620
|
].join("\n")
|
|
4576
4621
|
);
|
|
4577
4622
|
}
|
|
@@ -4582,7 +4627,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
|
|
|
4582
4627
|
"Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
|
|
4583
4628
|
` ${previewUrl}`,
|
|
4584
4629
|
"",
|
|
4585
|
-
`You may want to enable the Preview URLs as well by setting
|
|
4630
|
+
`You may want to enable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(true)}\` in your ${configFile}.`
|
|
4586
4631
|
].join("\n")
|
|
4587
4632
|
);
|
|
4588
4633
|
}
|
|
@@ -4591,6 +4636,10 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
|
|
|
4591
4636
|
__name(validateSubdomainMixedState, "validateSubdomainMixedState");
|
|
4592
4637
|
async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes, deployments, firstDeploy) {
|
|
4593
4638
|
const { config: config2 } = props;
|
|
4639
|
+
const displayConfigFileName = configFileName(
|
|
4640
|
+
config2.configPath,
|
|
4641
|
+
config2.userConfigPath
|
|
4642
|
+
);
|
|
4594
4643
|
const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config2.workers_dev, config2.preview_urls, routes);
|
|
4595
4644
|
const before = await getWorkerSubdomain(config2, accountId, scriptName);
|
|
4596
4645
|
if (wantWorkersDev) {
|
|
@@ -4618,7 +4667,15 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
|
|
|
4618
4667
|
logger
|
|
4619
4668
|
);
|
|
4620
4669
|
if (!firstDeploy && config2.workers_dev == void 0 && after.enabled !== before.enabled) {
|
|
4621
|
-
logger.warn(
|
|
4670
|
+
logger.warn(
|
|
4671
|
+
renderWorkersDevDefaultWarning(
|
|
4672
|
+
before.enabled,
|
|
4673
|
+
after.enabled,
|
|
4674
|
+
displayConfigFileName,
|
|
4675
|
+
props.workersDevConfigFieldName,
|
|
4676
|
+
props.workersDevConfigAssignment
|
|
4677
|
+
)
|
|
4678
|
+
);
|
|
4622
4679
|
}
|
|
4623
4680
|
if (!firstDeploy && config2.preview_urls == void 0 && after.previews_enabled !== before.previews_enabled) {
|
|
4624
4681
|
const status = /* @__PURE__ */ __name((enabled, past) => {
|
|
@@ -4630,8 +4687,8 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
|
|
|
4630
4687
|
}, "status");
|
|
4631
4688
|
logger.warn(
|
|
4632
4689
|
[
|
|
4633
|
-
`Because your 'workers.dev' route is ${status(after.enabled, true)} and your '
|
|
4634
|
-
`To override this setting, you can ${status(before.previews_enabled, false)} Preview URLs by explicitly setting '
|
|
4690
|
+
`Because your 'workers.dev' route is ${status(after.enabled, true)} and your '${props.previewUrlsConfigFieldName}' setting is not in your ${displayConfigFileName}, Preview URLs will be ${status(after.previews_enabled, true)} for this deployment by default.`,
|
|
4691
|
+
`To override this setting, you can ${status(before.previews_enabled, false)} Preview URLs by explicitly setting '${props.previewUrlsConfigAssignment(before.previews_enabled)}' in your ${displayConfigFileName}.`
|
|
4635
4692
|
].join("\n")
|
|
4636
4693
|
);
|
|
4637
4694
|
}
|
|
@@ -4640,7 +4697,9 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
|
|
|
4640
4697
|
{ workers_dev: before.enabled, preview_urls: before.previews_enabled },
|
|
4641
4698
|
{ workers_dev: after.enabled, preview_urls: after.previews_enabled },
|
|
4642
4699
|
before.preview_url_suffix,
|
|
4643
|
-
firstDeploy
|
|
4700
|
+
firstDeploy,
|
|
4701
|
+
displayConfigFileName,
|
|
4702
|
+
props.previewUrlsConfigAssignment
|
|
4644
4703
|
);
|
|
4645
4704
|
return {
|
|
4646
4705
|
wantWorkersDev,
|
|
@@ -6765,21 +6824,23 @@ __name(patchNonVersionedScriptSettings, "patchNonVersionedScriptSettings");
|
|
|
6765
6824
|
|
|
6766
6825
|
// src/deploy/helpers/confirm-latest-deployment-overwrite.ts
|
|
6767
6826
|
var BLANK_INPUT = "-";
|
|
6768
|
-
async function confirmLatestDeploymentOverwrite(config2, accountId, scriptName) {
|
|
6827
|
+
async function confirmLatestDeploymentOverwrite(config2, accountId, scriptName, deployCommand, versionsDeployCommand) {
|
|
6769
6828
|
return (await confirmLatestDeploymentOverwriteAndGetLatest(
|
|
6770
6829
|
config2,
|
|
6771
6830
|
accountId,
|
|
6772
|
-
scriptName
|
|
6831
|
+
scriptName,
|
|
6832
|
+
deployCommand,
|
|
6833
|
+
versionsDeployCommand
|
|
6773
6834
|
)).confirmed;
|
|
6774
6835
|
}
|
|
6775
6836
|
__name(confirmLatestDeploymentOverwrite, "confirmLatestDeploymentOverwrite");
|
|
6776
|
-
async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName) {
|
|
6837
|
+
async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName, deployCommand, versionsDeployCommand) {
|
|
6777
6838
|
try {
|
|
6778
6839
|
const latest = await fetchLatestDeployment(config2, accountId, scriptName);
|
|
6779
6840
|
if (latest && latest.versions.length >= 2) {
|
|
6780
6841
|
const versionCache = /* @__PURE__ */ new Map();
|
|
6781
6842
|
cli.warn(
|
|
6782
|
-
`Your last deployment has multiple versions. To progress that deployment use "${
|
|
6843
|
+
`Your last deployment has multiple versions. To progress that deployment use "${versionsDeployCommand}" instead.`,
|
|
6783
6844
|
{ shape: cli.shapes.corners.tl, newlineBefore: false }
|
|
6784
6845
|
);
|
|
6785
6846
|
cli.newline();
|
|
@@ -6793,7 +6854,7 @@ async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId,
|
|
|
6793
6854
|
);
|
|
6794
6855
|
const confirmed = await inputPrompt({
|
|
6795
6856
|
type: "confirm",
|
|
6796
|
-
question: `"${
|
|
6857
|
+
question: `"${deployCommand}" will upload a new version and deploy it globally immediately.
|
|
6797
6858
|
Are you sure you want to continue?`,
|
|
6798
6859
|
label: "",
|
|
6799
6860
|
defaultValue: isNonInteractiveOrCI(),
|
|
@@ -7098,7 +7159,12 @@ function validateApplicationIdentity(application, namespaceId, existing) {
|
|
|
7098
7159
|
}
|
|
7099
7160
|
}
|
|
7100
7161
|
__name(validateApplicationIdentity, "validateApplicationIdentity");
|
|
7101
|
-
async function validateImageLessContainerApplicationsForUpload(config2, containers, {
|
|
7162
|
+
async function validateImageLessContainerApplicationsForUpload(config2, containers, {
|
|
7163
|
+
accountId,
|
|
7164
|
+
scriptName,
|
|
7165
|
+
deployCommand,
|
|
7166
|
+
versionsUploadCommand
|
|
7167
|
+
}) {
|
|
7102
7168
|
const imageLessContainers = getResolvedDurableObjectContainerApps(
|
|
7103
7169
|
containers,
|
|
7104
7170
|
config2.exports
|
|
@@ -7123,7 +7189,7 @@ async function validateImageLessContainerApplicationsForUpload(config2, containe
|
|
|
7123
7189
|
}
|
|
7124
7190
|
if (namespace === void 0 || existing === void 0) {
|
|
7125
7191
|
throw new UserError(
|
|
7126
|
-
`Container "${container.name}" has no named images and has not been provisioned. Run \`${
|
|
7192
|
+
`Container "${container.name}" has no named images and has not been provisioned. Run \`${deployCommand}\` to create its Durable Object-managed application before using \`${versionsUploadCommand}\`, or configure at least one named image.`,
|
|
7127
7193
|
{
|
|
7128
7194
|
telemetryMessage: "versions upload image less container application missing"
|
|
7129
7195
|
}
|
|
@@ -7299,12 +7365,14 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
|
|
|
7299
7365
|
dryRun,
|
|
7300
7366
|
scriptName,
|
|
7301
7367
|
dispatchNamespace,
|
|
7302
|
-
requireExistingImageLessApplications = false
|
|
7368
|
+
requireExistingImageLessApplications = false,
|
|
7369
|
+
deployCommand,
|
|
7370
|
+
versionsUploadCommand
|
|
7303
7371
|
}) {
|
|
7304
7372
|
validateDurableObjectContainerApplications(
|
|
7305
7373
|
config2,
|
|
7306
7374
|
durableObjectContainerConfig,
|
|
7307
|
-
|
|
7375
|
+
configFileName(config2.configPath, config2.userConfigPath)
|
|
7308
7376
|
);
|
|
7309
7377
|
const managedContainers = getResolvedDurableObjectContainerApps(
|
|
7310
7378
|
durableObjectContainerConfig,
|
|
@@ -7337,10 +7405,15 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
|
|
|
7337
7405
|
}
|
|
7338
7406
|
if (!dryRun && requireExistingImageLessApplications) {
|
|
7339
7407
|
assert6(accountId);
|
|
7408
|
+
assert6(deployCommand, "Expected deploy command for versions upload");
|
|
7409
|
+
assert6(
|
|
7410
|
+
versionsUploadCommand,
|
|
7411
|
+
"Expected versions upload command for versions upload"
|
|
7412
|
+
);
|
|
7340
7413
|
await validateImageLessContainerApplicationsForUpload(
|
|
7341
7414
|
config2,
|
|
7342
7415
|
durableObjectContainerConfig,
|
|
7343
|
-
{ accountId, scriptName }
|
|
7416
|
+
{ accountId, scriptName, deployCommand, versionsUploadCommand }
|
|
7344
7417
|
);
|
|
7345
7418
|
}
|
|
7346
7419
|
const containers = managedContainers.filter(
|
|
@@ -7434,7 +7507,7 @@ function applyServiceAndEnvironmentTags(config2, tags) {
|
|
|
7434
7507
|
const shouldApplyTags = hasDefinedEnvironments(config2);
|
|
7435
7508
|
if (shouldApplyTags && !serviceName) {
|
|
7436
7509
|
logger.warn(
|
|
7437
|
-
`No top-level \`name\` has been defined in your ${
|
|
7510
|
+
`No top-level \`name\` has been defined in your ${configFileName(config2.configPath, config2.userConfigPath)}. Add a top-level \`name\` to group this Worker together with its sibling environments in the Cloudflare dashboard.`
|
|
7438
7511
|
);
|
|
7439
7512
|
}
|
|
7440
7513
|
const serviceTag = shouldApplyTags && serviceName ? `${SERVICE_TAG_PREFIX}${serviceName}` : null;
|
|
@@ -8367,6 +8440,18 @@ var KVHandler = class extends ProvisionResourceHandler {
|
|
|
8367
8440
|
}
|
|
8368
8441
|
};
|
|
8369
8442
|
var D1Handler = class extends ProvisionResourceHandler {
|
|
8443
|
+
constructor(bindingName, binding, complianceConfig, accountId, d1ListCommand, d1DeleteCommand) {
|
|
8444
|
+
super(
|
|
8445
|
+
"d1",
|
|
8446
|
+
bindingName,
|
|
8447
|
+
binding,
|
|
8448
|
+
"database_id",
|
|
8449
|
+
complianceConfig,
|
|
8450
|
+
accountId
|
|
8451
|
+
);
|
|
8452
|
+
this.d1ListCommand = d1ListCommand;
|
|
8453
|
+
this.d1DeleteCommand = d1DeleteCommand;
|
|
8454
|
+
}
|
|
8370
8455
|
static {
|
|
8371
8456
|
__name(this, "D1Handler");
|
|
8372
8457
|
}
|
|
@@ -8377,20 +8462,12 @@ var D1Handler = class extends ProvisionResourceHandler {
|
|
|
8377
8462
|
const db = await createD1Database(
|
|
8378
8463
|
this.complianceConfig,
|
|
8379
8464
|
this.accountId,
|
|
8380
|
-
name
|
|
8465
|
+
name,
|
|
8466
|
+
this.d1ListCommand,
|
|
8467
|
+
this.d1DeleteCommand
|
|
8381
8468
|
);
|
|
8382
8469
|
return db.uuid;
|
|
8383
8470
|
}
|
|
8384
|
-
constructor(bindingName, binding, complianceConfig, accountId) {
|
|
8385
|
-
super(
|
|
8386
|
-
"d1",
|
|
8387
|
-
bindingName,
|
|
8388
|
-
binding,
|
|
8389
|
-
"database_id",
|
|
8390
|
-
complianceConfig,
|
|
8391
|
-
accountId
|
|
8392
|
-
);
|
|
8393
|
-
}
|
|
8394
8471
|
async canInherit(settings) {
|
|
8395
8472
|
const maybeInherited = settings?.bindings.find(
|
|
8396
8473
|
(existing) => existing.type === this.type && existing.name === this.bindingName
|
|
@@ -8725,12 +8802,19 @@ function isProvisionableBinding(binding) {
|
|
|
8725
8802
|
return binding.type in HANDLERS;
|
|
8726
8803
|
}
|
|
8727
8804
|
__name(isProvisionableBinding, "isProvisionableBinding");
|
|
8728
|
-
function createHandler(bindingName, binding, complianceConfig, accountId) {
|
|
8805
|
+
function createHandler(bindingName, binding, complianceConfig, accountId, d1ListCommand, d1DeleteCommand) {
|
|
8729
8806
|
switch (binding.type) {
|
|
8730
8807
|
case "kv_namespace":
|
|
8731
8808
|
return new KVHandler(bindingName, binding, complianceConfig, accountId);
|
|
8732
8809
|
case "d1":
|
|
8733
|
-
return new D1Handler(
|
|
8810
|
+
return new D1Handler(
|
|
8811
|
+
bindingName,
|
|
8812
|
+
binding,
|
|
8813
|
+
complianceConfig,
|
|
8814
|
+
accountId,
|
|
8815
|
+
d1ListCommand,
|
|
8816
|
+
d1DeleteCommand
|
|
8817
|
+
);
|
|
8734
8818
|
case "r2_bucket":
|
|
8735
8819
|
return new R2Handler(bindingName, binding, complianceConfig, accountId);
|
|
8736
8820
|
case "ai_search_namespace":
|
|
@@ -8792,7 +8876,7 @@ function toConfigBinding(bindingName, binding) {
|
|
|
8792
8876
|
}
|
|
8793
8877
|
}
|
|
8794
8878
|
__name(toConfigBinding, "toConfigBinding");
|
|
8795
|
-
async function collectPendingResources(complianceConfig, accountId, scriptName, bindings) {
|
|
8879
|
+
async function collectPendingResources(complianceConfig, accountId, scriptName, bindings, d1ListCommand, d1DeleteCommand) {
|
|
8796
8880
|
let settings;
|
|
8797
8881
|
try {
|
|
8798
8882
|
settings = await getSettings(complianceConfig, accountId, scriptName);
|
|
@@ -8810,7 +8894,9 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
|
|
|
8810
8894
|
bindingName,
|
|
8811
8895
|
binding,
|
|
8812
8896
|
complianceConfig,
|
|
8813
|
-
accountId
|
|
8897
|
+
accountId,
|
|
8898
|
+
d1ListCommand,
|
|
8899
|
+
d1DeleteCommand
|
|
8814
8900
|
);
|
|
8815
8901
|
const resource = {
|
|
8816
8902
|
binding: bindingName,
|
|
@@ -8846,7 +8932,14 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
|
|
|
8846
8932
|
__name(collectPendingResources, "collectPendingResources");
|
|
8847
8933
|
async function provisionBindings(bindings, accountId, scriptName, autoCreate, config2, options) {
|
|
8848
8934
|
const configPath = config2.userConfigPath ?? config2.configPath;
|
|
8849
|
-
const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(
|
|
8935
|
+
const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(
|
|
8936
|
+
config2,
|
|
8937
|
+
accountId,
|
|
8938
|
+
scriptName,
|
|
8939
|
+
bindings,
|
|
8940
|
+
options.d1ListCommand,
|
|
8941
|
+
options.d1DeleteCommand
|
|
8942
|
+
);
|
|
8850
8943
|
if (pendingResources.length > 0) {
|
|
8851
8944
|
assert6(
|
|
8852
8945
|
configPath,
|
|
@@ -9085,7 +9178,7 @@ async function listFlagshipApps(complianceConfig, accountId) {
|
|
|
9085
9178
|
);
|
|
9086
9179
|
}
|
|
9087
9180
|
__name(listFlagshipApps, "listFlagshipApps");
|
|
9088
|
-
async function createD1Database(complianceConfig, accountId, name) {
|
|
9181
|
+
async function createD1Database(complianceConfig, accountId, name, d1ListCommand, d1DeleteCommand) {
|
|
9089
9182
|
try {
|
|
9090
9183
|
return await fetchResult(
|
|
9091
9184
|
complianceConfig,
|
|
@@ -9106,15 +9199,18 @@ async function createD1Database(complianceConfig, accountId, name) {
|
|
|
9106
9199
|
});
|
|
9107
9200
|
}
|
|
9108
9201
|
if (errorCode === 7406) {
|
|
9109
|
-
throw new UserError(
|
|
9110
|
-
|
|
9111
|
-
|
|
9202
|
+
throw new UserError(
|
|
9203
|
+
renderD1DatabaseLimitError(accountId, d1ListCommand, d1DeleteCommand),
|
|
9204
|
+
{
|
|
9205
|
+
telemetryMessage: "d1 create database limit reached"
|
|
9206
|
+
}
|
|
9207
|
+
);
|
|
9112
9208
|
}
|
|
9113
9209
|
throw e;
|
|
9114
9210
|
}
|
|
9115
9211
|
}
|
|
9116
9212
|
__name(createD1Database, "createD1Database");
|
|
9117
|
-
function renderD1DatabaseLimitError(accountId) {
|
|
9213
|
+
function renderD1DatabaseLimitError(accountId, d1ListCommand, d1DeleteCommand) {
|
|
9118
9214
|
return esm_default`
|
|
9119
9215
|
You have reached the maximum number of D1 databases for your account.
|
|
9120
9216
|
|
|
@@ -9125,8 +9221,8 @@ function renderD1DatabaseLimitError(accountId) {
|
|
|
9125
9221
|
https://developers.cloudflare.com/d1/
|
|
9126
9222
|
|
|
9127
9223
|
Or free up space:
|
|
9128
|
-
To list your existing databases, run: ${
|
|
9129
|
-
To delete a database, run: ${
|
|
9224
|
+
To list your existing databases, run: ${d1ListCommand}
|
|
9225
|
+
To delete a database, run: ${d1DeleteCommand}
|
|
9130
9226
|
`;
|
|
9131
9227
|
}
|
|
9132
9228
|
__name(renderD1DatabaseLimitError, "renderD1DatabaseLimitError");
|
|
@@ -9277,9 +9373,9 @@ function addRequiredSecretsInheritBindings(config2, bindings, options) {
|
|
|
9277
9373
|
if (options.type === "deploy" && !options.workerExists) {
|
|
9278
9374
|
throw new UserError(
|
|
9279
9375
|
`The following required secrets have not been set: ${inheritedSecrets.join(", ")}
|
|
9280
|
-
This Worker does not exist yet, so secrets cannot be set in advance with \`${
|
|
9376
|
+
This Worker does not exist yet, so secrets cannot be set in advance with \`${options.secretPutCommand}\`.
|
|
9281
9377
|
To deploy a new Worker with secrets, supply them via a secrets file:
|
|
9282
|
-
${
|
|
9378
|
+
${options.uploadCommand} --secrets-file <path-to-file>
|
|
9283
9379
|
where the file contains lines in the format \`SECRET_NAME=value\` (or JSON).
|
|
9284
9380
|
See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
|
|
9285
9381
|
{ telemetryMessage: "required secrets missing before first deploy" }
|
|
@@ -9297,12 +9393,11 @@ function handleMissingSecretsError(err, config2, options) {
|
|
|
9297
9393
|
const missingSecretNames = err.notes.map((note) => note.text.match(/^inherit binding '(.+?)' is invalid/)).filter((match) => match !== null).map((match) => match[1]).filter((secretName) => config2.secrets?.required?.includes(secretName));
|
|
9298
9394
|
if (missingSecretNames.length > 0) {
|
|
9299
9395
|
err.preventReport();
|
|
9300
|
-
const
|
|
9301
|
-
const secretsFileCommand = `${options.type === "deploy" ? cliPresentation.commands.deploy : cliPresentation.commands.versionsUpload} --secrets-file <path-to-file>`;
|
|
9396
|
+
const secretsFileCommand = `${options.uploadCommand} --secrets-file <path-to-file>`;
|
|
9302
9397
|
const action = options.type === "deploy" ? "deploying" : "uploading";
|
|
9303
9398
|
throw new UserError(
|
|
9304
9399
|
`The following required secrets have not been set: ${missingSecretNames.join(", ")}
|
|
9305
|
-
Use \`${secretPutCommand} <NAME>\` to set secrets before ${action},
|
|
9400
|
+
Use \`${options.secretPutCommand} <NAME>\` to set secrets before ${action},
|
|
9306
9401
|
or supply them when ${action} with \`${secretsFileCommand}\`.
|
|
9307
9402
|
See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
|
|
9308
9403
|
{ telemetryMessage: "required secrets missing during upload or deploy" }
|
|
@@ -30101,7 +30196,7 @@ async function checkWorkflowConflicts(config2, accountId, scriptName) {
|
|
|
30101
30196
|
const message = `The following workflow(s) already exist and belong to different workers:
|
|
30102
30197
|
${conflictList}
|
|
30103
30198
|
|
|
30104
|
-
Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${
|
|
30199
|
+
Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${configFileName(config2.configPath, config2.userConfigPath)}.`;
|
|
30105
30200
|
return { hasConflicts: true, conflicts, message };
|
|
30106
30201
|
}
|
|
30107
30202
|
__name(checkWorkflowConflicts, "checkWorkflowConflicts");
|
|
@@ -30780,7 +30875,7 @@ async function verifyWorkerMatchesCITag(complianceConfig, accountId, workerName,
|
|
|
30780
30875
|
);
|
|
30781
30876
|
} else {
|
|
30782
30877
|
throw new FatalError(
|
|
30783
|
-
|
|
30878
|
+
"The Worker name could not be validated against what is expected by the build system. Please retry the build. If the problem persists, please contact support.",
|
|
30784
30879
|
{ telemetryMessage: "ci match tag validation failed" }
|
|
30785
30880
|
);
|
|
30786
30881
|
}
|
|
@@ -31005,7 +31100,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
31005
31100
|
return { ...props, name };
|
|
31006
31101
|
}
|
|
31007
31102
|
__name(validateWorkerProps, "validateWorkerProps");
|
|
31008
|
-
async function preUploadApiChecks(props, config2) {
|
|
31103
|
+
async function preUploadApiChecks(props, config2, queueCreateCommand) {
|
|
31009
31104
|
const { accountId, name } = props;
|
|
31010
31105
|
if (props.dryRun || !accountId || !name) {
|
|
31011
31106
|
return {
|
|
@@ -31045,7 +31140,7 @@ async function preUploadApiChecks(props, config2) {
|
|
|
31045
31140
|
tags = script.tags ?? tags;
|
|
31046
31141
|
if (props.command === "deploy" && props.failIfWorkerNameTaken) {
|
|
31047
31142
|
throw new UserError(
|
|
31048
|
-
`A Worker named "${name}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${
|
|
31143
|
+
`A Worker named "${name}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${configFileName(config2.configPath, config2.userConfigPath)} that names "${name}"; to deploy separately, use a different name.`,
|
|
31049
31144
|
{ telemetryMessage: "deploy unverified worker name already exists" }
|
|
31050
31145
|
);
|
|
31051
31146
|
}
|
|
@@ -31138,7 +31233,8 @@ Edits that have been made via the script API will be overridden by your local co
|
|
|
31138
31233
|
config2,
|
|
31139
31234
|
accountId,
|
|
31140
31235
|
!props.resourcesProvision,
|
|
31141
|
-
name
|
|
31236
|
+
name,
|
|
31237
|
+
queueCreateCommand
|
|
31142
31238
|
);
|
|
31143
31239
|
const wantsWorkersDev = props.command === "deploy" && props.dispatchNamespace === void 0 && getSubdomainValues(config2.workers_dev, config2.preview_urls, props.routes).workers_dev;
|
|
31144
31240
|
if (!workerExists && wantsWorkersDev) {
|
|
@@ -31171,8 +31267,8 @@ function addWorkersSitesBindings(bindings, namespace, manifest, format) {
|
|
|
31171
31267
|
__name(addWorkersSitesBindings, "addWorkersSitesBindings");
|
|
31172
31268
|
|
|
31173
31269
|
// src/deploy/deploy.ts
|
|
31174
|
-
async function deploy(props, config2, buildResult,
|
|
31175
|
-
const result = await deployWorker(props, config2, buildResult,
|
|
31270
|
+
async function deploy(props, config2, buildResult, options) {
|
|
31271
|
+
const result = await deployWorker(props, config2, buildResult, options);
|
|
31176
31272
|
writeOutput({
|
|
31177
31273
|
type: "deploy",
|
|
31178
31274
|
version: 1,
|
|
@@ -31190,13 +31286,14 @@ async function deploy(props, config2, buildResult, callbacks) {
|
|
|
31190
31286
|
return result;
|
|
31191
31287
|
}
|
|
31192
31288
|
__name(deploy, "deploy");
|
|
31193
|
-
async function deployWorker(props, config2, buildResult,
|
|
31289
|
+
async function deployWorker(props, config2, buildResult, options) {
|
|
31194
31290
|
const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
|
|
31195
31291
|
const assetsOptions = resolveAssetOptions(props, config2);
|
|
31196
31292
|
const { name } = validateWorkerProps({ ...props, assetsOptions }, config2);
|
|
31197
31293
|
const { workerTag, tags, workerExists, aborted: aborted2 } = await preUploadApiChecks(
|
|
31198
31294
|
props,
|
|
31199
|
-
config2
|
|
31295
|
+
config2,
|
|
31296
|
+
options.queueCreateCommand
|
|
31200
31297
|
);
|
|
31201
31298
|
if (aborted2) {
|
|
31202
31299
|
return { versionId: null, workerTag };
|
|
@@ -31213,7 +31310,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31213
31310
|
const confirmation = await confirmLatestDeploymentOverwriteAndGetLatest(
|
|
31214
31311
|
config2,
|
|
31215
31312
|
accountId,
|
|
31216
|
-
scriptName
|
|
31313
|
+
scriptName,
|
|
31314
|
+
options.deployCommand,
|
|
31315
|
+
options.versionsDeployCommand
|
|
31217
31316
|
);
|
|
31218
31317
|
latestDeployment = confirmation.latestDeployment;
|
|
31219
31318
|
if (!confirmation.confirmed) {
|
|
@@ -31282,7 +31381,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31282
31381
|
if (assetsOptions && isDryRun) {
|
|
31283
31382
|
await buildAssetManifest(assetsOptions.directory);
|
|
31284
31383
|
}
|
|
31285
|
-
const workersSitesAssets =
|
|
31384
|
+
const workersSitesAssets = options.syncWorkersSite ? await options.syncWorkersSite(
|
|
31286
31385
|
config2,
|
|
31287
31386
|
accountId,
|
|
31288
31387
|
scriptName,
|
|
@@ -31314,7 +31413,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31314
31413
|
}
|
|
31315
31414
|
addRequiredSecretsInheritBindings(config2, bindings, {
|
|
31316
31415
|
type: "deploy",
|
|
31317
|
-
workerExists
|
|
31416
|
+
workerExists,
|
|
31417
|
+
secretPutCommand: options.secretPutCommand,
|
|
31418
|
+
uploadCommand: options.deployCommand
|
|
31318
31419
|
});
|
|
31319
31420
|
if (workersSitesAssets.manifest) {
|
|
31320
31421
|
modules.push({
|
|
@@ -31418,7 +31519,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31418
31519
|
props.experimentalAutoCreate,
|
|
31419
31520
|
config2,
|
|
31420
31521
|
{
|
|
31421
|
-
skipConfigWriteback: props.skipProvisioningConfigWriteback
|
|
31522
|
+
skipConfigWriteback: props.skipProvisioningConfigWriteback,
|
|
31523
|
+
d1ListCommand: options.d1ListCommand,
|
|
31524
|
+
d1DeleteCommand: options.d1DeleteCommand
|
|
31422
31525
|
}
|
|
31423
31526
|
);
|
|
31424
31527
|
}
|
|
@@ -31584,18 +31687,21 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31584
31687
|
workerBundle,
|
|
31585
31688
|
projectRoot,
|
|
31586
31689
|
// eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
|
|
31587
|
-
|
|
31690
|
+
options.analyseBundle
|
|
31588
31691
|
);
|
|
31589
31692
|
if (message !== null) {
|
|
31590
31693
|
logger.error(message);
|
|
31591
31694
|
}
|
|
31592
31695
|
handleMissingSecretsError(err, config2, {
|
|
31593
|
-
type: "deploy"
|
|
31696
|
+
type: "deploy",
|
|
31697
|
+
secretPutCommand: options.secretPutCommand,
|
|
31698
|
+
uploadCommand: options.deployCommand
|
|
31699
|
+
});
|
|
31594
31700
|
if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
|
31595
31701
|
err.preventReport();
|
|
31596
31702
|
if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
|
|
31597
31703
|
throw new UserError(
|
|
31598
|
-
`You must use a real database in the database_id configuration. You can find your databases using '${
|
|
31704
|
+
`You must use a real database in the database_id configuration. You can find your databases using '${options.d1ListCommand}', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`,
|
|
31599
31705
|
{ telemetryMessage: "deploy d1 database binding invalid id" }
|
|
31600
31706
|
);
|
|
31601
31707
|
}
|
|
@@ -31635,7 +31741,6 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31635
31741
|
if (shouldDeployContainers) {
|
|
31636
31742
|
assert6(versionId && accountId);
|
|
31637
31743
|
initContainersSharedContext({
|
|
31638
|
-
cliPresentation,
|
|
31639
31744
|
logger,
|
|
31640
31745
|
fetchPagedListResult,
|
|
31641
31746
|
fetchResult
|
|
@@ -31674,7 +31779,10 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31674
31779
|
versionId,
|
|
31675
31780
|
accountId,
|
|
31676
31781
|
scriptName,
|
|
31677
|
-
dispatchNamespace: props.dispatchNamespace
|
|
31782
|
+
dispatchNamespace: props.dispatchNamespace,
|
|
31783
|
+
configFileName: options.configFileName,
|
|
31784
|
+
observabilityTargetPercentageField: options.observabilityTargetPercentageField,
|
|
31785
|
+
observabilityTargetCountField: options.observabilityTargetCountField
|
|
31678
31786
|
}
|
|
31679
31787
|
);
|
|
31680
31788
|
}
|
|
@@ -31693,7 +31801,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31693
31801
|
);
|
|
31694
31802
|
} catch (error62) {
|
|
31695
31803
|
throw new UserError(
|
|
31696
|
-
`The Worker version was deployed, but
|
|
31804
|
+
`The Worker version was deployed, but its Durable Object-managed Container application settings were not fully applied. Re-run the same \`${options.deployCommand}\` command to retry and finish deployment.`,
|
|
31697
31805
|
{
|
|
31698
31806
|
telemetryMessage: "deploy durable object container application creation failed after deployment",
|
|
31699
31807
|
cause: error62
|
|
@@ -31715,7 +31823,12 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
31715
31823
|
firstDeploy: !workerExists,
|
|
31716
31824
|
routes: props.routes,
|
|
31717
31825
|
validated: true,
|
|
31718
|
-
dryRun: false
|
|
31826
|
+
dryRun: false,
|
|
31827
|
+
queueCreateCommand: options.queueCreateCommand,
|
|
31828
|
+
workersDevConfigFieldName: options.workersDevConfigFieldName,
|
|
31829
|
+
workersDevConfigAssignment: options.workersDevConfigAssignment,
|
|
31830
|
+
previewUrlsConfigFieldName: options.previewUrlsConfigFieldName,
|
|
31831
|
+
previewUrlsConfigAssignment: options.previewUrlsConfigAssignment
|
|
31719
31832
|
});
|
|
31720
31833
|
logger.log("Current Version ID:", versionId);
|
|
31721
31834
|
return {
|
|
@@ -31740,13 +31853,8 @@ function renderBindingDependsOnExportError(serverMessage) {
|
|
|
31740
31853
|
__name(renderBindingDependsOnExportError, "renderBindingDependsOnExportError");
|
|
31741
31854
|
|
|
31742
31855
|
// src/deploy/versions-upload.ts
|
|
31743
|
-
async function versionsUpload(props, config2, buildResult,
|
|
31744
|
-
const result = await uploadWorkerVersion(
|
|
31745
|
-
props,
|
|
31746
|
-
config2,
|
|
31747
|
-
buildResult,
|
|
31748
|
-
callbacks
|
|
31749
|
-
);
|
|
31856
|
+
async function versionsUpload(props, config2, buildResult, options) {
|
|
31857
|
+
const result = await uploadWorkerVersion(props, config2, buildResult, options);
|
|
31750
31858
|
writeOutput({
|
|
31751
31859
|
type: "version-upload",
|
|
31752
31860
|
version: 1,
|
|
@@ -31765,11 +31873,15 @@ async function versionsUpload(props, config2, buildResult, callbacks = {}) {
|
|
|
31765
31873
|
return result;
|
|
31766
31874
|
}
|
|
31767
31875
|
__name(versionsUpload, "versionsUpload");
|
|
31768
|
-
async function uploadWorkerVersion(props, config2, buildResult,
|
|
31876
|
+
async function uploadWorkerVersion(props, config2, buildResult, options) {
|
|
31769
31877
|
const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
|
|
31770
31878
|
const assetsOptions = resolveAssetOptions(props, config2);
|
|
31771
31879
|
const { name } = validateWorkerProps(props, config2);
|
|
31772
|
-
const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(
|
|
31880
|
+
const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(
|
|
31881
|
+
props,
|
|
31882
|
+
config2,
|
|
31883
|
+
options.queueCreateCommand
|
|
31884
|
+
);
|
|
31773
31885
|
if (aborted2) {
|
|
31774
31886
|
return { versionId: null, workerTag };
|
|
31775
31887
|
}
|
|
@@ -31805,7 +31917,7 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
31805
31917
|
});
|
|
31806
31918
|
if (migrations !== void 0) {
|
|
31807
31919
|
throw new UserError(
|
|
31808
|
-
`This Worker has a pending Durable Object migration, which cannot be applied by \`${
|
|
31920
|
+
`This Worker has a pending Durable Object migration, which cannot be applied by \`${options.versionsUploadCommand}\`. Durable Object migrations must be applied with \`${options.deployCommand}\`. Run \`${options.deployCommand}\` to apply the migration, then retry \`${options.versionsUploadCommand}\`.`,
|
|
31809
31921
|
{ telemetryMessage: "versions upload pending durable object migration" }
|
|
31810
31922
|
);
|
|
31811
31923
|
}
|
|
@@ -31820,7 +31932,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
31820
31932
|
accountId,
|
|
31821
31933
|
dryRun: Boolean(props.dryRun),
|
|
31822
31934
|
scriptName,
|
|
31823
|
-
requireExistingImageLessApplications: true
|
|
31935
|
+
requireExistingImageLessApplications: true,
|
|
31936
|
+
deployCommand: options.deployCommand,
|
|
31937
|
+
versionsUploadCommand: options.versionsUploadCommand
|
|
31824
31938
|
}
|
|
31825
31939
|
);
|
|
31826
31940
|
const assetsUploadResult = assetsOptions && !props.dryRun ? await syncAssets(config2, accountId, assetsOptions.directory, scriptName) : void 0;
|
|
@@ -31918,7 +32032,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
31918
32032
|
props.experimentalAutoCreate,
|
|
31919
32033
|
config2,
|
|
31920
32034
|
{
|
|
31921
|
-
skipConfigWriteback: props.skipProvisioningConfigWriteback
|
|
32035
|
+
skipConfigWriteback: props.skipProvisioningConfigWriteback,
|
|
32036
|
+
d1ListCommand: options.d1ListCommand,
|
|
32037
|
+
d1DeleteCommand: options.d1DeleteCommand
|
|
31922
32038
|
}
|
|
31923
32039
|
);
|
|
31924
32040
|
}
|
|
@@ -31973,12 +32089,16 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
31973
32089
|
workerBundle,
|
|
31974
32090
|
projectRoot,
|
|
31975
32091
|
// eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
|
|
31976
|
-
|
|
32092
|
+
options.analyseBundle
|
|
31977
32093
|
);
|
|
31978
32094
|
if (message) {
|
|
31979
32095
|
logger.error(message);
|
|
31980
32096
|
}
|
|
31981
|
-
handleMissingSecretsError(err, config2, {
|
|
32097
|
+
handleMissingSecretsError(err, config2, {
|
|
32098
|
+
type: "upload",
|
|
32099
|
+
secretPutCommand: options.versionsSecretPutCommand,
|
|
32100
|
+
uploadCommand: options.versionsUploadCommand
|
|
32101
|
+
});
|
|
31982
32102
|
if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
|
31983
32103
|
const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
|
|
31984
32104
|
if (bundleType === "commonjs") {
|
|
@@ -32058,8 +32178,8 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
32058
32178
|
}
|
|
32059
32179
|
}
|
|
32060
32180
|
}
|
|
32061
|
-
const cmdVersionsDeploy = blue(
|
|
32062
|
-
const cmdTriggersDeploy = blue(
|
|
32181
|
+
const cmdVersionsDeploy = blue(options.versionsDeployCommand);
|
|
32182
|
+
const cmdTriggersDeploy = blue(options.triggersDeployCommand);
|
|
32063
32183
|
logger.info(
|
|
32064
32184
|
gray(`
|
|
32065
32185
|
To deploy this version to production traffic use the command ${cmdVersionsDeploy}
|
|
@@ -32196,7 +32316,7 @@ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibili
|
|
|
32196
32316
|
}
|
|
32197
32317
|
if (noBundle && hasNodejsCompatV2Flag) {
|
|
32198
32318
|
logger.warn(
|
|
32199
|
-
|
|
32319
|
+
"`nodejs_compat_v2` compatibility flag and `--no-bundle` can't be used together. If you want to polyfill Node.js built-ins while disabling bundling, please polyfill as part of your own bundling process."
|
|
32200
32320
|
);
|
|
32201
32321
|
}
|
|
32202
32322
|
return mode;
|
|
@@ -32204,7 +32324,7 @@ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibili
|
|
|
32204
32324
|
__name(validateNodeCompatMode, "validateNodeCompatMode");
|
|
32205
32325
|
|
|
32206
32326
|
// src/deploy/helpers/inconsistent-exports.ts
|
|
32207
|
-
function renderInconsistentExportsAcrossVersionsError(serverMessage) {
|
|
32327
|
+
function renderInconsistentExportsAcrossVersionsError(serverMessage, versionsDeployAt100Command) {
|
|
32208
32328
|
return [
|
|
32209
32329
|
serverMessage,
|
|
32210
32330
|
"",
|
|
@@ -32212,7 +32332,7 @@ function renderInconsistentExportsAcrossVersionsError(serverMessage) {
|
|
|
32212
32332
|
"",
|
|
32213
32333
|
"What to do:",
|
|
32214
32334
|
" 1. Deploy the version that changes `exports` at 100% first:",
|
|
32215
|
-
` ${
|
|
32335
|
+
` ${versionsDeployAt100Command}`,
|
|
32216
32336
|
" 2. Once that deploy is stable, run your percentage-split deploy.",
|
|
32217
32337
|
"",
|
|
32218
32338
|
"Learn more: https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#gradual-deployments-for-durable-objects"
|
|
@@ -33032,9 +33152,9 @@ function getPreviewExports(exports$1) {
|
|
|
33032
33152
|
return previewExports;
|
|
33033
33153
|
}
|
|
33034
33154
|
__name(getPreviewExports, "getPreviewExports");
|
|
33035
|
-
async function prepareContainersForPreview(config2, workerName, previewSlug,
|
|
33155
|
+
async function prepareContainersForPreview(config2, workerName, previewSlug, options, localImageReferences) {
|
|
33036
33156
|
const previewContainers = config2.previews?.containers ?? [];
|
|
33037
|
-
if (previewContainers.length === 0 || !
|
|
33157
|
+
if (previewContainers.length === 0 || !options.getNormalizedContainerOptions) {
|
|
33038
33158
|
return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
|
|
33039
33159
|
}
|
|
33040
33160
|
const scopedContainerConfig = buildPreviewContainerConfig(
|
|
@@ -33046,9 +33166,12 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
|
|
|
33046
33166
|
if (!scopedContainerConfig) {
|
|
33047
33167
|
return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
|
|
33048
33168
|
}
|
|
33049
|
-
const normalisedContainerConfig = await
|
|
33050
|
-
|
|
33051
|
-
|
|
33169
|
+
const normalisedContainerConfig = await options.getNormalizedContainerOptions(
|
|
33170
|
+
scopedContainerConfig,
|
|
33171
|
+
{
|
|
33172
|
+
dryRun: false
|
|
33173
|
+
}
|
|
33174
|
+
);
|
|
33052
33175
|
const containersNeedingDocker = normalisedContainerConfig.filter(
|
|
33053
33176
|
(container) => "dockerfile" in container
|
|
33054
33177
|
);
|
|
@@ -33060,8 +33183,8 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
|
|
|
33060
33183
|
hint: 'If you cannot run Docker locally, set "image" to a prebuilt registry image instead of a Dockerfile path for the affected entries in "previews.containers".'
|
|
33061
33184
|
});
|
|
33062
33185
|
}
|
|
33063
|
-
if (
|
|
33064
|
-
await
|
|
33186
|
+
if (options.verifyContainersScope) {
|
|
33187
|
+
await options.verifyContainersScope(scopedContainerConfig);
|
|
33065
33188
|
}
|
|
33066
33189
|
return { scopedContainerConfig, normalisedContainerConfig };
|
|
33067
33190
|
}
|
|
@@ -33082,7 +33205,7 @@ function formatPreviewConfigUpdate(config2, update) {
|
|
|
33082
33205
|
).trimEnd();
|
|
33083
33206
|
}
|
|
33084
33207
|
__name(formatPreviewConfigUpdate, "formatPreviewConfigUpdate");
|
|
33085
|
-
function formatNoActivePreviewUrlsMessage(config2) {
|
|
33208
|
+
function formatNoActivePreviewUrlsMessage(config2, deployCommand = "your deploy command", previewCommand = "the preview command") {
|
|
33086
33209
|
const customDomainRouteEntries = (config2.routes ?? []).filter(isCustomDomainRoute).map((route) => ({ route, singular: false }));
|
|
33087
33210
|
if (config2.route && isCustomDomainRoute(config2.route)) {
|
|
33088
33211
|
customDomainRouteEntries.push({ route: config2.route, singular: true });
|
|
@@ -33132,7 +33255,7 @@ function formatNoActivePreviewUrlsMessage(config2) {
|
|
|
33132
33255
|
}
|
|
33133
33256
|
const workersDevAlreadyConfigured = config2.preview_urls === true;
|
|
33134
33257
|
const customDomainAlreadyConfigured = customDomainRoute?.previews_enabled === true;
|
|
33135
|
-
const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${
|
|
33258
|
+
const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${deployCommand}\` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running \`${deployCommand}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand}\` again.` : `Caution: \`${deployCommand}\` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run \`${deployCommand}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand}\` again.`;
|
|
33136
33259
|
let workersDevInstruction = `Add this to your ${configName}:`;
|
|
33137
33260
|
if (config2.preview_urls === true) {
|
|
33138
33261
|
workersDevInstruction = `Your ${configName} already contains:`;
|
|
@@ -33388,7 +33511,7 @@ function formatUrlLines(label, urls) {
|
|
|
33388
33511
|
];
|
|
33389
33512
|
}
|
|
33390
33513
|
__name(formatUrlLines, "formatUrlLines");
|
|
33391
|
-
function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest) {
|
|
33514
|
+
function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest, deployCommand, previewCommand) {
|
|
33392
33515
|
const statusLabel = isNew ? chalk6.green("(new)") : chalk6.dim("(updated)");
|
|
33393
33516
|
const pullRequestUrl = deployment.annotations?.["workers/pull_request_url"] ?? pullRequest?.url;
|
|
33394
33517
|
const pullRequestNumber = deployment.annotations?.["workers/pull_request_number"] ?? pullRequest?.number;
|
|
@@ -33400,7 +33523,13 @@ function formatPreviewDeploymentSummary(config2, previewResource, deployment, is
|
|
|
33400
33523
|
`${chalk6.bold("Pull Request:")} ${pullRequestUrl ?? `#${pullRequestNumber}`}`
|
|
33401
33524
|
] : [],
|
|
33402
33525
|
...formatUrlLines("Unique Deployment", deployment.urls),
|
|
33403
|
-
...hasActiveUrls ? [] : [
|
|
33526
|
+
...hasActiveUrls ? [] : [
|
|
33527
|
+
formatNoActivePreviewUrlsMessage(
|
|
33528
|
+
config2,
|
|
33529
|
+
deployCommand,
|
|
33530
|
+
previewCommand
|
|
33531
|
+
)
|
|
33532
|
+
]
|
|
33404
33533
|
].join("\n");
|
|
33405
33534
|
}
|
|
33406
33535
|
__name(formatPreviewDeploymentSummary, "formatPreviewDeploymentSummary");
|
|
@@ -33435,7 +33564,7 @@ function previewUrlMatchesCustomDomain(url3, customDomains) {
|
|
|
33435
33564
|
}
|
|
33436
33565
|
}
|
|
33437
33566
|
__name(previewUrlMatchesCustomDomain, "previewUrlMatchesCustomDomain");
|
|
33438
|
-
function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment) {
|
|
33567
|
+
function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment, deployCommand = "your deploy command", previewCommand = "the preview command") {
|
|
33439
33568
|
const customDomains = getPreviewCustomDomainHostnames(config2);
|
|
33440
33569
|
const urls = [...previewResource.urls ?? [], ...deployment.urls ?? []];
|
|
33441
33570
|
if (customDomains.length === 0 || urls.length === 0 || urls.some((url3) => previewUrlMatchesCustomDomain(url3, customDomains))) {
|
|
@@ -33443,7 +33572,7 @@ function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, depl
|
|
|
33443
33572
|
}
|
|
33444
33573
|
logger.log("");
|
|
33445
33574
|
logger.warn(
|
|
33446
|
-
`Custom domain Preview URLs are configured, but none are active for this Preview. If you
|
|
33575
|
+
`Custom domain Preview URLs are configured, but none are active for this Preview. If you enabled Preview URLs after your last deployment, run \`${deployCommand}\` once to publish the custom domain Preview route, then run \`${previewCommand}\` again. If you already deployed with that setting, the custom domain may still be provisioning.`
|
|
33447
33576
|
);
|
|
33448
33577
|
}
|
|
33449
33578
|
__name(logMissingCustomDomainPreviewUrlsWarning, "logMissingCustomDomainPreviewUrlsWarning");
|
|
@@ -33502,7 +33631,7 @@ async function provisionParentWorker(config2, accountId, workerName, json2) {
|
|
|
33502
33631
|
);
|
|
33503
33632
|
}
|
|
33504
33633
|
__name(provisionParentWorker, "provisionParentWorker");
|
|
33505
|
-
async function runPreview(accountId, args, config2, buildResult, assetsOptions,
|
|
33634
|
+
async function runPreview(accountId, args, config2, buildResult, assetsOptions, options, workerName, replaceTailConsumersAfterCreate = false, localImageReferences = /* @__PURE__ */ new Map()) {
|
|
33506
33635
|
let secrets;
|
|
33507
33636
|
if (args.secretsFile) {
|
|
33508
33637
|
secrets = (await parseBulkInputToObject(args.secretsFile))?.content;
|
|
@@ -33581,7 +33710,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
|
|
|
33581
33710
|
config2,
|
|
33582
33711
|
workerName,
|
|
33583
33712
|
previewResource.slug,
|
|
33584
|
-
|
|
33713
|
+
options,
|
|
33585
33714
|
localImageReferences
|
|
33586
33715
|
);
|
|
33587
33716
|
const deploymentRequest = await assemblePreviewDeploymentSettings(
|
|
@@ -33614,9 +33743,9 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
|
|
|
33614
33743
|
delete binding.text;
|
|
33615
33744
|
}
|
|
33616
33745
|
}
|
|
33617
|
-
if (normalisedContainerConfig.length > 0 && scopedContainerConfig &&
|
|
33746
|
+
if (normalisedContainerConfig.length > 0 && scopedContainerConfig && options.deployPreviewContainers) {
|
|
33618
33747
|
try {
|
|
33619
|
-
await
|
|
33748
|
+
await options.deployPreviewContainers(
|
|
33620
33749
|
scopedContainerConfig,
|
|
33621
33750
|
normalisedContainerConfig,
|
|
33622
33751
|
deployment,
|
|
@@ -33635,7 +33764,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
|
|
|
33635
33764
|
JSON.stringify({ preview: previewResource, deployment }, null, 2)
|
|
33636
33765
|
);
|
|
33637
33766
|
} else {
|
|
33638
|
-
const productionBindingsExpectedInPreview =
|
|
33767
|
+
const productionBindingsExpectedInPreview = options.productionBindingsExpectedInPreview ?? {};
|
|
33639
33768
|
if (Object.keys(productionBindingsExpectedInPreview).length > 0) {
|
|
33640
33769
|
const previewBaseConfig = await getPreviewBaseConfig(
|
|
33641
33770
|
config2,
|
|
@@ -33654,41 +33783,37 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
|
|
|
33654
33783
|
previewResource,
|
|
33655
33784
|
deployment,
|
|
33656
33785
|
isNewPreview,
|
|
33657
|
-
pullRequest
|
|
33786
|
+
pullRequest,
|
|
33787
|
+
options.deployCommand,
|
|
33788
|
+
options.previewCommand
|
|
33658
33789
|
)
|
|
33659
33790
|
);
|
|
33660
33791
|
logMissingCustomDomainPreviewUrlsWarning(
|
|
33661
33792
|
config2,
|
|
33662
33793
|
previewResource,
|
|
33663
|
-
deployment
|
|
33794
|
+
deployment,
|
|
33795
|
+
options.deployCommand,
|
|
33796
|
+
options.previewCommand
|
|
33664
33797
|
);
|
|
33665
33798
|
}
|
|
33666
33799
|
return { preview: previewResource, deployment, isNewPreview };
|
|
33667
33800
|
}
|
|
33668
33801
|
__name(runPreview, "runPreview");
|
|
33669
|
-
async function preview(accountId, args, config2, buildResult, assetsOptions,
|
|
33802
|
+
async function preview(accountId, args, config2, buildResult, assetsOptions, options) {
|
|
33670
33803
|
return runPreview(
|
|
33671
33804
|
accountId,
|
|
33672
33805
|
args,
|
|
33673
33806
|
config2,
|
|
33674
33807
|
buildResult,
|
|
33675
33808
|
assetsOptions,
|
|
33676
|
-
|
|
33809
|
+
options,
|
|
33677
33810
|
resolveWorkerName(args, config2)
|
|
33678
33811
|
);
|
|
33679
33812
|
}
|
|
33680
33813
|
__name(preview, "preview");
|
|
33681
|
-
async function previewBuildOutput(accountId, args, buildOutput,
|
|
33814
|
+
async function previewBuildOutput(accountId, args, buildOutput, options) {
|
|
33682
33815
|
const { workerConfig, rootConfig, buildResult, assets } = buildOutput;
|
|
33683
33816
|
assertPreviewBuildOutputRootConfig(rootConfig);
|
|
33684
|
-
if (workerConfig.domains?.length) {
|
|
33685
|
-
throw new UserError(
|
|
33686
|
-
"Preview uploads from Build Output don't support the `domains` field.",
|
|
33687
|
-
{
|
|
33688
|
-
telemetryMessage: "preview build output custom domains not supported"
|
|
33689
|
-
}
|
|
33690
|
-
);
|
|
33691
|
-
}
|
|
33692
33817
|
if (workerConfig.triggers?.length) {
|
|
33693
33818
|
throw new UserError(
|
|
33694
33819
|
"Preview uploads from Build Output don't support the `triggers` field.",
|
|
@@ -33728,7 +33853,7 @@ async function previewBuildOutput(accountId, args, buildOutput, callbacks) {
|
|
|
33728
33853
|
buildOutput.containers,
|
|
33729
33854
|
previewContainers
|
|
33730
33855
|
);
|
|
33731
|
-
if (previewContainers.length > 0 && (
|
|
33856
|
+
if (previewContainers.length > 0 && (options?.getNormalizedContainerOptions === void 0 || options.deployPreviewContainers === void 0)) {
|
|
33732
33857
|
throw new UserError(
|
|
33733
33858
|
"Preview uploads from Build Output with Containers require container deployment callbacks.",
|
|
33734
33859
|
{
|
|
@@ -33785,7 +33910,7 @@ async function previewBuildOutput(accountId, args, buildOutput, callbacks) {
|
|
|
33785
33910
|
previewConfig,
|
|
33786
33911
|
previewBuildResult,
|
|
33787
33912
|
assetsOptions,
|
|
33788
|
-
|
|
33913
|
+
options ?? {
|
|
33789
33914
|
getNormalizedContainerOptions: void 0,
|
|
33790
33915
|
deployPreviewContainers: void 0
|
|
33791
33916
|
},
|